[lldb][Windows] Remove use of unstable ABI and fix SB API visibility (#222665)
Addresses the post-commit review comments from the original PR (https://github.com/llvm/llvm-project/pull/217126#pullrequestreview-5162589053). - `SBFile::OpenFdFromHandle` is now visible on all platforms (just `#ifndef SWIG`) and returns -1 by default. - Removed non-stable `PyLong_Check` in favor of `PyErr_Occurred` and `PyErr_Clear`. (cherry picked from commit ba1687b72476eb368641b9a9f565a38cf41b7393)
This commit is contained in:
1 parent
28a01b03e1
commit
5f2881edaf
3 files changed
+24
-11
No files matched your search
@@ -933,12 +933,13 @@ int PythonFile::TranslateFdToPython(int our_fd) {
|
||||
Py_XDECREF(open_osf);
|
||||
if (!fd_obj)
|
||||
return -1;
|
||||
if (!PyLong_Check(fd_obj)) {
|
||||
Py_XDECREF(fd_obj);
|
||||
return -1;
|
||||
}
|
||||
|
||||
long theirs = PyLong_AsLong(fd_obj);
|
||||
Py_XDECREF(fd_obj);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
return -1;
|
||||
}
|
||||
return (int)theirs;
|
||||
}
|
||||
|
||||
@@ -954,12 +955,14 @@ int PythonFile::TranslateFdFromPython(int their_fd) {
|
||||
Py_XDECREF(get_handle);
|
||||
if (!handle_obj)
|
||||
return -1;
|
||||
if (!PyLong_Check(handle_obj)) {
|
||||
Py_XDECREF(handle_obj);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t handle = PyLong_AsSize_t(handle_obj);
|
||||
Py_XDECREF(handle_obj);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _open_osfhandle((intptr_t)handle, 0);
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user