Added code example for python-speedup.
This commit is contained in:
		@ -1,4 +1,7 @@
 | 
				
			|||||||
#include <Python.h>
 | 
					#include <Python.h>
 | 
				
			||||||
 | 
					#include <print>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int       test = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PyObject* my_stat_counter(PyObject* self, PyObject* args) {
 | 
					PyObject* my_stat_counter(PyObject* self, PyObject* args) {
 | 
				
			||||||
    size_t to_add;
 | 
					    size_t to_add;
 | 
				
			||||||
@ -8,8 +11,9 @@ PyObject* my_stat_counter(PyObject* self, PyObject* args) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // PyObject* state = Py_None;
 | 
					    // PyObject* state = Py_None;
 | 
				
			||||||
    auto mod_shit = (size_t*)PyModule_GetState(self);
 | 
					    auto mod_shit = (size_t*)PyModule_GetState(self);
 | 
				
			||||||
    if (*mod_shit == 0) {
 | 
					    if (mod_shit == NULL) {
 | 
				
			||||||
        *mod_shit = 1;
 | 
					        std::println("heheheh fuck you");
 | 
				
			||||||
 | 
					        return (PyObject*)NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    *mod_shit += to_add;
 | 
					    *mod_shit += to_add;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user