FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Explain for getting _PyObject_NextNotImplemented · sdpython/pythonnet@f000e08 · GitHub

This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Repository navigation

Commit f000e08

Browse files
committed
Explain for getting _PyObject_NextNotImplemented
1 parent d1928dc commit f000e08

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/runtime/runtime.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ internal static void Initialize(bool initSigs = false)
304304

305305
IntPtr dllLocal = IntPtr.Zero;
306306

307+
// Since `_PyObject_NextNotImplemented` would set to a heap class
308+
// for tp_iternext which doesn't implement __next__.
309+
// Thus we need a heap class to get it, the ZipImportError is a
310+
// heap class and it's in builtins, so we can use it as a trick.
307311
var zipimport = PyImport_ImportModule("zipimport");
308312
var ZipImportError = PyObject_GetAttrString(zipimport, "ZipImportError");
309313
_PyObject_NextNotImplemented = Marshal.ReadIntPtr(ZipImportError, TypeOffset.tp_iternext);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL