mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28: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
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "Python.h"
|
||||
#include "pycore_fileutils.h" // _Py_set_inheritable()
|
||||
#include "pycore_import.h" // _PyImport_GetModuleAttrString()
|
||||
#include "pycore_time.h" // _PyTime_FromSecondsObject()
|
||||
|
||||
#include <stdbool.h>
|
||||
|
@ -1996,7 +1995,7 @@ kqueue_tracking_init(PyObject *module) {
|
|||
// Register a callback to invalidate kqueues with open fds after fork.
|
||||
PyObject *register_at_fork = NULL, *cb = NULL, *args = NULL,
|
||||
*kwargs = NULL, *result = NULL;
|
||||
register_at_fork = _PyImport_GetModuleAttrString("posix",
|
||||
register_at_fork = PyImport_ImportModuleAttrString("posix",
|
||||
"register_at_fork");
|
||||
if (register_at_fork == NULL) {
|
||||
goto finally;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue