File tree Expand file tree Collapse file tree 1 file changed +31
-4
lines changed
pydatastructs/utils/_backend/cpp Expand file tree Collapse file tree 1 file changed +31
-4
lines changed Original file line number Diff line number Diff line change 66#include < cstring>
77#include < string>
88
9- static PyObject *PyZero = PyLong_FromLong(0 );
10- static PyObject *PyOne = PyLong_FromLong(1 );
11- static PyObject *PyTwo = PyLong_FromLong(2 );
12- static PyObject *PyThree = PyLong_FromLong(3 );
9+ static PyObject* get_PyZero () {
10+ static PyObject* PyZero = nullptr ;
11+ if (PyZero == nullptr ) {
12+ PyZero = PyLong_FromLong (0 );
13+ }
14+ return PyZero;
15+ }
16+
17+ static PyObject* get_PyOne () {
18+ static PyObject* PyOne = nullptr ;
19+ if (PyOne == nullptr ) {
20+ PyOne = PyLong_FromLong (1 );
21+ }
22+ return PyOne;
23+ }
24+
25+ static PyObject* get_PyTwo () {
26+ static PyObject* PyTwo = nullptr ;
27+ if (PyTwo == nullptr ) {
28+ PyTwo = PyLong_FromLong (2 );
29+ }
30+ return PyTwo;
31+ }
32+
33+ static PyObject* get_PyThree () {
34+ static PyObject* PyThree = nullptr ;
35+ if (PyThree == nullptr ) {
36+ PyThree = PyLong_FromLong (3 );
37+ }
38+ return PyThree;
39+ }
1340static const char * _encoding = " utf-8" ;
1441static const char * _invalid_char = " <invalid-character>" ;
1542
You can’t perform that action at this time.
0 commit comments