mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
This commit is contained in:
parent
2e1c4e5db2
commit
e134a7fe36
12 changed files with 89 additions and 57 deletions
|
@ -71,22 +71,20 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
|
|||
|
||||
if (fp != NULL) {
|
||||
int i;
|
||||
struct _Py_stat_struct statb;
|
||||
if (_Py_fstat(fileno(fp), &statb) == -1) {
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
struct _Py_stat_struct status;
|
||||
if (_Py_fstat(fileno(fp), &status) == -1)
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < nhandles; i++) {
|
||||
if (statb.st_dev == handles[i].dev &&
|
||||
statb.st_ino == handles[i].ino) {
|
||||
if (status.st_dev == handles[i].dev &&
|
||||
status.st_ino == handles[i].ino) {
|
||||
p = (dl_funcptr) dlsym(handles[i].handle,
|
||||
funcname);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
if (nhandles < 128) {
|
||||
handles[nhandles].dev = statb.st_dev;
|
||||
handles[nhandles].ino = statb.st_ino;
|
||||
handles[nhandles].dev = status.st_dev;
|
||||
handles[nhandles].ino = status.st_ino;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue