Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60adbd1

Browse filesBrowse files
committed
Remove C checks for old PY_*VERSION*.
1 parent 14124a5 commit 60adbd1
Copy full SHA for 60adbd1

File tree

Expand file treeCollapse file tree

5 files changed

+3
-56
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+3
-56
lines changed

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
-16Lines 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

Copy file name to clipboardExpand all lines: src/_tkagg.cpp
+3-21Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,10 @@ int load_tkinter_funcs(void)
322322
#else // not Windows
323323

324324
/*
325-
* On Unix, we can get the TCL and Tk synbols from the tkinter module, because
325+
* On Unix, we can get the TCL and Tk symbols from the tkinter module, because
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
330-
#define TKINTER_PKG "tkinter"
331-
#define TKINTER_MOD "_tkinter"
332329
// From module __file__ attribute to char *string for dlopen.
333330
char *fname2char(PyObject *fname)
334331
{
@@ -339,12 +336,6 @@ char *fname2char(PyObject *fname)
339336
}
340337
return PyBytes_AsString(bytes);
341338
}
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
348339

349340
#include <dlfcn.h>
350341

@@ -402,11 +393,11 @@ int load_tkinter_funcs(void)
402393
PyErr_Clear();
403394

404395
// Now try finding the tkinter compiled module
405-
pModule = PyImport_ImportModule(TKINTER_PKG);
396+
pModule = PyImport_ImportModule("tkinter");
406397
if (pModule == NULL) {
407398
goto exit;
408399
}
409-
pSubmodule = PyObject_GetAttrString(pModule, TKINTER_MOD);
400+
pSubmodule = PyObject_GetAttrString(pModule, "_tkinter");
410401
if (pSubmodule == NULL) {
411402
goto exit;
412403
}
@@ -453,7 +444,6 @@ int load_tkinter_funcs(void)
453444
}
454445
#endif // end not Windows
455446

456-
#if PY_MAJOR_VERSION >= 3
457447
static PyModuleDef _tkagg_module = { PyModuleDef_HEAD_INIT, "_tkagg", "", -1, functions,
458448
NULL, NULL, NULL, NULL };
459449

@@ -465,11 +455,3 @@ PyMODINIT_FUNC PyInit__tkagg(void)
465455

466456
return (load_tkinter_funcs() == 0) ? m : NULL;
467457
}
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

Copy file name to clipboardExpand all lines: src/_ttconv.cpp
-8Lines 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

Copy file name to clipboardExpand all lines: src/_windowing.cpp
-9Lines 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

Copy file name to clipboardExpand all lines: src/mplutils.h
-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.