Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44bead1

Browse files
committed
Remove C checks for old PY_HEX_VERSION.
1 parent 5e23e2c commit 44bead1

File tree

5 files changed

+0
-51
lines changed

5 files changed

+0
-51
lines changed

src/_path.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,13 +1076,8 @@ char *__add_number(double val, const char *format, int precision,
10761076
{
10771077
char *result;
10781078

1079-
#if PY_VERSION_HEX >= 0x02070000
10801079
char *str;
10811080
str = PyOS_double_to_string(val, format[0], precision, 0, NULL);
1082-
#else
1083-
char str[64];
1084-
PyOS_ascii_formatd(str, 64, format, val);
1085-
#endif
10861081

10871082
// Delete trailing zeros and decimal point
10881083
char *q = str;
@@ -1104,17 +1099,11 @@ char *__add_number(double val, const char *format, int precision,
11041099
++q;
11051100
*q = 0;
11061101

1107-
#if PY_VERSION_HEX >= 0x02070000
11081102
if ((result = __append_to_string(p, buffer, buffersize, str)) == NULL) {
11091103
PyMem_Free(str);
11101104
return NULL;
11111105
}
11121106
PyMem_Free(str);
1113-
#else
1114-
if ((result = __append_to_string(p, buffer, buffersize, str)) == NULL) {
1115-
return NULL;
1116-
}
1117-
#endif
11181107

11191108
return result;
11201109
}
@@ -1128,12 +1117,7 @@ int __convert_to_string(PathIterator &path,
11281117
char **buffer,
11291118
size_t *buffersize)
11301119
{
1131-
#if PY_VERSION_HEX >= 0x02070000
11321120
const char *format = "f";
1133-
#else
1134-
char format[64];
1135-
snprintf(format, 64, "%s.%df", "%", precision);
1136-
#endif
11371121

11381122
char *p = *buffer;
11391123
double x[3];

src/_tkagg.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ int load_tkinter_funcs(void)
326326
* tkinter uses these symbols, and the symbols are therefore visible in the
327327
* tkinter dynamic library (module).
328328
*/
329-
#if PY_MAJOR_VERSION >= 3
330329
#define TKINTER_PKG "tkinter"
331330
#define TKINTER_MOD "_tkinter"
332331
// From module __file__ attribute to char *string for dlopen.
@@ -339,12 +338,6 @@ char *fname2char(PyObject *fname)
339338
}
340339
return PyBytes_AsString(bytes);
341340
}
342-
#else
343-
#define TKINTER_PKG "Tkinter"
344-
#define TKINTER_MOD "tkinter"
345-
// From module __file__ attribute to char *string for dlopen
346-
#define fname2char(s) (PyString_AsString(s))
347-
#endif
348341

349342
#include <dlfcn.h>
350343

@@ -453,7 +446,6 @@ int load_tkinter_funcs(void)
453446
}
454447
#endif // end not Windows
455448

456-
#if PY_MAJOR_VERSION >= 3
457449
static PyModuleDef _tkagg_module = { PyModuleDef_HEAD_INIT, "_tkagg", "", -1, functions,
458450
NULL, NULL, NULL, NULL };
459451

@@ -465,11 +457,3 @@ PyMODINIT_FUNC PyInit__tkagg(void)
465457

466458
return (load_tkinter_funcs() == 0) ? m : NULL;
467459
}
468-
#else
469-
PyMODINIT_FUNC init_tkagg(void)
470-
{
471-
Py_InitModule("_tkagg", functions);
472-
473-
load_tkinter_funcs();
474-
}
475-
#endif

src/_ttconv.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ static PyObject *convert_ttf_to_ps(PyObject *self, PyObject *args, PyObject *kwd
109109
static const char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL };
110110
if (!PyArg_ParseTupleAndKeywords(args,
111111
kwds,
112-
#if PY_MAJOR_VERSION == 3
113112
"yO&i|O&:convert_ttf_to_ps",
114-
#else
115-
"sO&i|O&:convert_ttf_to_ps",
116-
#endif
117113
(char **)kwlist,
118114
&filename,
119115
fileobject_to_PythonFileWriter,
@@ -189,11 +185,7 @@ static PyObject *py_get_pdf_charprocs(PyObject *self, PyObject *args, PyObject *
189185
static const char *kwlist[] = { "filename", "glyph_ids", NULL };
190186
if (!PyArg_ParseTupleAndKeywords(args,
191187
kwds,
192-
#if PY_MAJOR_VERSION == 3
193188
"y|O&:get_pdf_charprocs",
194-
#else
195-
"s|O&:get_pdf_charprocs",
196-
#endif
197189
(char **)kwlist,
198190
&filename,
199191
pyiterable_to_vector_int,

src/_windowing.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ static PyMethodDef _windowing_methods[] =
3636
{NULL, NULL}
3737
};
3838

39-
#if PY_MAJOR_VERSION >= 3
40-
4139
static struct PyModuleDef moduledef = {
4240
PyModuleDef_HEAD_INIT,
4341
"_windowing",
@@ -55,10 +53,3 @@ PyMODINIT_FUNC PyInit__windowing(void)
5553
PyObject *module = PyModule_Create(&moduledef);
5654
return module;
5755
}
58-
59-
#else
60-
PyMODINIT_FUNC init_windowing()
61-
{
62-
Py_InitModule("_windowing", _windowing_methods);
63-
}
64-
#endif

src/mplutils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ typedef unsigned __int8 uint8_t;
3030

3131
#include <Python.h>
3232

33-
#if PY_MAJOR_VERSION >= 3
3433
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
35-
#endif
3634

3735
#undef CLAMP
3836
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))

0 commit comments

Comments
 (0)