Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-09 10:20:46

0001 #pragma once
0002 
0003 // Copyright (c) 2024 The pybind Community.
0004 
0005 // STRONG REQUIREMENT:
0006 //   This header is a wrapper around `#include <Python.h>`, therefore it
0007 //   MUST BE INCLUDED BEFORE ANY STANDARD HEADERS are included.
0008 // See also:
0009 //   https://docs.python.org/3/c-api/intro.html#include-files
0010 // Quoting from there:
0011 //   Note: Since Python may define some pre-processor definitions which affect
0012 //   the standard headers on some systems, you must include Python.h before
0013 //   any standard headers are included.
0014 
0015 // To maximize reusability:
0016 // DO NOT ADD CODE THAT REQUIRES C++ EXCEPTION HANDLING.
0017 
0018 // Disable linking to pythonX_d.lib on Windows in debug mode.
0019 #if defined(_MSC_VER) && defined(_DEBUG) && !defined(Py_DEBUG)
0020 // Workaround for a VS 2022 issue.
0021 // See https://github.com/pybind/pybind11/pull/3497 for full context.
0022 // NOTE: This workaround knowingly violates the Python.h include order
0023 //       requirement (see above).
0024 #    include <yvals.h>
0025 #    if _MSVC_STL_VERSION >= 143
0026 #        include <crtdefs.h>
0027 #    endif
0028 #    define PYBIND11_DEBUG_MARKER
0029 #    undef _DEBUG
0030 #endif
0031 
0032 // Don't let Python.h #define (v)snprintf as macro because they are implemented
0033 // properly in Visual Studio since 2015.
0034 #if defined(_MSC_VER)
0035 #    define HAVE_SNPRINTF 1
0036 #endif
0037 
0038 #if defined(_MSC_VER)
0039 #    pragma warning(push)
0040 #    pragma warning(disable : 4505)
0041 // C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed
0042 #endif
0043 
0044 #include <Python.h>
0045 #include <frameobject.h>
0046 #include <pythread.h>
0047 
0048 #if defined(_MSC_VER)
0049 #    pragma warning(pop)
0050 #endif
0051 
0052 #if defined(PYBIND11_DEBUG_MARKER)
0053 #    define _DEBUG 1
0054 #    undef PYBIND11_DEBUG_MARKER
0055 #endif
0056 
0057 // Python #defines overrides on all sorts of core functions, which
0058 // tends to wreak havok in C++ codebases that expect these to work
0059 // like regular functions (potentially with several overloads).
0060 #if defined(isalnum)
0061 #    undef isalnum
0062 #    undef isalpha
0063 #    undef islower
0064 #    undef isspace
0065 #    undef isupper
0066 #    undef tolower
0067 #    undef toupper
0068 #endif
0069 
0070 #if defined(copysign)
0071 #    undef copysign
0072 #endif