| 1 |
#ifndef STATIC_DATA |
| 2 |
#define STATIC_DATA |
| 3 |
|
| 4 |
#include "static_data.h" |
| 5 |
|
| 6 |
// Adopted from numpy 2.4.0: numpy/_core/src/multiarry/npy_static_data.c |
| 7 |
|
| 8 |
mypyc_interned_str_struct mypyc_interned_str; |
| 9 |
|
| 10 |
#define INTERN_STRING(struct_member, string) \ |
| 11 |
assert(mypyc_interned_str.struct_member == NULL); \ |
| 12 |
mypyc_interned_str.struct_member = PyUnicode_InternFromString(string); \ |
| 13 |
if (mypyc_interned_str.struct_member == NULL) { \ |
| 14 |
return -1; \ |
| 15 |
} |
| 16 |
|
| 17 |
int |
| 18 |
intern_strings(void) { |
| 19 |
if (mypyc_interned_str.values != NULL) { |
| 20 |
// Already interned. |
| 21 |
return 0; |
| 22 |
} |
| 23 |
INTERN_STRING(__init_subclass__, "__init_subclass__"); |
| 24 |
INTERN_STRING(__module__, "__module__"); |
| 25 |
INTERN_STRING(__mro_entries__, "__mro_entries__"); |
| 26 |
INTERN_STRING(__mypyc_attrs__, "__mypyc_attrs__"); |
| 27 |
INTERN_STRING(__name__, "__name__"); |
| 28 |
INTERN_STRING(__orig_bases__, "__orig_bases__"); |
| 29 |
INTERN_STRING(__qualname__, "__qualname__"); |
| 30 |
INTERN_STRING(__slots__, "__slots__"); |
| 31 |
INTERN_STRING(__radd__, "__radd__"); |
| 32 |
INTERN_STRING(__rsub__, "__rsub__"); |
| 33 |
INTERN_STRING(__rmul__, "__rmul__"); |
| 34 |
INTERN_STRING(__rtruediv__, "__rtruediv__"); |
| 35 |
INTERN_STRING(__rmod__, "__rmod__"); |
| 36 |
INTERN_STRING(__rdivmod__, "__rdivmod__"); |
| 37 |
INTERN_STRING(__rfloordiv__, "__rfloordiv__"); |
| 38 |
INTERN_STRING(__rpow__, "__rpow__"); |
| 39 |
INTERN_STRING(__rmatmul__, "__rmatmul__"); |
| 40 |
INTERN_STRING(__rand__, "__rand__"); |
| 41 |
INTERN_STRING(__ror__, "__ror__"); |
| 42 |
INTERN_STRING(__rxor__, "__rxor__"); |
| 43 |
INTERN_STRING(__rlshift__, "__rlshift__"); |
| 44 |
INTERN_STRING(__rrshift__, "__rrshift__"); |
| 45 |
INTERN_STRING(__eq__, "__eq__"); |
| 46 |
INTERN_STRING(__ne__, "__ne__"); |
| 47 |
INTERN_STRING(__gt__, "__gt__"); |
| 48 |
INTERN_STRING(__le__, "__le__"); |
| 49 |
INTERN_STRING(__lt__, "__lt__"); |
| 50 |
INTERN_STRING(__ge__, "__ge__"); |
| 51 |
INTERN_STRING(clear, "clear"); |
| 52 |
INTERN_STRING(close_, "close"); |
| 53 |
INTERN_STRING(copy, "copy"); |
| 54 |
INTERN_STRING(dispatch_cache, "dispatch_cache"); |
| 55 |
INTERN_STRING(endswith, "endswith"); |
| 56 |
INTERN_STRING(get_type_hints, "get_type_hints"); |
| 57 |
INTERN_STRING(keys, "keys"); |
| 58 |
INTERN_STRING(lower, "lower"); |
| 59 |
INTERN_STRING(items, "items"); |
| 60 |
INTERN_STRING(join, "join"); |
| 61 |
INTERN_STRING(register_, "register"); |
| 62 |
INTERN_STRING(registry, "registry"); |
| 63 |
INTERN_STRING(send, "send"); |
| 64 |
INTERN_STRING(setdefault, "setdefault"); |
| 65 |
INTERN_STRING(startswith, "startswith"); |
| 66 |
INTERN_STRING(super, "super"); |
| 67 |
INTERN_STRING(throw_, "throw"); |
| 68 |
INTERN_STRING(translate, "translate"); |
| 69 |
INTERN_STRING(update, "update"); |
| 70 |
INTERN_STRING(upper, "upper"); |
| 71 |
INTERN_STRING(values, "values"); |
| 72 |
return 0; |
| 73 |
} |
| 74 |
|
| 75 |
#endif |