]> granicus.if.org Git - python/commitdiff
Issue #18701: Remove support of old CPython versions (<3.0) from C code.
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 16 Aug 2013 21:48:02 +0000 (00:48 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 16 Aug 2013 21:48:02 +0000 (00:48 +0300)
13 files changed:
Misc/NEWS
Modules/_ctypes/_ctypes.c
Modules/_sqlite/cache.c
Modules/_sqlite/connection.c
Modules/_sqlite/cursor.c
Modules/_sqlite/prepare_protocol.c
Modules/_sqlite/row.c
Modules/_sqlite/statement.c
Modules/_sre.c
Objects/stringlib/unicodedefs.h
PC/VS9.0/_sqlite3.vcproj
PCbuild/_sqlite3.vcxproj
PCbuild/_sqlite3.vcxproj.filters

index 31f7b618f0047a78b0c64e74d0150f9d3c5d05ce..1c532f64e2c7803305b21daa17aa03698d740df9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #18701: Remove support of old CPython versions (<3.0) from C code.
+
 - Issue #18756: Improve error reporting in os.urandom() when the failure
   is due to something else than /dev/urandom not existing (for example,
   exhausting the file descriptor limit).
index 7c34f77a9435d3910ae57ceaced7723e4596c083..a93290e39cd7d08a09c4562e9171180488fc50aa 100644 (file)
@@ -428,13 +428,7 @@ CDataType_from_buffer(PyObject *type, PyObject *args)
     StgDictObject *dict = PyType_stgdict(type);
     assert (dict);
 
-    if (!PyArg_ParseTuple(args,
-#if (PY_VERSION_HEX < 0x02050000)
-                          "O|i:from_buffer",
-#else
-                          "O|n:from_buffer",
-#endif
-                          &obj, &offset))
+    if (!PyArg_ParseTuple(args, "O|n:from_buffer", &obj, &offset))
         return NULL;
 
     if (-1 == PyObject_AsWriteBuffer(obj, &buffer, &buffer_len))
@@ -447,11 +441,7 @@ CDataType_from_buffer(PyObject *type, PyObject *args)
     }
     if (dict->size > buffer_len - offset) {
         PyErr_Format(PyExc_ValueError,
-#if (PY_VERSION_HEX < 0x02050000)
-                     "Buffer size too small (%d instead of at least %d bytes)",
-#else
                      "Buffer size too small (%zd instead of at least %zd bytes)",
-#endif
                      buffer_len, dict->size + offset);
         return NULL;
     }
@@ -484,13 +474,7 @@ CDataType_from_buffer_copy(PyObject *type, PyObject *args)
     StgDictObject *dict = PyType_stgdict(type);
     assert (dict);
 
-    if (!PyArg_ParseTuple(args,
-#if (PY_VERSION_HEX < 0x02050000)
-                          "O|i:from_buffer",
-#else
-                          "O|n:from_buffer",
-#endif
-                          &obj, &offset))
+    if (!PyArg_ParseTuple(args, "O|n:from_buffer", &obj, &offset))
         return NULL;
 
     if (-1 == PyObject_AsReadBuffer(obj, (const void**)&buffer, &buffer_len))
@@ -504,11 +488,7 @@ CDataType_from_buffer_copy(PyObject *type, PyObject *args)
 
     if (dict->size > buffer_len - offset) {
         PyErr_Format(PyExc_ValueError,
-#if (PY_VERSION_HEX < 0x02050000)
-                     "Buffer size too small (%d instead of at least %d bytes)",
-#else
                      "Buffer size too small (%zd instead of at least %zd bytes)",
-#endif
                      buffer_len, dict->size + offset);
         return NULL;
     }
index 3693363bb2ad659588217fe743c6892899cee0f1..3689a4e387c148692bd8a080dd1f7cbfa2c3d9b2 100644 (file)
@@ -21,7 +21,6 @@
  * 3. This notice may not be removed or altered from any source distribution.
  */
 
-#include "sqlitecompat.h"
 #include "cache.h"
 #include <limits.h>
 
index f5e0428edf3594070dc8bb3fd419183df2be5617..531516c277b7168470e709b5c7809e91731bf3b0 100644 (file)
@@ -29,7 +29,6 @@
 #include "cursor.h"
 #include "prepare_protocol.h"
 #include "util.h"
-#include "sqlitecompat.h"
 
 #include "pythread.h"
 
index 8f9bd699a6c5c771749a389d0bf71868de840ac3..bf4bbb4a28577ce1404f22df42aa4597b9560f63 100644 (file)
@@ -24,7 +24,6 @@
 #include "cursor.h"
 #include "module.h"
 #include "util.h"
-#include "sqlitecompat.h"
 
 PyObject* pysqlite_cursor_iternext(pysqlite_Cursor* self);
 
index fc6887445e8679d16bcee1004bfa1fe74a46ab60..f2c85f9af6cb68a98dd1210ae4269f636d202bfb 100644 (file)
@@ -21,7 +21,6 @@
  * 3. This notice may not be removed or altered from any source distribution.
  */
 
-#include "sqlitecompat.h"
 #include "prepare_protocol.h"
 
 int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs)
index b50658c220dbc79c6d8455587ccbbf960ff0eb79..14c148e31097ea26e6ea6bc8ed7cc2b99e9b2054 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "row.h"
 #include "cursor.h"
-#include "sqlitecompat.h"
 
 void pysqlite_row_dealloc(pysqlite_Row* self)
 {
index 471a0676a83fafd8c521c8dafb563c8181b76b01..36beef10a1f53746e0a63b93728a29a7eb5ab825 100644 (file)
@@ -27,7 +27,6 @@
 #include "microprotocols.h"
 #include "prepare_protocol.h"
 #include "util.h"
-#include "sqlitecompat.h"
 
 /* prototypes */
 static int pysqlite_check_remaining_sql(const char* tail);
index a6933e8abc28d59f5c98cba8b11e0b20a7e2357c..41ed667a37e655bff6704f5533cb30d06a3655f5 100644 (file)
@@ -70,10 +70,6 @@ static char copyright[] =
 /* enables copy/deepcopy handling (work in progress) */
 #undef USE_BUILTIN_COPY
 
-#if PY_VERSION_HEX < 0x01060000
-#define PyObject_DEL(op) PyMem_DEL((op))
-#endif
-
 /* -------------------------------------------------------------------- */
 
 #if defined(_MSC_VER)
@@ -1993,10 +1989,8 @@ join_list(PyObject* list, PyObject* string)
     /* join list elements */
 
     PyObject* joiner;
-#if PY_VERSION_HEX >= 0x01060000
     PyObject* function;
     PyObject* args;
-#endif
     PyObject* result;
 
     joiner = PySequence_GetSlice(string, 0, 0);
@@ -2008,7 +2002,6 @@ join_list(PyObject* list, PyObject* string)
         return joiner;
     }
 
-#if PY_VERSION_HEX >= 0x01060000
     function = PyObject_GetAttrString(joiner, "join");
     if (!function) {
         Py_DECREF(joiner);
@@ -2024,12 +2017,6 @@ join_list(PyObject* list, PyObject* string)
     result = PyObject_CallObject(function, args);
     Py_DECREF(args); /* also removes list */
     Py_DECREF(function);
-#else
-    result = call(
-        "string", "join",
-        PyTuple_Pack(2, list, joiner)
-        );
-#endif
     Py_DECREF(joiner);
 
     return result;
@@ -2136,7 +2123,6 @@ error:
 
 }
 
-#if PY_VERSION_HEX >= 0x02020000
 static PyObject*
 pattern_finditer(PatternObject* pattern, PyObject* args, PyObject* kw)
 {
@@ -2158,7 +2144,6 @@ pattern_finditer(PatternObject* pattern, PyObject* args, PyObject* kw)
 
     return iterator;
 }
-#endif
 
 static PyObject*
 pattern_split(PatternObject* self, PyObject* args, PyObject* kw)
@@ -2581,10 +2566,8 @@ static PyMethodDef pattern_methods[] = {
         pattern_split_doc},
     {"findall", (PyCFunction) pattern_findall, METH_VARARGS|METH_KEYWORDS,
         pattern_findall_doc},
-#if PY_VERSION_HEX >= 0x02020000
     {"finditer", (PyCFunction) pattern_finditer, METH_VARARGS|METH_KEYWORDS,
         pattern_finditer_doc},
-#endif
     {"scanner", (PyCFunction) pattern_scanner, METH_VARARGS|METH_KEYWORDS},
     {"__copy__", (PyCFunction) pattern_copy, METH_NOARGS},
     {"__deepcopy__", (PyCFunction) pattern_deepcopy, METH_O},
index 48d00eccd046a55648eb4d0334c53e6393217e5b..3db5629e11f126066206dbfa83070383368c9dff 100644 (file)
 #define STRINGLIB_CHECK          PyUnicode_Check
 #define STRINGLIB_CHECK_EXACT    PyUnicode_CheckExact
 
-#if PY_VERSION_HEX < 0x03000000
-#define STRINGLIB_TOSTR          PyObject_Unicode
-#define STRINGLIB_TOASCII        PyObject_Repr
-#else
 #define STRINGLIB_TOSTR          PyObject_Str
 #define STRINGLIB_TOASCII        PyObject_ASCII
-#endif
 
 #define STRINGLIB_WANT_CONTAINS_OBJ 1
 
index f7100f1c5fd28f1da80ec66ff1810c909e7f43d6..82c57ae25fd7e314b5de642156092bdd183e8405 100644 (file)
                                RelativePath="..\..\Modules\_sqlite\row.h"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\Modules\_sqlite\sqlitecompat.h"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\Modules\_sqlite\statement.h"\r
                                >\r
index 392dad1a659ed7c169b01330121952fa79170447..ed35d5bc0c3147a01b3ed42e03848b7fd17fa930 100644 (file)
     <ClInclude Include="..\Modules\_sqlite\module.h" />
     <ClInclude Include="..\Modules\_sqlite\prepare_protocol.h" />
     <ClInclude Include="..\Modules\_sqlite\row.h" />
-    <ClInclude Include="..\Modules\_sqlite\sqlitecompat.h" />
     <ClInclude Include="..\Modules\_sqlite\statement.h" />
     <ClInclude Include="..\Modules\_sqlite\util.h" />
   </ItemGroup>
index 88e5fdbb9aa950cd3190278d842c25c3ae05a1a4..dce77c96a80599fb98aae9ceb4304a4dd4f5697d 100644 (file)
@@ -30,9 +30,6 @@
     <ClInclude Include="..\Modules\_sqlite\row.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\Modules\_sqlite\sqlitecompat.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\Modules\_sqlite\statement.h">
       <Filter>Header Files</Filter>
     </ClInclude>