Skip to content

[lldb][Windows] Translate file descriptors between CRT instances - #217126

Merged
Nerixyz merged 2 commits into
llvm:mainfrom
Nerixyz:fix/lldb-static-crt
Sep 8, 2026
Merged

Nerixyz merged 2 commits into
llvm:mainfrom
Nerixyz:fix/lldb-static-crt

Conversation

@Nerixyz

@Nerixyz Nerixyz commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The official LLVM and lldb builds use LLVM_ENABLE_RPMALLOC. This changes the default CRT allocator to rpmalloc for performance reasons. In doing so, it also changes the CRT linkage from dynamic (/MD) to static (/MT).
Since the CRT is the one managing file descriptors on Windows, its universe is now scoped to a module. For lldb, this means we have three fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do it between modules.

Fortunately, the C runtime provides us with helpers to translate between the process scoped HANDLEs and file descriptors. This way, we can allocate an fd for a handle passed across modules. For Python, there's the msvcrt library we can use to translate.

Fixes #216679.

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-lldb

Author: Nerixyz (Nerixyz)

Changes

The official LLVM and lldb builds use LLVM_ENABLE_RPMALLOC. This changes the default CRT allocator to rpmalloc for performance reasons. In doing so, it also changes the CRT linkage from dynamic (/MD) to static (/MT).
Since the CRT is the one managing file descriptors on Windows, its universe is now scoped to a module. For lldb, this means we have three fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do it between modules.

Fortunately, the C runtime provides us with helpers to translate between the process scoped HANDLEs and file descriptors. This way, we can allocate an fd for a handle passed across modules. For Python, there's the msvcrt library we can use to translate.

Fixes #216679.


Full diff: https://github.com/llvm/llvm-project/pull/217126.diff

6 Files Affected:

  • (modified) lldb/include/lldb/API/SBFile.h (+4)
  • (modified) lldb/source/API/SBFile.cpp (+6)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (+70-2)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h (+3)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (+4-2)
  • (modified) lldb/tools/lldb-dap/DAP.cpp (+13-2)
diff --git a/lldb/include/lldb/API/SBFile.h b/lldb/include/lldb/API/SBFile.h
index c73a134e34d22..a5b63c05c042d 100644
--- a/lldb/include/lldb/API/SBFile.h
+++ b/lldb/include/lldb/API/SBFile.h
@@ -35,6 +35,10 @@ class LLDB_API SBFile {
   SBFile(int fd, const char *mode, bool transfer_ownership);
   ~SBFile();
 
+#if defined(_WIN32) && !defined(SWIG)
+  static int OpenFdFromHandle(intptr_t handle, int flags);
+#endif
+
   SBFile &operator=(const SBFile &rhs);
 
   SBError Read(uint8_t *buf, size_t num_bytes, size_t *OUTPUT);
diff --git a/lldb/source/API/SBFile.cpp b/lldb/source/API/SBFile.cpp
index a93f25389d2e0..c2f0ff89367b5 100644
--- a/lldb/source/API/SBFile.cpp
+++ b/lldb/source/API/SBFile.cpp
@@ -69,6 +69,12 @@ SBFile::SBFile(int fd, const char *mode, bool transfer_ownership) {
       std::make_shared<NativeFile>(fd, options.get(), transfer_ownership);
 }
 
+#ifdef _WIN32
+int SBFile::OpenFdFromHandle(intptr_t handle, int flags) {
+  return _open_osfhandle(handle, flags);
+}
+#endif
+
 SBError SBFile::Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read) {
   LLDB_INSTRUMENT_VA(this, buf, num_bytes, bytes_read);
 
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ad665a5c08eb5..0a5b85f7a7ea0 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -21,6 +21,10 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Errno.h"
 
+#ifdef _WIN32
+#include "lldb/Host/windows/windows.h"
+#endif
+
 #include <cstdio>
 #include <variant>
 
@@ -1000,6 +1004,63 @@ bool PythonFile::Check(PyObject *py_obj) {
   return !!r;
 }
 
+#if defined(_WIN32) && !defined(_DLL)
+// When LLVM is built with a different CRT allocator, it's built against the
+// static C runtime. The official Python builds link to the dynamic C runtime.
+// Since the file descriptors are managed per CRT instance, liblldb and Python
+// have different fd mappings. This translates between the two using the msvcrt
+// module.
+int PythonFile::TranslateFdToPython(int our_fd) {
+  intptr_t handle = _get_osfhandle(our_fd);
+  if (handle == 0 || (HANDLE)handle == INVALID_HANDLE_VALUE)
+    return -1;
+
+  PyObject *msvcrt = PyImport_ImportModule("msvcrt");
+  if (!msvcrt)
+    return -1;
+  PyObject *open_osf = PyObject_GetAttrString(msvcrt, "open_osfhandle");
+  Py_XDECREF(msvcrt);
+  if (!open_osf)
+    return -1;
+  PyObject *fd_obj =
+      PyObject_CallFunction(open_osf, "Li", (long long)handle, 0);
+  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);
+  return (int)theirs;
+}
+
+int PythonFile::TranslateFdFromPython(int their_fd) {
+  PyObject *msvcrt = PyImport_ImportModule("msvcrt");
+  if (!msvcrt)
+    return -1;
+  PyObject *get_handle = PyObject_GetAttrString(msvcrt, "get_osfhandle");
+  Py_XDECREF(msvcrt);
+  if (!get_handle)
+    return -1;
+  PyObject *handle_obj = PyObject_CallFunction(get_handle, "i", 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);
+  return _open_osfhandle((intptr_t)handle, 0);
+}
+#else
+int PythonFile::TranslateFdToPython(int our_fd) { return our_fd; }
+int PythonFile::TranslateFdFromPython(int their_fd) { return their_fd; }
+#endif
+
 const char *PythonException::toCString() const {
   if (!m_repr_bytes)
     return "unknown exception";
@@ -1365,6 +1426,10 @@ llvm::Expected<FileSP> PythonFile::ConvertToFile(bool borrowed) {
     PyErr_Clear();
     return ConvertToFileForcingUseOfScriptingIOMethods(borrowed);
   }
+  fd = TranslateFdFromPython(fd);
+  if (fd < 0)
+    return llvm::createStringError("failed to translate Python fd to our fd");
+
   auto options = GetOptionsForPyObject(*this);
   if (!options)
     return options.takeError();
@@ -1410,6 +1475,9 @@ PythonFile::ConvertToFileForcingUseOfScriptingIOMethods(bool borrowed) {
     PyErr_Clear();
     fd = File::kInvalidDescriptor;
   }
+  fd = TranslateFdFromPython(fd);
+  if (fd < 0)
+    return llvm::createStringError("failed to translate Python fd to our fd");
 
   auto io_module = PythonModule::Import("io");
   if (!io_module)
@@ -1474,8 +1542,8 @@ Expected<PythonFile> PythonFile::FromFile(File &file, const char *mode) {
   }
 
   PyObject *file_obj;
-  file_obj = PyFile_FromFd(file.GetDescriptor(), nullptr, mode, -1, nullptr,
-                           "ignore", nullptr, /*closefd=*/0);
+  file_obj = PyFile_FromFd(TranslateFdToPython(file.GetDescriptor()), nullptr,
+                           mode, -1, nullptr, "ignore", nullptr, /*closefd=*/0);
 
   if (!file_obj)
     return exception();
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index 7b29d002fa503..f5d9a9034cdb4 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -644,6 +644,9 @@ class PythonFile : public TypedPythonObject<PythonFile> {
 
   static bool Check(PyObject *py_obj);
 
+  static int TranslateFdToPython(int our_fd);
+  static int TranslateFdFromPython(int their_fd);
+
   static llvm::Expected<PythonFile> FromFile(File &file,
                                              const char *mode = nullptr);
 
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 872ab8758e822..0e11405c51b37 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1087,8 +1087,10 @@ bool ScriptInterpreterPythonImpl::RedirectTerminalHandleThroughLock(
   // terminal) promptly: the pipe descriptor is not a tty, so the default
   // buffering would hold output back until the buffer filled.
   PyObject *pipe_file = PyFile_FromFd(
-      redirect->GetWriteDescriptor(), nullptr, mode, /*buffering=*/1,
-      /*encoding=*/nullptr, /*errors=*/"ignore", /*newline=*/nullptr,
+      PythonFile::TranslateFdToPython(redirect->GetWriteDescriptor()), nullptr,
+      mode, /*buffering=*/1,
+      /*encoding=*/nullptr, /*errors=*/"ignore",
+      /*newline=*/nullptr,
       /*closefd=*/0);
   if (!pipe_file) {
     // Fall back to the raw descriptor. That reopens the statusline race, so
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index bb7921317c6d3..48bc36190a7a3 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -1320,11 +1320,22 @@ llvm::Error DAP::InitializeDebugger() {
   llvm::Expected<int> out_fd = out.GetWriteFileDescriptor();
   if (!out_fd)
     return out_fd.takeError();
-  debugger.SetOutputFile(lldb::SBFile(*out_fd, "w", false));
-
   llvm::Expected<int> err_fd = err.GetWriteFileDescriptor();
   if (!err_fd)
     return err_fd.takeError();
+
+#if defined(_WIN32) && !defined(_DLL)
+  // When LLVM is built with a different CRT allocator, it's built against the
+  // static C runtime. Since the C runtime is the one managing the file
+  // descriptors, its state is now local to each module. Here, lldb-dap and
+  // liblldb have two different CRT states and thus different sets of file
+  // descriptors. This translates an lldb-dap fd into a liblldb fd by creating a
+  // mapping of fd -> HANDLE inside liblldb.
+  *out_fd = lldb::SBFile::OpenFdFromHandle(_get_osfhandle(*out_fd), 0);
+  *err_fd = lldb::SBFile::OpenFdFromHandle(_get_osfhandle(*err_fd), 0);
+#endif
+
+  debugger.SetOutputFile(lldb::SBFile(*out_fd, "w", false));
   debugger.SetErrorFile(lldb::SBFile(*err_fd, "w", false));
 
   // The sourceInitFile option is not part of the DAP specification. It is an

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 34203 tests passed
  • 511 tests skipped

✅ The build succeeded and all tests passed.

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 33482 tests passed
  • 904 tests skipped

✅ The build succeeded and all tests passed.

@charles-zablit charles-zablit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Nerixyz
Nerixyz merged commit 1ca6698 into llvm:main Sep 8, 2026
12 checks passed
@Nerixyz

Nerixyz commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

I think it's worth cherry-picking this, because no Python command works with lldb-dap on the official builds right now.

@Nerixyz Nerixyz added this to the LLVM 23.x Release milestone Sep 8, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in LLVM Release Status Sep 8, 2026
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in LLVM Release Status Sep 8, 2026
@Nerixyz

Nerixyz commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick 1ca6698

@llvmbot

llvmbot commented Sep 8, 2026

Copy link
Copy Markdown
Member

/pull-request #222082

vadimkotov pushed a commit to vadimkotov/llvm-project that referenced this pull request Sep 8, 2026
…m#217126)

The official LLVM and lldb builds use `LLVM_ENABLE_RPMALLOC`. This
changes the default CRT allocator to rpmalloc for performance reasons.
In doing so, it also changes the CRT linkage from dynamic (`/MD`) to
static (`/MT`).
Since the CRT is the one managing file descriptors on Windows, its
universe is now scoped to a module. For lldb, this means we have three
fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do
it between modules.

Fortunately, the C runtime provides us with helpers to translate between
the process scoped HANDLEs and file descriptors. This way, we can
allocate an fd for a handle passed across modules. For Python, there's
the [`msvcrt`](https://docs.python.org/3/library/msvcrt.html) library we
can use to translate.

Fixes llvm#216679.
@@ -35,6 +35,10 @@ class LLDB_API SBFile {
SBFile(int fd, const char *mode, bool transfer_ownership);
~SBFile();

#if defined(_WIN32) && !defined(SWIG)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there prior art in terms of excluding an API on certain platforms? There certainly is for SWIG, but for something like _WIN32 my first instinct would be to ifdef out the implementation and have it be a NOOP where it's not supported. I think bifurcating the API depending on the platform is more trouble than it's worth.

if (!open_osf)
return -1;
PyObject *fd_obj =
PyObject_CallFunction(open_osf, "Li", (long long)handle, 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyObject_CallFunction doesn't appear to be part of the stable ABI in Python 3.8.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 384 mentions that all functions listed in PC/python3.def are part of the limited and thus stable ABI - PyObject_CallFunction is there: https://github.com/python/cpython/blob/39b2f82717a69dde7212bc39b673b0f55c99e6a3/PC/python3.def#L453

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming, I must have been looking in the wrong place because I didn't see it in the Python docs.

Py_XDECREF(get_handle);
if (!handle_obj)
return -1;
if (!PyLong_Check(handle_obj)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be part of the stable API either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why I thought this was part of it, I'll change that to check for an exception instead.

Py_XDECREF(handle_obj);
return -1;
}
size_t handle = PyLong_AsSize_t(handle_obj);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither is this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nerixyz added a commit that referenced this pull request Sep 11, 2026
…222665)

Addresses the post-commit review comments from the original PR
(#217126 (review)).

- `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`.
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Sep 11, 2026
…visibility (#222665)

Addresses the post-commit review comments from the original PR
(llvm/llvm-project#217126 (review)).

- `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`.
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 11, 2026
…visibility (#222665)

Addresses the post-commit review comments from the original PR
(llvm/llvm-project#217126 (review)).

- `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`.
vadimkotov pushed a commit to vadimkotov/llvm-project that referenced this pull request Sep 11, 2026
…lvm#222665)

Addresses the post-commit review comments from the original PR
(llvm#217126 (review)).

- `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`.
aobolensk pushed a commit to aobolensk/llvm-project that referenced this pull request Sep 15, 2026
…m#217126)

The official LLVM and lldb builds use `LLVM_ENABLE_RPMALLOC`. This
changes the default CRT allocator to rpmalloc for performance reasons.
In doing so, it also changes the CRT linkage from dynamic (`/MD`) to
static (`/MT`).
Since the CRT is the one managing file descriptors on Windows, its
universe is now scoped to a module. For lldb, this means we have three
fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do
it between modules.

Fortunately, the C runtime provides us with helpers to translate between
the process scoped HANDLEs and file descriptors. This way, we can
allocate an fd for a handle passed across modules. For Python, there's
the [`msvcrt`](https://docs.python.org/3/library/msvcrt.html) library we
can use to translate.

Fixes llvm#216679.
aobolensk pushed a commit to aobolensk/llvm-project that referenced this pull request Sep 15, 2026
…lvm#222665)

Addresses the post-commit review comments from the original PR
(llvm#217126 (review)).

- `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`.
anilkund pushed a commit to anilkund/llvm-project that referenced this pull request Sep 16, 2026
…lvm#222665)

Addresses the post-commit review comments from the original PR
(llvm#217126 (review)).

- `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`.
dyung pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 19, 2026
…m#217126)

The official LLVM and lldb builds use `LLVM_ENABLE_RPMALLOC`. This
changes the default CRT allocator to rpmalloc for performance reasons.
In doing so, it also changes the CRT linkage from dynamic (`/MD`) to
static (`/MT`).
Since the CRT is the one managing file descriptors on Windows, its
universe is now scoped to a module. For lldb, this means we have three
fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do
it between modules.

Fortunately, the C runtime provides us with helpers to translate between
the process scoped HANDLEs and file descriptors. This way, we can
allocate an fd for a handle passed across modules. For Python, there's
the [`msvcrt`](https://docs.python.org/3/library/msvcrt.html) library we
can use to translate.

Fixes llvm#216679.

(cherry picked from commit 1ca6698)
dyung pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 19, 2026
…lvm#222665)

Addresses the post-commit review comments from the original PR
(llvm#217126 (review)).

- `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 ba1687b)
da-viper pushed a commit to da-viper/llvm-project that referenced this pull request Sep 22, 2026
…m#217126)

The official LLVM and lldb builds use `LLVM_ENABLE_RPMALLOC`. This
changes the default CRT allocator to rpmalloc for performance reasons.
In doing so, it also changes the CRT linkage from dynamic (`/MD`) to
static (`/MT`).
Since the CRT is the one managing file descriptors on Windows, its
universe is now scoped to a module. For lldb, this means we have three
fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do
it between modules.

Fortunately, the C runtime provides us with helpers to translate between
the process scoped HANDLEs and file descriptors. This way, we can
allocate an fd for a handle passed across modules. For Python, there's
the [`msvcrt`](https://docs.python.org/3/library/msvcrt.html) library we
can use to translate.

Fixes llvm#216679.

(cherry picked from commit 1ca6698)
tru pushed a commit that referenced this pull request Sep 25, 2026
…7126)

The official LLVM and lldb builds use `LLVM_ENABLE_RPMALLOC`. This
changes the default CRT allocator to rpmalloc for performance reasons.
In doing so, it also changes the CRT linkage from dynamic (`/MD`) to
static (`/MT`).
Since the CRT is the one managing file descriptors on Windows, its
universe is now scoped to a module. For lldb, this means we have three
fd-spaces: the driver (lldb/lldb-dap), liblldb, and Python.
We usually pass files around as file descriptors. This breaks when we do
it between modules.

Fortunately, the C runtime provides us with helpers to translate between
the process scoped HANDLEs and file descriptors. This way, we can
allocate an fd for a handle passed across modules. For Python, there's
the [`msvcrt`](https://docs.python.org/3/library/msvcrt.html) library we
can use to translate.

Fixes #216679.

(cherry picked from commit 1ca6698)
tru pushed a commit that referenced this pull request Sep 25, 2026
…222665)

Addresses the post-commit review comments from the original PR
(#217126 (review)).

- `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 ba1687b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

[lldb-dap] script command does not print output

4 participants