| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -494,7 +494,6 @@ static PyTypeObject* PyTrapezoidMapTriFinder_init_type(PyObject* m, PyTypeObject | |||
| 494 | 494 | ||
| 495 | 495 | extern "C" { | |
| 496 | 496 | ||
| 497 | - #if PY3K | ||
| 498 | 497 | static struct PyModuleDef moduledef = { | |
| 499 | 498 | PyModuleDef_HEAD_INIT, | |
| 500 | 499 | "_tri", | |
@@ -507,44 +506,29 @@ static struct PyModuleDef moduledef = { | |||
| 507 | 506 | NULL | |
| 508 | 507 | }; | |
| 509 | 508 | ||
| 510 | - #define INITERROR return NULL | ||
| 511 | - | ||
| 512 | 509 | PyMODINIT_FUNC PyInit__tri(void) | |
| 513 | - | ||
| 514 | - #else | ||
| 515 | - #define INITERROR return | ||
| 516 | - | ||
| 517 | - PyMODINIT_FUNC init_tri(void) | ||
| 518 | - #endif | ||
| 519 | - | ||
| 520 | 510 | { | |
| 521 | 511 | PyObject *m; | |
| 522 | 512 | ||
| 523 | - #if PY3K | ||
| 524 | 513 | m = PyModule_Create(&moduledef); | |
| 525 | - #else | ||
| 526 | - m = Py_InitModule3("_tri", NULL, NULL); | ||
| 527 | - #endif | ||
| 528 | 514 | ||
| 529 | 515 | if (m == NULL) { | |
| 530 | - INITERROR; | ||
| 516 | + return NULL; | ||
| 531 | 517 | } | |
| 532 | 518 | ||
| 533 | 519 | if (!PyTriangulation_init_type(m, &PyTriangulationType)) { | |
| 534 | - INITERROR; | ||
| 520 | + return NULL; | ||
| 535 | 521 | } | |
| 536 | 522 | if (!PyTriContourGenerator_init_type(m, &PyTriContourGeneratorType)) { | |
| 537 | - INITERROR; | ||
| 523 | + return NULL; | ||
| 538 | 524 | } | |
| 539 | 525 | if (!PyTrapezoidMapTriFinder_init_type(m, &PyTrapezoidMapTriFinderType)) { | |
| 540 | - INITERROR; | ||
| 526 | + return NULL; | ||
| 541 | 527 | } | |
| 542 | 528 | ||
| 543 | 529 | import_array(); | |
| 544 | 530 | ||
| 545 | - #if PY3K | ||
| 546 | 531 | return m; | |
| 547 | - #endif | ||
| 548 | 532 | } | |
| 549 | 533 | ||
| 550 | 534 | } // extern "C" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -586,13 +586,8 @@ PyRendererAgg_get_content_extents(PyRendererAgg *self, PyObject *args, PyObject | |||
| 586 | 586 | ||
| 587 | 587 | static PyObject *PyRendererAgg_buffer_rgba(PyRendererAgg *self, PyObject *args, PyObject *kwds) | |
| 588 | 588 | { | |
| 589 | - #if PY3K | ||
| 590 | 589 | return PyBytes_FromStringAndSize((const char *)self->x->pixBuffer, | |
| 591 | 590 | self->x->get_width() * self->x->get_height() * 4); | |
| 592 | - #else | ||
| 593 | - return PyBuffer_FromReadWriteMemory(self->x->pixBuffer, | ||
| 594 | - self->x->get_width() * self->x->get_height() * 4); | ||
| 595 | - #endif | ||
| 596 | 591 | } | |
| 597 | 592 | ||
| 598 | 593 | int PyRendererAgg_get_buffer(PyRendererAgg *self, Py_buffer *buf, int flags) | |
@@ -724,7 +719,6 @@ static PyTypeObject *PyRendererAgg_init_type(PyObject *m, PyTypeObject *type) | |||
| 724 | 719 | ||
| 725 | 720 | extern "C" { | |
| 726 | 721 | ||
| 727 | - #if PY3K | ||
| 728 | 722 | static struct PyModuleDef moduledef = { | |
| 729 | 723 | PyModuleDef_HEAD_INIT, | |
| 730 | 724 | "_backend_agg", | |
@@ -737,42 +731,27 @@ static struct PyModuleDef moduledef = { | |||
| 737 | 731 | NULL | |
| 738 | 732 | }; | |
| 739 | 733 | ||
| 740 | - #define INITERROR return NULL | ||
| 741 | - | ||
| 742 | 734 | PyMODINIT_FUNC PyInit__backend_agg(void) | |
| 743 | - | ||
| 744 | - #else | ||
| 745 | - #define INITERROR return | ||
| 746 | - | ||
| 747 | - PyMODINIT_FUNC init_backend_agg(void) | ||
| 748 | - #endif | ||
| 749 | - | ||
| 750 | 735 | { | |
| 751 | 736 | PyObject *m; | |
| 752 | 737 | ||
| 753 | - #if PY3K | ||
| 754 | 738 | m = PyModule_Create(&moduledef); | |
| 755 | - #else | ||
| 756 | - m = Py_InitModule3("_backend_agg", NULL, NULL); | ||
| 757 | - #endif | ||
| 758 | 739 | ||
| 759 | 740 | if (m == NULL) { | |
| 760 | - INITERROR; | ||
| 741 | + return NULL; | ||
| 761 | 742 | } | |
| 762 | 743 | ||
| 763 | 744 | import_array(); | |
| 764 | 745 | ||
| 765 | 746 | if (!PyRendererAgg_init_type(m, &PyRendererAggType)) { | |
| 766 | - INITERROR; | ||
| 747 | + return NULL; | ||
| 767 | 748 | } | |
| 768 | 749 | ||
| 769 | 750 | if (!PyBufferRegion_init_type(m, &PyBufferRegionType)) { | |
| 770 | - INITERROR; | ||
| 751 | + return NULL; | ||
| 771 | 752 | } | |
| 772 | 753 | ||
| 773 | - #if PY3K | ||
| 774 | 754 | return m; | |
| 775 | - #endif | ||
| 776 | 755 | } | |
| 777 | 756 | ||
| 778 | 757 | } // extern "C" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -154,7 +154,6 @@ static PyTypeObject* PyQuadContourGenerator_init_type(PyObject* m, PyTypeObject* | |||
| 154 | 154 | ||
| 155 | 155 | extern "C" { | |
| 156 | 156 | ||
| 157 | - #if PY3K | ||
| 158 | 157 | static struct PyModuleDef moduledef = { | |
| 159 | 158 | PyModuleDef_HEAD_INIT, | |
| 160 | 159 | "_contour", | |
@@ -167,38 +166,23 @@ static struct PyModuleDef moduledef = { | |||
| 167 | 166 | NULL | |
| 168 | 167 | }; | |
| 169 | 168 | ||
| 170 | - #define INITERROR return NULL | ||
| 171 | - | ||
| 172 | 169 | PyMODINIT_FUNC PyInit__contour(void) | |
| 173 | - | ||
| 174 | - #else | ||
| 175 | - #define INITERROR return | ||
| 176 | - | ||
| 177 | - PyMODINIT_FUNC init_contour(void) | ||
| 178 | - #endif | ||
| 179 | - | ||
| 180 | 170 | { | |
| 181 | 171 | PyObject *m; | |
| 182 | 172 | ||
| 183 | - #if PY3K | ||
| 184 | 173 | m = PyModule_Create(&moduledef); | |
| 185 | - #else | ||
| 186 | - m = Py_InitModule3("_contour", NULL, NULL); | ||
| 187 | - #endif | ||
| 188 | 174 | ||
| 189 | 175 | if (m == NULL) { | |
| 190 | - INITERROR; | ||
| 176 | + return NULL; | ||
| 191 | 177 | } | |
| 192 | 178 | ||
| 193 | 179 | if (!PyQuadContourGenerator_init_type(m, &PyQuadContourGeneratorType)) { | |
| 194 | - INITERROR; | ||
| 180 | + return NULL; | ||
| 195 | 181 | } | |
| 196 | 182 | ||
| 197 | 183 | import_array(); | |
| 198 | 184 | ||
| 199 | - #if PY3K | ||
| 200 | 185 | return m; | |
| 201 | - #endif | ||
| 202 | 186 | } | |
| 203 | 187 | ||
| 204 | 188 | } // extern "C" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -437,7 +437,6 @@ static PyMethodDef module_functions[] = { | |||
| 437 | 437 | ||
| 438 | 438 | extern "C" { | |
| 439 | 439 | ||
| 440 | - #if PY3K | ||
| 441 | 440 | static struct PyModuleDef moduledef = { | |
| 442 | 441 | PyModuleDef_HEAD_INIT, | |
| 443 | 442 | "_image", | |
@@ -450,27 +449,14 @@ static struct PyModuleDef moduledef = { | |||
| 450 | 449 | NULL | |
| 451 | 450 | }; | |
| 452 | 451 | ||
| 453 | - #define INITERROR return NULL | ||
| 454 | - | ||
| 455 | 452 | PyMODINIT_FUNC PyInit__image(void) | |
| 456 | - | ||
| 457 | - #else | ||
| 458 | - #define INITERROR return | ||
| 459 | - | ||
| 460 | - PyMODINIT_FUNC init_image(void) | ||
| 461 | - #endif | ||
| 462 | - | ||
| 463 | 453 | { | |
| 464 | 454 | PyObject *m; | |
| 465 | 455 | ||
| 466 | - #if PY3K | ||
| 467 | 456 | m = PyModule_Create(&moduledef); | |
| 468 | - #else | ||
| 469 | - m = Py_InitModule3("_image", module_functions, NULL); | ||
| 470 | - #endif | ||
| 471 | 457 | ||
| 472 | 458 | if (m == NULL) { | |
| 473 | - INITERROR; | ||
| 459 | + return NULL; | ||
| 474 | 460 | } | |
| 475 | 461 | ||
| 476 | 462 | if (PyModule_AddIntConstant(m, "NEAREST", NEAREST) || | |
@@ -491,14 +477,12 @@ PyMODINIT_FUNC init_image(void) | |||
| 491 | 477 | PyModule_AddIntConstant(m, "LANCZOS", LANCZOS) || | |
| 492 | 478 | PyModule_AddIntConstant(m, "BLACKMAN", BLACKMAN) || | |
| 493 | 479 | PyModule_AddIntConstant(m, "_n_interpolation", _n_interpolation)) { | |
| 494 | - INITERROR; | ||
| 480 | + return NULL; | ||
| 495 | 481 | } | |
| 496 | 482 | ||
| 497 | 483 | import_array(); | |
| 498 | 484 | ||
| 499 | - #if PY3K | ||
| 500 | 485 | return m; | |
| 501 | - #endif | ||
| 502 | 486 | } | |
| 503 | 487 | ||
| 504 | 488 | } // extern "C" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,12 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | 6 | #define PYOSINPUTHOOK_REPETITIVE 1 /* Remove this once Python is fixed */ | |
| 7 | 7 | ||
| 8 | - #if PY_MAJOR_VERSION >= 3 | ||
| 9 | - #define PY3K 1 | ||
| 10 | - #else | ||
| 11 | - #define PY3K 0 | ||
| 12 | - #endif | ||
| 13 | - | ||
| 14 | 8 | /* Proper way to check for the OS X version we are compiling for, from | |
| 15 | 9 | http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */ | |
| 16 | 10 | #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | |
@@ -325,13 +319,8 @@ static CGFloat _get_device_scale(CGContextRef cr) | |||
| 325 | 319 | static PyObject* | |
| 326 | 320 | FigureCanvas_repr(FigureCanvas* self) | |
| 327 | 321 | { | |
| 328 | - #if PY3K | ||
| 329 | 322 | return PyUnicode_FromFormat("FigureCanvas object %p wrapping NSView %p", | |
| 330 | 323 | (void*)self, (void*)(self->view)); | |
| 331 | - #else | ||
| 332 | - return PyString_FromFormat("FigureCanvas object %p wrapping NSView %p", | ||
| 333 | - (void*)self, (void*)(self->view)); | ||
| 334 | - #endif | ||
| 335 | 324 | } | |
| 336 | 325 | ||
| 337 | 326 | static PyObject* | |
@@ -730,13 +719,8 @@ static CGFloat _get_device_scale(CGContextRef cr) | |||
| 730 | 719 | static PyObject* | |
| 731 | 720 | FigureManager_repr(FigureManager* self) | |
| 732 | 721 | { | |
| 733 | - #if PY3K | ||
| 734 | 722 | return PyUnicode_FromFormat("FigureManager object %p wrapping NSWindow %p", | |
| 735 | 723 | (void*) self, (void*)(self->window)); | |
| 736 | - #else | ||
| 737 | - return PyString_FromFormat("FigureManager object %p wrapping NSWindow %p", | ||
| 738 | - (void*) self, (void*)(self->window)); | ||
| 739 | - #endif | ||
| 740 | 724 | } | |
| 741 | 725 | ||
| 742 | 726 | static void | |
@@ -1197,11 +1181,7 @@ -(void)save_figure:(id)sender | |||
| 1197 | 1181 | static PyObject* | |
| 1198 | 1182 | NavigationToolbar_repr(NavigationToolbar* self) | |
| 1199 | 1183 | { | |
| 1200 | - #if PY3K | ||
| 1201 | 1184 | return PyUnicode_FromFormat("NavigationToolbar object %p", (void*)self); | |
| 1202 | - #else | ||
| 1203 | - return PyString_FromFormat("NavigationToolbar object %p", (void*)self); | ||
| 1204 | - #endif | ||
| 1205 | 1185 | } | |
| 1206 | 1186 | ||
| 1207 | 1187 | static char NavigationToolbar_doc[] = | |
@@ -1743,11 +1723,7 @@ -(void)save_figure:(id)sender | |||
| 1743 | 1723 | static PyObject* | |
| 1744 | 1724 | NavigationToolbar2_repr(NavigationToolbar2* self) | |
| 1745 | 1725 | { | |
| 1746 | - #if PY3K | ||
| 1747 | 1726 | return PyUnicode_FromFormat("NavigationToolbar2 object %p", (void*)self); | |
| 1748 | - #else | ||
| 1749 | - return PyString_FromFormat("NavigationToolbar2 object %p", (void*)self); | ||
| 1750 | - #endif | ||
| 1751 | 1727 | } | |
| 1752 | 1728 | ||
| 1753 | 1729 | static char NavigationToolbar2_doc[] = | |
@@ -1758,11 +1734,7 @@ -(void)save_figure:(id)sender | |||
| 1758 | 1734 | { | |
| 1759 | 1735 | const char* message; | |
| 1760 | 1736 | ||
| 1761 | - #if PY3K | ||
| 1762 | 1737 | if(!PyArg_ParseTuple(args, "y", &message)) return NULL; | |
| 1763 | - #else | ||
| 1764 | - if(!PyArg_ParseTuple(args, "s", &message)) return NULL; | ||
| 1765 | - #endif | ||
| 1766 | 1738 | ||
| 1767 | 1739 | NSText* messagebox = self->messagebox; | |
| 1768 | 1740 | ||
@@ -1869,11 +1841,7 @@ -(void)save_figure:(id)sender | |||
| 1869 | 1841 | unsigned int n = [filename length]; | |
| 1870 | 1842 | unichar* buffer = malloc(n*sizeof(unichar)); | |
| 1871 | 1843 | [filename getCharacters: buffer]; | |
| 1872 | - #if PY3K | ||
| 1873 | - PyObject* string = PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, buffer, n); | ||
| 1874 | - #else | ||
| 1875 | - PyObject* string = PyUnicode_FromUnicode(buffer, n); | ||
| 1876 | - #endif | ||
| 1844 | + PyObject* string = PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, buffer, n); | ||
| 1877 | 1845 | free(buffer); | |
| 1878 | 1846 | return string; | |
| 1879 | 1847 | } | |
@@ -2855,13 +2823,8 @@ - (int)index | |||
| 2855 | 2823 | static PyObject* | |
| 2856 | 2824 | Timer_repr(Timer* self) | |
| 2857 | 2825 | { | |
| 2858 | - #if PY3K | ||
| 2859 | 2826 | return PyUnicode_FromFormat("Timer object %p wrapping CFRunLoopTimerRef %p", | |
| 2860 | 2827 | (void*) self, (void*)(self->timer)); | |
| 2861 | - #else | ||
| 2862 | - return PyString_FromFormat("Timer object %p wrapping CFRunLoopTimerRef %p", | ||
| 2863 | - (void*) self, (void*)(self->timer)); | ||
| 2864 | - #endif | ||
| 2865 | 2828 | } | |
| 2866 | 2829 | ||
| 2867 | 2830 | static char Timer_doc[] = | |
@@ -3092,8 +3055,6 @@ static bool verify_framework(void) | |||
| 3092 | 3055 | {NULL, NULL, 0, NULL}/* sentinel */ | |
| 3093 | 3056 | }; | |
| 3094 | 3057 | ||
| 3095 | - #if PY3K | ||
| 3096 | - | ||
| 3097 | 3058 | static struct PyModuleDef moduledef = { | |
| 3098 | 3059 | PyModuleDef_HEAD_INIT, | |
| 3099 | 3060 | "_macosx", | |
@@ -3107,11 +3068,6 @@ static bool verify_framework(void) | |||
| 3107 | 3068 | }; | |
| 3108 | 3069 | ||
| 3109 | 3070 | PyObject* PyInit__macosx(void) | |
| 3110 | - | ||
| 3111 | - #else | ||
| 3112 | - | ||
| 3113 | - void init_macosx(void) | ||
| 3114 | - #endif | ||
| 3115 | 3071 | { | |
| 3116 | 3072 | PyObject *module; | |
| 3117 | 3073 | ||
@@ -3120,31 +3076,15 @@ void init_macosx(void) | |||
| 3120 | 3076 | || PyType_Ready(&NavigationToolbarType) < 0 | |
| 3121 | 3077 | || PyType_Ready(&NavigationToolbar2Type) < 0 | |
| 3122 | 3078 | || PyType_Ready(&TimerType) < 0) | |
| 3123 | - #if PY3K | ||
| 3124 | 3079 | return NULL; | |
| 3125 | - #else | ||
| 3126 | - return; | ||
| 3127 | - #endif | ||
| 3128 | 3080 | ||
| 3129 | 3081 | NSApp = [NSApplication sharedApplication]; | |
| 3130 | 3082 | ||
| 3131 | 3083 | if (!verify_framework()) | |
| 3132 | - #if PY3K | ||
| 3133 | 3084 | return NULL; | |
| 3134 | - #else | ||
| 3135 | - return; | ||
| 3136 | - #endif | ||
| 3137 | 3085 | ||
| 3138 | - #if PY3K | ||
| 3139 | 3086 | module = PyModule_Create(&moduledef); | |
| 3140 | 3087 | if (module==NULL) return NULL; | |
| 3141 | - #else | ||
| 3142 | - module = Py_InitModule4("_macosx", | ||
| 3143 | - methods, | ||
| 3144 | - "Mac OS X native backend", | ||
| 3145 | - NULL, | ||
| 3146 | - PYTHON_API_VERSION); | ||
| 3147 | - #endif | ||
| 3148 | 3088 | ||
| 3149 | 3089 | Py_INCREF(&FigureCanvasType); | |
| 3150 | 3090 | Py_INCREF(&FigureManagerType); | |
@@ -3168,7 +3108,5 @@ void init_macosx(void) | |||
| 3168 | 3108 | name: NSWorkspaceDidLaunchApplicationNotification | |
| 3169 | 3109 | object: nil]; | |
| 3170 | 3110 | [pool release]; | |
| 3171 | - #if PY3K | ||
| 3172 | 3111 | return module; | |
| 3173 | - #endif | ||
| 3174 | 3112 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments