mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
gh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Add PyImport_ImportModuleAttr() and PyImport_ImportModuleAttrString() functions. * Add unit tests. * Replace _PyImport_GetModuleAttr() with PyImport_ImportModuleAttr(). * Replace _PyImport_GetModuleAttrString() with PyImport_ImportModuleAttrString(). * Remove "pycore_import.h" includes, no longer needed.
This commit is contained in:
parent
f927204f64
commit
3bebe46d34
40 changed files with 194 additions and 56 deletions
|
@ -33,8 +33,6 @@
|
|||
#include "row.h"
|
||||
#include "blob.h"
|
||||
|
||||
#include "pycore_import.h" // _PyImport_GetModuleAttrString()
|
||||
|
||||
#if SQLITE_VERSION_NUMBER < 3015002
|
||||
#error "SQLite 3.15.2 or higher required"
|
||||
#endif
|
||||
|
@ -234,7 +232,7 @@ static int
|
|||
load_functools_lru_cache(PyObject *module)
|
||||
{
|
||||
pysqlite_state *state = pysqlite_get_state(module);
|
||||
state->lru_cache = _PyImport_GetModuleAttrString("functools", "lru_cache");
|
||||
state->lru_cache = PyImport_ImportModuleAttrString("functools", "lru_cache");
|
||||
if (state->lru_cache == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue