comparison configmix/_speedups.c @ 547:1cbe8b0f2b78

Put the value of Py_LIMITED_API into the module dict when the C-extension is compiled against the stable API
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 01 Jan 2022 21:18:55 +0100
parents 6501fe0e116c
children 84657447ab39
comparison
equal deleted inserted replaced
546:adf65c31f8fc 547:1cbe8b0f2b78
479 {"fast_pathstr2path", fast_pathstr2path, METH_O, PyDoc_STR("C-implementation of configmix.pathstr2path")}, 479 {"fast_pathstr2path", fast_pathstr2path, METH_O, PyDoc_STR("C-implementation of configmix.pathstr2path")},
480 {"_fast_split_ns", fast_split_ns, METH_O, PyDoc_STR("C-implementation of configmix.config._split_ns")}, 480 {"_fast_split_ns", fast_split_ns, METH_O, PyDoc_STR("C-implementation of configmix.config._split_ns")},
481 {NULL, NULL, 0, NULL} 481 {NULL, NULL, 0, NULL}
482 }; 482 };
483 483
484 #define STRINGIFY(s) #s
485 #define XSTRINGIFY(s) STRINGIFY(s)
486
484 487
485 static 488 static
486 int 489 int
487 speedups_exec(PyObject *module) 490 speedups_exec(PyObject *module)
488 { 491 {
494 } 497 }
495 498
496 PyModule_AddStringConstant(module, "__release__", release); 499 PyModule_AddStringConstant(module, "__release__", release);
497 PyModule_AddStringConstant(module, "__date__", date); 500 PyModule_AddStringConstant(module, "__date__", date);
498 PyModule_AddStringConstant(module, "__author__", "Franz Glasner"); 501 PyModule_AddStringConstant(module, "__author__", "Franz Glasner");
502 #if defined(Py_LIMITED_API)
503 PyModule_AddStringConstant(module, "Py_LIMITED_API", XSTRINGIFY(Py_LIMITED_API));
504 #endif
499 505
500 sstate->DOT = PyUnicode_FromStringAndSize(".", 1); 506 sstate->DOT = PyUnicode_FromStringAndSize(".", 1);
501 if (sstate->DOT == NULL) { 507 if (sstate->DOT == NULL) {
502 return -1; 508 return -1;
503 } 509 }