Cython 3.3.0a1__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Cython/Build/BuildExecutable.py +156 -0
- Cython/Build/Cache.py +199 -0
- Cython/Build/Cythonize.py +349 -0
- Cython/Build/Dependencies.py +1276 -0
- Cython/Build/Distutils.py +1 -0
- Cython/Build/Inline.py +467 -0
- Cython/Build/IpythonMagic.py +559 -0
- Cython/Build/SharedModule.py +84 -0
- Cython/Build/Tests/TestCyCache.py +195 -0
- Cython/Build/Tests/TestCythonizeArgsParser.py +480 -0
- Cython/Build/Tests/TestDependencies.py +133 -0
- Cython/Build/Tests/TestInline.py +177 -0
- Cython/Build/Tests/TestIpythonMagic.py +303 -0
- Cython/Build/Tests/TestRecythonize.py +212 -0
- Cython/Build/Tests/TestStripLiterals.py +155 -0
- Cython/Build/Tests/__init__.py +1 -0
- Cython/Build/__init__.py +11 -0
- Cython/CodeWriter.py +815 -0
- Cython/Compiler/AnalysedTreeTransforms.py +97 -0
- Cython/Compiler/Annotate.py +328 -0
- Cython/Compiler/AutoDocTransforms.py +320 -0
- Cython/Compiler/Buffer.py +680 -0
- Cython/Compiler/Builtin.py +997 -0
- Cython/Compiler/CmdLine.py +263 -0
- Cython/Compiler/Code.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/Code.pxd +152 -0
- Cython/Compiler/Code.py +3907 -0
- Cython/Compiler/CodeGeneration.py +33 -0
- Cython/Compiler/CythonScope.py +194 -0
- Cython/Compiler/Dataclass.py +890 -0
- Cython/Compiler/DebugFlags.py +24 -0
- Cython/Compiler/Errors.py +310 -0
- Cython/Compiler/ExprNodes.py +15983 -0
- Cython/Compiler/FlowControl.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/FlowControl.pxd +99 -0
- Cython/Compiler/FlowControl.py +1571 -0
- Cython/Compiler/FusedNode.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/FusedNode.py +976 -0
- Cython/Compiler/Future.py +16 -0
- Cython/Compiler/Interpreter.py +57 -0
- Cython/Compiler/Lexicon.py +422 -0
- Cython/Compiler/LineTable.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/LineTable.py +114 -0
- Cython/Compiler/Main.py +856 -0
- Cython/Compiler/MatchCaseNodes.py +2197 -0
- Cython/Compiler/MemoryView.py +930 -0
- Cython/Compiler/ModuleNode.py +4517 -0
- Cython/Compiler/Naming.py +367 -0
- Cython/Compiler/Nodes.py +10941 -0
- Cython/Compiler/Optimize.py +5455 -0
- Cython/Compiler/Options.py +838 -0
- Cython/Compiler/ParseTreeTransforms.pxd +79 -0
- Cython/Compiler/ParseTreeTransforms.py +4744 -0
- Cython/Compiler/Parsing.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/Parsing.pxd +9 -0
- Cython/Compiler/Parsing.py +4792 -0
- Cython/Compiler/Pipeline.py +439 -0
- Cython/Compiler/PyrexTypes.py +6111 -0
- Cython/Compiler/Pythran.py +232 -0
- Cython/Compiler/Scanning.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/Scanning.pxd +70 -0
- Cython/Compiler/Scanning.py +720 -0
- Cython/Compiler/StringEncoding.py +297 -0
- Cython/Compiler/Symtab.py +3092 -0
- Cython/Compiler/Tests/TestBuffer.py +105 -0
- Cython/Compiler/Tests/TestBuiltin.py +117 -0
- Cython/Compiler/Tests/TestCmdLine.py +587 -0
- Cython/Compiler/Tests/TestCode.py +145 -0
- Cython/Compiler/Tests/TestFlowControl.py +65 -0
- Cython/Compiler/Tests/TestGrammar.py +202 -0
- Cython/Compiler/Tests/TestMemView.py +71 -0
- Cython/Compiler/Tests/TestParseTreeTransforms.py +285 -0
- Cython/Compiler/Tests/TestScanning.py +132 -0
- Cython/Compiler/Tests/TestSignatureMatching.py +73 -0
- Cython/Compiler/Tests/TestStringEncoding.py +20 -0
- Cython/Compiler/Tests/TestTreeFragment.py +63 -0
- Cython/Compiler/Tests/TestTreePath.py +103 -0
- Cython/Compiler/Tests/TestTypes.py +118 -0
- Cython/Compiler/Tests/TestUtilityLoad.py +112 -0
- Cython/Compiler/Tests/TestVisitor.py +61 -0
- Cython/Compiler/Tests/Utils.py +36 -0
- Cython/Compiler/Tests/__init__.py +1 -0
- Cython/Compiler/TreeFragment.py +278 -0
- Cython/Compiler/TreePath.py +303 -0
- Cython/Compiler/TypeInference.py +611 -0
- Cython/Compiler/TypeSlots.py +1329 -0
- Cython/Compiler/UFuncs.py +311 -0
- Cython/Compiler/UtilNodes.py +413 -0
- Cython/Compiler/UtilityCode.py +348 -0
- Cython/Compiler/Version.py +8 -0
- Cython/Compiler/Visitor.cp315-win_amd64.pyd +0 -0
- Cython/Compiler/Visitor.pxd +53 -0
- Cython/Compiler/Visitor.py +864 -0
- Cython/Compiler/__init__.py +1 -0
- Cython/Coverage.py +448 -0
- Cython/Debugger/Cygdb.py +177 -0
- Cython/Debugger/DebugWriter.py +82 -0
- Cython/Debugger/Tests/TestLibCython.py +280 -0
- Cython/Debugger/Tests/__init__.py +1 -0
- Cython/Debugger/Tests/cfuncs.c +8 -0
- Cython/Debugger/Tests/codefile +49 -0
- Cython/Debugger/Tests/test_libcython_in_gdb.py +580 -0
- Cython/Debugger/Tests/test_libpython_in_gdb.py +90 -0
- Cython/Debugger/__init__.py +1 -0
- Cython/Debugger/libcython.py +1548 -0
- Cython/Debugger/libpython.py +2821 -0
- Cython/Debugging.py +20 -0
- Cython/Distutils/__init__.py +2 -0
- Cython/Distutils/build_ext.py +139 -0
- Cython/Distutils/extension.py +96 -0
- Cython/Distutils/old_build_ext.py +351 -0
- Cython/Includes/cpython/__init__.pxd +173 -0
- Cython/Includes/cpython/array.pxd +152 -0
- Cython/Includes/cpython/bool.pxd +37 -0
- Cython/Includes/cpython/buffer.pxd +112 -0
- Cython/Includes/cpython/bytearray.pxd +33 -0
- Cython/Includes/cpython/bytes.pxd +200 -0
- Cython/Includes/cpython/cellobject.pxd +35 -0
- Cython/Includes/cpython/ceval.pxd +8 -0
- Cython/Includes/cpython/codecs.pxd +121 -0
- Cython/Includes/cpython/complex.pxd +60 -0
- Cython/Includes/cpython/contextvars.pxd +145 -0
- Cython/Includes/cpython/conversion.pxd +36 -0
- Cython/Includes/cpython/datetime.pxd +395 -0
- Cython/Includes/cpython/descr.pxd +26 -0
- Cython/Includes/cpython/dict.pxd +268 -0
- Cython/Includes/cpython/exc.pxd +263 -0
- Cython/Includes/cpython/fileobject.pxd +57 -0
- Cython/Includes/cpython/float.pxd +56 -0
- Cython/Includes/cpython/frozendict.pxd +37 -0
- Cython/Includes/cpython/function.pxd +65 -0
- Cython/Includes/cpython/genobject.pxd +25 -0
- Cython/Includes/cpython/getargs.pxd +12 -0
- Cython/Includes/cpython/instance.pxd +25 -0
- Cython/Includes/cpython/iterator.pxd +36 -0
- Cython/Includes/cpython/iterobject.pxd +24 -0
- Cython/Includes/cpython/list.pxd +144 -0
- Cython/Includes/cpython/long.pxd +180 -0
- Cython/Includes/cpython/longintrepr.pxd +14 -0
- Cython/Includes/cpython/mapping.pxd +63 -0
- Cython/Includes/cpython/marshal.pxd +66 -0
- Cython/Includes/cpython/mem.pxd +120 -0
- Cython/Includes/cpython/memoryview.pxd +50 -0
- Cython/Includes/cpython/method.pxd +49 -0
- Cython/Includes/cpython/module.pxd +208 -0
- Cython/Includes/cpython/number.pxd +258 -0
- Cython/Includes/cpython/object.pxd +430 -0
- Cython/Includes/cpython/pycapsule.pxd +143 -0
- Cython/Includes/cpython/pylifecycle.pxd +68 -0
- Cython/Includes/cpython/pyport.pxd +8 -0
- Cython/Includes/cpython/pystate.pxd +95 -0
- Cython/Includes/cpython/pythread.pxd +53 -0
- Cython/Includes/cpython/ref.pxd +141 -0
- Cython/Includes/cpython/sentinel.pxd +17 -0
- Cython/Includes/cpython/sequence.pxd +134 -0
- Cython/Includes/cpython/set.pxd +119 -0
- Cython/Includes/cpython/slice.pxd +70 -0
- Cython/Includes/cpython/time.pxd +129 -0
- Cython/Includes/cpython/tuple.pxd +72 -0
- Cython/Includes/cpython/type.pxd +146 -0
- Cython/Includes/cpython/unicode.pxd +639 -0
- Cython/Includes/cpython/version.pxd +32 -0
- Cython/Includes/cpython/weakref.pxd +78 -0
- Cython/Includes/libc/__init__.pxd +1 -0
- Cython/Includes/libc/complex.pxd +35 -0
- Cython/Includes/libc/errno.pxd +127 -0
- Cython/Includes/libc/float.pxd +43 -0
- Cython/Includes/libc/limits.pxd +28 -0
- Cython/Includes/libc/locale.pxd +46 -0
- Cython/Includes/libc/math.pxd +209 -0
- Cython/Includes/libc/setjmp.pxd +10 -0
- Cython/Includes/libc/signal.pxd +64 -0
- Cython/Includes/libc/stddef.pxd +9 -0
- Cython/Includes/libc/stdint.pxd +105 -0
- Cython/Includes/libc/stdio.pxd +80 -0
- Cython/Includes/libc/stdlib.pxd +72 -0
- Cython/Includes/libc/string.pxd +50 -0
- Cython/Includes/libc/threads.pxd +234 -0
- Cython/Includes/libc/time.pxd +52 -0
- Cython/Includes/libcpp/__init__.pxd +4 -0
- Cython/Includes/libcpp/algorithm.pxd +320 -0
- Cython/Includes/libcpp/any.pxd +16 -0
- Cython/Includes/libcpp/atomic.pxd +59 -0
- Cython/Includes/libcpp/barrier.pxd +22 -0
- Cython/Includes/libcpp/bit.pxd +29 -0
- Cython/Includes/libcpp/cast.pxd +12 -0
- Cython/Includes/libcpp/cmath.pxd +518 -0
- Cython/Includes/libcpp/complex.pxd +106 -0
- Cython/Includes/libcpp/condition_variable.pxd +322 -0
- Cython/Includes/libcpp/deque.pxd +165 -0
- Cython/Includes/libcpp/exception.pxd +216 -0
- Cython/Includes/libcpp/execution.pxd +15 -0
- Cython/Includes/libcpp/forward_list.pxd +63 -0
- Cython/Includes/libcpp/functional.pxd +26 -0
- Cython/Includes/libcpp/future.pxd +103 -0
- Cython/Includes/libcpp/iterator.pxd +34 -0
- Cython/Includes/libcpp/latch.pxd +17 -0
- Cython/Includes/libcpp/limits.pxd +61 -0
- Cython/Includes/libcpp/list.pxd +117 -0
- Cython/Includes/libcpp/map.pxd +252 -0
- Cython/Includes/libcpp/memory.pxd +115 -0
- Cython/Includes/libcpp/mutex.pxd +387 -0
- Cython/Includes/libcpp/numbers.pxd +15 -0
- Cython/Includes/libcpp/numeric.pxd +131 -0
- Cython/Includes/libcpp/optional.pxd +34 -0
- Cython/Includes/libcpp/pair.pxd +1 -0
- Cython/Includes/libcpp/queue.pxd +25 -0
- Cython/Includes/libcpp/random.pxd +166 -0
- Cython/Includes/libcpp/semaphore.pxd +43 -0
- Cython/Includes/libcpp/set.pxd +228 -0
- Cython/Includes/libcpp/shared_mutex.pxd +96 -0
- Cython/Includes/libcpp/span.pxd +87 -0
- Cython/Includes/libcpp/stack.pxd +11 -0
- Cython/Includes/libcpp/stop_token.pxd +117 -0
- Cython/Includes/libcpp/string.pxd +355 -0
- Cython/Includes/libcpp/string_view.pxd +183 -0
- Cython/Includes/libcpp/typeindex.pxd +15 -0
- Cython/Includes/libcpp/typeinfo.pxd +10 -0
- Cython/Includes/libcpp/unordered_map.pxd +193 -0
- Cython/Includes/libcpp/unordered_set.pxd +152 -0
- Cython/Includes/libcpp/utility.pxd +30 -0
- Cython/Includes/libcpp/vector.pxd +186 -0
- Cython/Includes/numpy/math.pxd +150 -0
- Cython/Includes/openmp.pxd +50 -0
- Cython/Includes/posix/__init__.pxd +1 -0
- Cython/Includes/posix/dlfcn.pxd +14 -0
- Cython/Includes/posix/fcntl.pxd +86 -0
- Cython/Includes/posix/ioctl.pxd +4 -0
- Cython/Includes/posix/mman.pxd +101 -0
- Cython/Includes/posix/resource.pxd +57 -0
- Cython/Includes/posix/select.pxd +21 -0
- Cython/Includes/posix/signal.pxd +73 -0
- Cython/Includes/posix/stat.pxd +98 -0
- Cython/Includes/posix/stdio.pxd +37 -0
- Cython/Includes/posix/stdlib.pxd +29 -0
- Cython/Includes/posix/strings.pxd +9 -0
- Cython/Includes/posix/time.pxd +71 -0
- Cython/Includes/posix/types.pxd +30 -0
- Cython/Includes/posix/uio.pxd +26 -0
- Cython/Includes/posix/unistd.pxd +271 -0
- Cython/Includes/posix/wait.pxd +38 -0
- Cython/LZSS.py +170 -0
- Cython/Plex/Actions.cp315-win_amd64.pyd +0 -0
- Cython/Plex/Actions.pxd +24 -0
- Cython/Plex/Actions.py +119 -0
- Cython/Plex/DFA.cp315-win_amd64.pyd +0 -0
- Cython/Plex/DFA.pxd +14 -0
- Cython/Plex/DFA.py +164 -0
- Cython/Plex/Errors.py +48 -0
- Cython/Plex/Lexicons.py +178 -0
- Cython/Plex/Machines.cp315-win_amd64.pyd +0 -0
- Cython/Plex/Machines.pxd +36 -0
- Cython/Plex/Machines.py +238 -0
- Cython/Plex/Regexps.py +535 -0
- Cython/Plex/Scanners.cp315-win_amd64.pyd +0 -0
- Cython/Plex/Scanners.pxd +45 -0
- Cython/Plex/Scanners.py +328 -0
- Cython/Plex/Transitions.cp315-win_amd64.pyd +0 -0
- Cython/Plex/Transitions.pxd +14 -0
- Cython/Plex/Transitions.py +239 -0
- Cython/Plex/__init__.py +34 -0
- Cython/Runtime/__init__.py +1 -0
- Cython/Runtime/refnanny.cp315-win_amd64.pyd +0 -0
- Cython/Runtime/refnanny.pyx +237 -0
- Cython/Shadow.py +1167 -0
- Cython/StringIOTree.cp315-win_amd64.pyd +0 -0
- Cython/StringIOTree.py +169 -0
- Cython/Tempita/__init__.py +4 -0
- Cython/Tempita/_looper.py +154 -0
- Cython/Tempita/_tempita.cp315-win_amd64.pyd +0 -0
- Cython/Tempita/_tempita.py +1087 -0
- Cython/TestUtils.py +464 -0
- Cython/Tests/TestCodeWriter.py +128 -0
- Cython/Tests/TestCythonUtils.py +202 -0
- Cython/Tests/TestJediTyper.py +223 -0
- Cython/Tests/TestShadow.py +110 -0
- Cython/Tests/TestStringIOTree.py +68 -0
- Cython/Tests/TestTestUtils.py +89 -0
- Cython/Tests/__init__.py +1 -0
- Cython/Tests/xmlrunner.py +390 -0
- Cython/Utility/AsyncGen.c +1073 -0
- Cython/Utility/Buffer.c +866 -0
- Cython/Utility/BufferFormatFromTypeInfo.pxd +2 -0
- Cython/Utility/Builtins.c +933 -0
- Cython/Utility/CConvert.pyx +149 -0
- Cython/Utility/CMath.c +104 -0
- Cython/Utility/CommonStructures.c +244 -0
- Cython/Utility/Complex.c +378 -0
- Cython/Utility/Coroutine.c +2337 -0
- Cython/Utility/CpdefEnums.pyx +107 -0
- Cython/Utility/CppConvert.pyx +282 -0
- Cython/Utility/CppSupport.cpp +151 -0
- Cython/Utility/CythonFunction.c +2072 -0
- Cython/Utility/Dataclasses.c +101 -0
- Cython/Utility/Embed.c +129 -0
- Cython/Utility/Exceptions.c +1038 -0
- Cython/Utility/ExtensionTypes.c +1158 -0
- Cython/Utility/FunctionArguments.c +1045 -0
- Cython/Utility/FusedFunction.pyx +44 -0
- Cython/Utility/ImportExport.c +930 -0
- Cython/Utility/MatchCase.c +979 -0
- Cython/Utility/MatchCase_Cy.pyx +12 -0
- Cython/Utility/MemoryView.pxd +108 -0
- Cython/Utility/MemoryView.pyx +1499 -0
- Cython/Utility/MemoryView_C.c +1056 -0
- Cython/Utility/ModuleSetupCode.c +3352 -0
- Cython/Utility/NumpyImportArray.c +46 -0
- Cython/Utility/ObjectHandling.c +3372 -0
- Cython/Utility/Optimize.c +2563 -0
- Cython/Utility/Overflow.c +378 -0
- Cython/Utility/Profile.c +736 -0
- Cython/Utility/StringTools.c +1414 -0
- Cython/Utility/Synchronization.c +438 -0
- Cython/Utility/TString.c +369 -0
- Cython/Utility/TestCyUtilityLoader.pyx +8 -0
- Cython/Utility/TestCythonScope.pyx +75 -0
- Cython/Utility/TestUtilityLoader.c +12 -0
- Cython/Utility/TypeConversion.c +1556 -0
- Cython/Utility/UFuncs.pyx +50 -0
- Cython/Utility/UFuncs_C.c +89 -0
- Cython/Utility/__init__.py +28 -0
- Cython/Utility/arrayarray.h +172 -0
- Cython/Utils.cp315-win_amd64.pyd +0 -0
- Cython/Utils.py +677 -0
- Cython/__init__.py +12 -0
- Cython/py.typed +0 -0
- cython-3.3.0a1.dist-info/METADATA +394 -0
- cython-3.3.0a1.dist-info/RECORD +335 -0
- cython-3.3.0a1.dist-info/WHEEL +5 -0
- cython-3.3.0a1.dist-info/entry_points.txt +4 -0
- cython-3.3.0a1.dist-info/top_level.txt +3 -0
- cython.py +29 -0
- pyximport/__init__.py +4 -0
- pyximport/pyxbuild.py +160 -0
- pyximport/pyximport.py +482 -0
|
@@ -0,0 +1,933 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Special implementations of built-in functions and methods.
|
|
3
|
+
*
|
|
4
|
+
* Optional optimisations for builtins are in Optimize.c.
|
|
5
|
+
*
|
|
6
|
+
* General object operations and protocols are in ObjectHandling.c.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//////////////////// Globals.proto ////////////////////
|
|
10
|
+
|
|
11
|
+
static PyObject* __Pyx_Globals(void); /*proto*/
|
|
12
|
+
|
|
13
|
+
//////////////////// Globals ////////////////////
|
|
14
|
+
//@requires: ObjectHandling.c::GetAttr
|
|
15
|
+
|
|
16
|
+
// This is a stub implementation until we have something more complete.
|
|
17
|
+
// Currently, we only handle the most common case of a read-only dict
|
|
18
|
+
// of Python names. Supporting cdef names in the module and write
|
|
19
|
+
// access requires a rewrite as a dedicated class.
|
|
20
|
+
|
|
21
|
+
static PyObject* __Pyx_Globals(void) {
|
|
22
|
+
return __Pyx_NewRef(NAMED_CGLOBAL(moddict_cname));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//////////////////// PyExecGlobals.proto ////////////////////
|
|
26
|
+
|
|
27
|
+
static PyObject* __Pyx_PyExecGlobals(PyObject*);
|
|
28
|
+
|
|
29
|
+
//////////////////// PyExecGlobals ////////////////////
|
|
30
|
+
//@requires: PyExec
|
|
31
|
+
|
|
32
|
+
static PyObject* __Pyx_PyExecGlobals(PyObject* code) {
|
|
33
|
+
return __Pyx_PyExec2(code, NAMED_CGLOBAL(moddict_cname));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//////////////////// PyExec.proto ////////////////////
|
|
37
|
+
|
|
38
|
+
static PyObject* __Pyx_PyExec3(PyObject*, PyObject*, PyObject*);
|
|
39
|
+
static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject*, PyObject*);
|
|
40
|
+
|
|
41
|
+
//////////////////// PyExec ////////////////////
|
|
42
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
43
|
+
|
|
44
|
+
static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject* o, PyObject* globals) {
|
|
45
|
+
return __Pyx_PyExec3(o, globals, NULL);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) {
|
|
49
|
+
PyObject* result;
|
|
50
|
+
#if !CYTHON_COMPILING_IN_LIMITED_API
|
|
51
|
+
PyObject* s = 0;
|
|
52
|
+
char *code = 0;
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
if (!globals || globals == Py_None) {
|
|
56
|
+
globals = NAMED_CGLOBAL(moddict_cname);
|
|
57
|
+
}
|
|
58
|
+
#if !CYTHON_COMPILING_IN_LIMITED_API
|
|
59
|
+
// In Limited API we just use exec builtin which already has this
|
|
60
|
+
else if (unlikely(!PyDict_Check(globals))) {
|
|
61
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
62
|
+
"exec() arg 2 must be a dict, not " __Pyx_FMT_TYPENAME, globals);
|
|
63
|
+
goto bad;
|
|
64
|
+
}
|
|
65
|
+
#endif
|
|
66
|
+
if (!locals || locals == Py_None) {
|
|
67
|
+
locals = globals;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#if !CYTHON_COMPILING_IN_LIMITED_API
|
|
71
|
+
if (__Pyx_PyDict_GetItemStr(globals, PYIDENT("__builtins__")) == NULL) {
|
|
72
|
+
if (unlikely(PyDict_SetItem(globals, PYIDENT("__builtins__"), PyEval_GetBuiltins()) < 0))
|
|
73
|
+
goto bad;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (PyCode_Check(o)) {
|
|
77
|
+
if (unlikely(__Pyx_PyCode_HasFreeVars((PyCodeObject *)o))) {
|
|
78
|
+
PyErr_SetString(PyExc_TypeError,
|
|
79
|
+
"code object passed to exec() may not contain free variables");
|
|
80
|
+
goto bad;
|
|
81
|
+
}
|
|
82
|
+
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400
|
|
83
|
+
result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
|
|
84
|
+
#else
|
|
85
|
+
result = PyEval_EvalCode(o, globals, locals);
|
|
86
|
+
#endif
|
|
87
|
+
} else {
|
|
88
|
+
PyCompilerFlags cf;
|
|
89
|
+
cf.cf_flags = 0;
|
|
90
|
+
cf.cf_feature_version = PY_MINOR_VERSION;
|
|
91
|
+
if (PyUnicode_Check(o)) {
|
|
92
|
+
cf.cf_flags = PyCF_SOURCE_IS_UTF8;
|
|
93
|
+
s = PyUnicode_AsUTF8String(o);
|
|
94
|
+
if (unlikely(!s)) goto bad;
|
|
95
|
+
o = s;
|
|
96
|
+
} else if (unlikely(!PyBytes_Check(o))) {
|
|
97
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
98
|
+
"exec: arg 1 must be string, bytes or code object, got " __Pyx_FMT_TYPENAME, o);
|
|
99
|
+
goto bad;
|
|
100
|
+
}
|
|
101
|
+
code = PyBytes_AS_STRING(o);
|
|
102
|
+
if (PyEval_MergeCompilerFlags(&cf)) {
|
|
103
|
+
result = PyRun_StringFlags(code, Py_file_input, globals, locals, &cf);
|
|
104
|
+
} else {
|
|
105
|
+
result = PyRun_String(code, Py_file_input, globals, locals);
|
|
106
|
+
}
|
|
107
|
+
Py_XDECREF(s);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return result;
|
|
111
|
+
bad:
|
|
112
|
+
Py_XDECREF(s);
|
|
113
|
+
return 0;
|
|
114
|
+
#else // CYTHON_COMPILING_IN_LIMITED_API
|
|
115
|
+
{
|
|
116
|
+
// For the limited API we just defer to the actual builtin
|
|
117
|
+
// (after setting up globals and locals) - there's too much we can't do otherwise
|
|
118
|
+
PyObject *builtins, *exec, *exec_str;
|
|
119
|
+
builtins = PyEval_GetBuiltins();
|
|
120
|
+
if (!builtins) return NULL;
|
|
121
|
+
exec_str = PyUnicode_FromStringAndSize("exec", 4);
|
|
122
|
+
if (!exec_str) return NULL;
|
|
123
|
+
exec = PyObject_GetItem(builtins, exec_str);
|
|
124
|
+
Py_DECREF(exec_str);
|
|
125
|
+
if (!exec) return NULL;
|
|
126
|
+
result = PyObject_CallFunctionObjArgs(exec, o, globals, locals, NULL);
|
|
127
|
+
Py_DECREF(exec);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
#endif
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//////////////////// GetAttr3.proto ////////////////////
|
|
134
|
+
|
|
135
|
+
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
|
|
136
|
+
|
|
137
|
+
//////////////////// GetAttr3 ////////////////////
|
|
138
|
+
//@requires: ObjectHandling.c::PyObjectGetAttrStr
|
|
139
|
+
//@requires: Exceptions.c::PyThreadStateGet
|
|
140
|
+
//@requires: Exceptions.c::PyErrFetchRestore
|
|
141
|
+
//@requires: Exceptions.c::PyErrExceptionMatches
|
|
142
|
+
|
|
143
|
+
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
|
|
144
|
+
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
|
|
145
|
+
__Pyx_PyThreadState_declare
|
|
146
|
+
__Pyx_PyThreadState_assign
|
|
147
|
+
if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
|
|
148
|
+
return NULL;
|
|
149
|
+
__Pyx_PyErr_Clear();
|
|
150
|
+
Py_INCREF(d);
|
|
151
|
+
return d;
|
|
152
|
+
}
|
|
153
|
+
#endif
|
|
154
|
+
|
|
155
|
+
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
|
|
156
|
+
PyObject *r;
|
|
157
|
+
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
|
|
158
|
+
int res = PyObject_GetOptionalAttr(o, n, &r);
|
|
159
|
+
// On failure (res == -1), r is set to NULL.
|
|
160
|
+
return (res != 0) ? r : __Pyx_NewRef(d);
|
|
161
|
+
#else
|
|
162
|
+
#if CYTHON_USE_TYPE_SLOTS
|
|
163
|
+
if (likely(PyUnicode_Check(n))) {
|
|
164
|
+
r = __Pyx_PyObject_GetAttrStrNoError(o, n);
|
|
165
|
+
if (unlikely(!r) && likely(!PyErr_Occurred())) {
|
|
166
|
+
r = __Pyx_NewRef(d);
|
|
167
|
+
}
|
|
168
|
+
return r;
|
|
169
|
+
}
|
|
170
|
+
#endif
|
|
171
|
+
r = PyObject_GetAttr(o, n);
|
|
172
|
+
return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
|
|
173
|
+
#endif
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//////////////////// HasAttr.proto ////////////////////
|
|
177
|
+
|
|
178
|
+
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
|
|
179
|
+
#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
|
|
180
|
+
#else
|
|
181
|
+
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /*proto*/
|
|
182
|
+
#endif
|
|
183
|
+
|
|
184
|
+
//////////////////// HasAttr ////////////////////
|
|
185
|
+
//@requires: ObjectHandling.c::PyObjectGetAttrStrNoError
|
|
186
|
+
|
|
187
|
+
#if __PYX_LIMITED_VERSION_HEX < 0x030d0000
|
|
188
|
+
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
|
|
189
|
+
PyObject *r;
|
|
190
|
+
if (unlikely(!PyUnicode_Check(n))) {
|
|
191
|
+
PyErr_SetString(PyExc_TypeError,
|
|
192
|
+
"hasattr(): attribute name must be string");
|
|
193
|
+
return -1;
|
|
194
|
+
}
|
|
195
|
+
r = __Pyx_PyObject_GetAttrStrNoError(o, n);
|
|
196
|
+
if (!r) {
|
|
197
|
+
return (unlikely(PyErr_Occurred())) ? -1 : 0;
|
|
198
|
+
} else {
|
|
199
|
+
Py_DECREF(r);
|
|
200
|
+
return 1;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
#endif
|
|
204
|
+
|
|
205
|
+
//////////////////// Intern.proto ////////////////////
|
|
206
|
+
|
|
207
|
+
static PyObject* __Pyx_Intern(PyObject* s); /* proto */
|
|
208
|
+
|
|
209
|
+
//////////////////// Intern ////////////////////
|
|
210
|
+
//@requires: ObjectHandling.c::RaiseUnexpectedTypeError
|
|
211
|
+
|
|
212
|
+
static PyObject* __Pyx_Intern(PyObject* s) {
|
|
213
|
+
if (unlikely(!PyUnicode_CheckExact(s))) {
|
|
214
|
+
__Pyx_RaiseUnexpectedTypeError("str", s);
|
|
215
|
+
return NULL;
|
|
216
|
+
}
|
|
217
|
+
Py_INCREF(s);
|
|
218
|
+
PyUnicode_InternInPlace(&s);
|
|
219
|
+
return s;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
//////////////////// abs_longlong.proto ////////////////////
|
|
223
|
+
//@requires: ModuleSetupCode.c::IncludeStdlibH
|
|
224
|
+
|
|
225
|
+
static CYTHON_INLINE PY_LONG_LONG __Pyx_abs_longlong(PY_LONG_LONG x) {
|
|
226
|
+
#if defined (__cplusplus) && __cplusplus >= 201103L
|
|
227
|
+
return std::abs(x);
|
|
228
|
+
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
229
|
+
return llabs(x);
|
|
230
|
+
#elif defined (_MSC_VER)
|
|
231
|
+
// abs() is defined for long, but 64-bits type on MSVC is long long.
|
|
232
|
+
// Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
|
|
233
|
+
return _abs64(x);
|
|
234
|
+
#elif defined (__GNUC__)
|
|
235
|
+
// gcc or clang on 64 bit windows.
|
|
236
|
+
return __builtin_llabs(x);
|
|
237
|
+
#else
|
|
238
|
+
if (sizeof(PY_LONG_LONG) <= sizeof(Py_ssize_t))
|
|
239
|
+
return __Pyx_sst_abs(x);
|
|
240
|
+
return (x<0) ? -x : x;
|
|
241
|
+
#endif
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
//////////////////// py_abs.proto ////////////////////
|
|
246
|
+
|
|
247
|
+
#if CYTHON_USE_PYLONG_INTERNALS
|
|
248
|
+
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);/*proto*/
|
|
249
|
+
|
|
250
|
+
#define __Pyx_PyNumber_Absolute(x) \
|
|
251
|
+
((likely(PyLong_CheckExact(x))) ? \
|
|
252
|
+
(likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) : \
|
|
253
|
+
PyNumber_Absolute(x))
|
|
254
|
+
|
|
255
|
+
#else
|
|
256
|
+
#define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
|
|
257
|
+
#endif
|
|
258
|
+
|
|
259
|
+
//////////////////// py_abs ////////////////////
|
|
260
|
+
|
|
261
|
+
#if CYTHON_USE_PYLONG_INTERNALS
|
|
262
|
+
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
|
|
263
|
+
#if PY_VERSION_HEX >= 0x030C00A7
|
|
264
|
+
if (likely(__Pyx_PyLong_IsCompact(n))) {
|
|
265
|
+
return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
|
|
266
|
+
}
|
|
267
|
+
#else
|
|
268
|
+
if (likely(Py_SIZE(n) == -1)) {
|
|
269
|
+
// digits are unsigned
|
|
270
|
+
return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
|
|
271
|
+
}
|
|
272
|
+
#endif
|
|
273
|
+
#if CYTHON_COMPILING_IN_CPYTHON
|
|
274
|
+
{
|
|
275
|
+
PyObject *copy = _PyLong_Copy((PyLongObject*)n);
|
|
276
|
+
if (likely(copy)) {
|
|
277
|
+
#if PY_VERSION_HEX >= 0x030C00A7
|
|
278
|
+
// clear the sign bits to set the sign from SIGN_NEGATIVE (2) to positive (0)
|
|
279
|
+
((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
|
|
280
|
+
#else
|
|
281
|
+
// negate the size to swap the sign
|
|
282
|
+
Py_SET_SIZE(copy, -Py_SIZE(copy));
|
|
283
|
+
#endif
|
|
284
|
+
}
|
|
285
|
+
return copy;
|
|
286
|
+
}
|
|
287
|
+
#else
|
|
288
|
+
return PyNumber_Negative(n);
|
|
289
|
+
#endif
|
|
290
|
+
}
|
|
291
|
+
#endif
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
//////////////////// pow2.proto ////////////////////
|
|
295
|
+
|
|
296
|
+
#define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
//////////////////// divmod_int.proto //////////////////
|
|
300
|
+
|
|
301
|
+
static const {{RETURN_TYPE}} __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}} = {-1, -1};
|
|
302
|
+
|
|
303
|
+
static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b); /*proto*/
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
//////////////////// divmod_int //////////////////
|
|
307
|
+
|
|
308
|
+
static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b) {
|
|
309
|
+
// Python and C/C++ use different algorithms in calculating quotients and remainders.
|
|
310
|
+
// This results in different answers between Python and C/C++
|
|
311
|
+
// when the dividend is negative and the divisor is positive and vice versa.
|
|
312
|
+
{{TYPE}} q, r;
|
|
313
|
+
if (unlikely(b == 0)) {
|
|
314
|
+
{{if NOGIL}}PyGILState_STATE gilstate = PyGILState_Ensure();{{endif}}
|
|
315
|
+
PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
|
|
316
|
+
{{if NOGIL}}PyGILState_Release(gilstate);{{endif}}
|
|
317
|
+
return __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}};
|
|
318
|
+
} else if (a == 0) {
|
|
319
|
+
q = 0;
|
|
320
|
+
r = 0;
|
|
321
|
+
} else if ((a < 0) != (b < 0)) {
|
|
322
|
+
// see CMath.c :: DivInt and ModInt utility code
|
|
323
|
+
q = a / b;
|
|
324
|
+
r = a - q * b;
|
|
325
|
+
{{TYPE}} adapt_python = ((r != 0) & ((r < 0) ^ (b < 0)));
|
|
326
|
+
q -= adapt_python;
|
|
327
|
+
r += adapt_python * b;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
q = a / b;
|
|
331
|
+
r = a % b;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
{{RETURN_TYPE}} c_result = {q, r};
|
|
335
|
+
return c_result;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
//////////////////// divmod_float.proto //////////////////
|
|
340
|
+
|
|
341
|
+
static const {{RETURN_TYPE}} __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}} = {-1.0, -1.0};
|
|
342
|
+
|
|
343
|
+
static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b); /*proto*/
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
//////////////////// divmod_float //////////////////
|
|
347
|
+
|
|
348
|
+
static CYTHON_INLINE {{RETURN_TYPE}} __Pyx_divmod_{{CFUNC_SUFFIX}}({{TYPE}} a, {{TYPE}} b) {
|
|
349
|
+
// Python and C/C++ use different algorithms in calculating quotients and remainders.
|
|
350
|
+
// This results in different answers between Python and C/C++
|
|
351
|
+
// when the dividend is negative and the divisor is positive and vice versa.
|
|
352
|
+
|
|
353
|
+
// Adapted from CPython 3.14: floatobject.c / _float_div_mod()
|
|
354
|
+
|
|
355
|
+
{{TYPE}} q, r, div;
|
|
356
|
+
|
|
357
|
+
if (unlikely(b == 0.0)) {
|
|
358
|
+
{{if NOGIL}}PyGILState_STATE gilstate = PyGILState_Ensure();{{endif}}
|
|
359
|
+
PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
|
|
360
|
+
{{if NOGIL}}PyGILState_Release(gilstate);{{endif}}
|
|
361
|
+
return __Pyx_divmod_ERROR_VALUE_{{CFUNC_SUFFIX}};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
r = fmod{{MATH_SUFFIX}}(a, b);
|
|
365
|
+
// fmod is typically exact, so a-mod is *mathematically* an
|
|
366
|
+
// exact multiple of b. But this is fp arithmetic, and fp
|
|
367
|
+
// a - mod is an approximation; the result is that div may
|
|
368
|
+
// not be an exact integral value after the division, although
|
|
369
|
+
// it will always be very close to one.
|
|
370
|
+
div = (a - r) / b;
|
|
371
|
+
if (r) {
|
|
372
|
+
// ensure the remainder has the same sign as the denominator
|
|
373
|
+
if ((b < 0) != (r < 0)) {
|
|
374
|
+
r += b;
|
|
375
|
+
div -= 1.0;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
// the remainder is zero, and in the presence of signed zeroes
|
|
380
|
+
// fmod returns different results across platforms; ensure
|
|
381
|
+
// it has the same sign as the denominator.
|
|
382
|
+
r = copysign{{MATH_SUFFIX}}(0.0, b);
|
|
383
|
+
}
|
|
384
|
+
// snap quotient to nearest integral value
|
|
385
|
+
if (div) {
|
|
386
|
+
q = floor{{MATH_SUFFIX}}(div);
|
|
387
|
+
if (div - q > 0.5) {
|
|
388
|
+
q += 1.0;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
// div is zero - get the same sign as the true quotient
|
|
393
|
+
q = copysign{{MATH_SUFFIX}}(0.0, a / b); /* zero w/ sign of a/b */
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
{{RETURN_TYPE}} c_result = {q, r};
|
|
397
|
+
return c_result;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
//////////////////// int_pyucs4.proto ////////////////////
|
|
402
|
+
|
|
403
|
+
static CYTHON_INLINE int __Pyx_int_from_UCS4(Py_UCS4 uchar);
|
|
404
|
+
|
|
405
|
+
//////////////////// int_pyucs4 ////////////////////
|
|
406
|
+
|
|
407
|
+
static int __Pyx_int_from_UCS4(Py_UCS4 uchar) {
|
|
408
|
+
// Fast path for ascii digits
|
|
409
|
+
if (likely(uchar >= (Py_UCS4)'0' && uchar <= (Py_UCS4)'9')) {
|
|
410
|
+
return uchar - (Py_UCS4)'0';
|
|
411
|
+
}
|
|
412
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
413
|
+
PyObject *u = PyUnicode_FromOrdinal(uchar);
|
|
414
|
+
if (unlikely(!u)) return -1;
|
|
415
|
+
PyObject *l = PyObject_CallFunctionObjArgs((PyObject*)(&PyLong_Type), u, NULL);
|
|
416
|
+
Py_DECREF(u);
|
|
417
|
+
if (unlikely(!l)) return -1;
|
|
418
|
+
#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
|
|
419
|
+
int result = PyLong_AsInt(l);
|
|
420
|
+
#else
|
|
421
|
+
// just don't handle overflow - it's very difficult to see how we'll get it from
|
|
422
|
+
// a single digit.
|
|
423
|
+
int result = (int)PyLong_AsLong(l);
|
|
424
|
+
#endif
|
|
425
|
+
Py_DECREF(l);
|
|
426
|
+
return result;
|
|
427
|
+
#else
|
|
428
|
+
int digit = Py_UNICODE_TODECIMAL(uchar);
|
|
429
|
+
if (unlikely(digit < 0)) {
|
|
430
|
+
PyErr_Format(PyExc_ValueError,
|
|
431
|
+
"invalid literal for int() with base 10: '%c'",
|
|
432
|
+
(int) uchar);
|
|
433
|
+
return -1;
|
|
434
|
+
}
|
|
435
|
+
return digit;
|
|
436
|
+
#endif
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
//////////////////// float_pyucs4.proto ////////////////////
|
|
441
|
+
|
|
442
|
+
static CYTHON_INLINE double __Pyx_double_from_UCS4(Py_UCS4 uchar);
|
|
443
|
+
|
|
444
|
+
//////////////////// float_pyucs4 ////////////////////
|
|
445
|
+
|
|
446
|
+
static double __Pyx_double_from_UCS4(Py_UCS4 uchar) {
|
|
447
|
+
// fast path for "just an ascii digit"
|
|
448
|
+
if (likely(uchar >= (Py_UCS4)'0' && uchar <= (Py_UCS4)'9')) {
|
|
449
|
+
return uchar - (Py_UCS4)'0';
|
|
450
|
+
}
|
|
451
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
452
|
+
PyObject *u = PyUnicode_FromOrdinal(uchar);
|
|
453
|
+
if (unlikely(!u)) return -1.0;
|
|
454
|
+
PyObject *f = PyFloat_FromString(u);
|
|
455
|
+
Py_DECREF(u);
|
|
456
|
+
if (unlikely(!f)) return -1.0;
|
|
457
|
+
double result = PyFloat_AsDouble(f);
|
|
458
|
+
Py_DECREF(f);
|
|
459
|
+
return result;
|
|
460
|
+
#else
|
|
461
|
+
// ...TONUMERIC would initially seem to be a better fit.
|
|
462
|
+
// However, that accepts things like the "half" symbol, while
|
|
463
|
+
// float(string) rejects those.
|
|
464
|
+
double digit = Py_UNICODE_TODECIMAL(uchar);
|
|
465
|
+
if (unlikely(digit < 0.0)) {
|
|
466
|
+
PyErr_Format(PyExc_ValueError,
|
|
467
|
+
"could not convert string to float: '%c'",
|
|
468
|
+
(int) uchar);
|
|
469
|
+
return -1.0;
|
|
470
|
+
}
|
|
471
|
+
return digit;
|
|
472
|
+
#endif
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
//////////////////// object_ord.proto ////////////////////
|
|
477
|
+
//@requires: TypeConversion.c::UnicodeAsUCS4
|
|
478
|
+
|
|
479
|
+
#define __Pyx_PyObject_Ord(c) \
|
|
480
|
+
(likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c))
|
|
481
|
+
static long __Pyx__PyObject_Ord(PyObject* c); /*proto*/
|
|
482
|
+
|
|
483
|
+
//////////////////// object_ord ////////////////////
|
|
484
|
+
//@requires: ObjectHandling.c::RaiseErrorWithObjectType
|
|
485
|
+
|
|
486
|
+
static long __Pyx__PyObject_Ord(PyObject* c) {
|
|
487
|
+
Py_ssize_t size;
|
|
488
|
+
if (PyBytes_Check(c)) {
|
|
489
|
+
size = __Pyx_PyBytes_GET_SIZE(c);
|
|
490
|
+
if (likely(size == 1)) {
|
|
491
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
492
|
+
return (unsigned char) PyBytes_AS_STRING(c)[0];
|
|
493
|
+
#else
|
|
494
|
+
char *data = PyBytes_AsString(c);
|
|
495
|
+
if (unlikely(!data)) return -1;
|
|
496
|
+
return (unsigned char) data[0];
|
|
497
|
+
#endif
|
|
498
|
+
}
|
|
499
|
+
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
500
|
+
else if (unlikely(size < 0)) return -1;
|
|
501
|
+
#endif
|
|
502
|
+
} else if (PyByteArray_Check(c)) {
|
|
503
|
+
size = __Pyx_PyByteArray_GET_SIZE(c);
|
|
504
|
+
if (likely(size == 1)) {
|
|
505
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
506
|
+
return (unsigned char) PyByteArray_AS_STRING(c)[0];
|
|
507
|
+
#else
|
|
508
|
+
char *data = PyByteArray_AsString(c);
|
|
509
|
+
if (unlikely(!data)) return -1;
|
|
510
|
+
return (unsigned char) data[0];
|
|
511
|
+
#endif
|
|
512
|
+
}
|
|
513
|
+
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
514
|
+
else if (unlikely(size < 0)) return -1;
|
|
515
|
+
#endif
|
|
516
|
+
} else {
|
|
517
|
+
// FIXME: support character buffers - but CPython doesn't support them either
|
|
518
|
+
__Pyx_RaiseTypeErrorWithObjectType(
|
|
519
|
+
"ord() expected string of length 1, but " __Pyx_FMT_TYPENAME " found", c);
|
|
520
|
+
return (long)(Py_UCS4)-1;
|
|
521
|
+
}
|
|
522
|
+
PyErr_Format(PyExc_TypeError,
|
|
523
|
+
"ord() expected a character, but string of length %zd found", size);
|
|
524
|
+
return (long)(Py_UCS4)-1;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
//////////////////// py_dict_keys.proto ////////////////////
|
|
529
|
+
|
|
530
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
|
|
531
|
+
|
|
532
|
+
//////////////////// py_dict_keys ////////////////////
|
|
533
|
+
|
|
534
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
|
|
535
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
//////////////////// py_frozendict_keys.proto ////////////////////
|
|
539
|
+
|
|
540
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Keys(PyObject* d); /*proto*/
|
|
541
|
+
|
|
542
|
+
//////////////////// py_frozendict_keys ////////////////////
|
|
543
|
+
|
|
544
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Keys(PyObject* d) {
|
|
545
|
+
return CALL_UNBOUND_METHOD_TYPEPTR(__Pyx_PyFrozenDict_TypePtr, "keys", d);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
//////////////////// py_dict_values.proto ////////////////////
|
|
549
|
+
|
|
550
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/
|
|
551
|
+
|
|
552
|
+
//////////////////// py_dict_values ////////////////////
|
|
553
|
+
|
|
554
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
|
|
555
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
//////////////////// py_frozendict_values.proto ////////////////////
|
|
559
|
+
|
|
560
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Values(PyObject* d); /*proto*/
|
|
561
|
+
|
|
562
|
+
//////////////////// py_frozendict_values ////////////////////
|
|
563
|
+
|
|
564
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Values(PyObject* d) {
|
|
565
|
+
return CALL_UNBOUND_METHOD_TYPEPTR(__Pyx_PyFrozenDict_TypePtr, "values", d);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
//////////////////// py_dict_items.proto ////////////////////
|
|
569
|
+
|
|
570
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
|
|
571
|
+
|
|
572
|
+
//////////////////// py_dict_items ////////////////////
|
|
573
|
+
|
|
574
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
|
|
575
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
//////////////////// py_frozendict_items.proto ////////////////////
|
|
579
|
+
|
|
580
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Items(PyObject* d); /*proto*/
|
|
581
|
+
|
|
582
|
+
//////////////////// py_frozendict_items ////////////////////
|
|
583
|
+
|
|
584
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_Items(PyObject* d) {
|
|
585
|
+
return CALL_UNBOUND_METHOD_TYPEPTR(__Pyx_PyFrozenDict_TypePtr, "items", d);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
//////////////////// py_dict_iterkeys.proto ////////////////////
|
|
589
|
+
|
|
590
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d); /*proto*/
|
|
591
|
+
|
|
592
|
+
//////////////////// py_dict_iterkeys ////////////////////
|
|
593
|
+
|
|
594
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterKeys(PyObject* d) {
|
|
595
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
//////////////////// py_dict_itervalues.proto ////////////////////
|
|
599
|
+
|
|
600
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d); /*proto*/
|
|
601
|
+
|
|
602
|
+
//////////////////// py_dict_itervalues ////////////////////
|
|
603
|
+
|
|
604
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterValues(PyObject* d) {
|
|
605
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
//////////////////// py_dict_iteritems.proto ////////////////////
|
|
609
|
+
|
|
610
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d); /*proto*/
|
|
611
|
+
|
|
612
|
+
//////////////////// py_dict_iteritems ////////////////////
|
|
613
|
+
|
|
614
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_IterItems(PyObject* d) {
|
|
615
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
//////////////////// py_dict_viewkeys.proto ////////////////////
|
|
619
|
+
|
|
620
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d); /*proto*/
|
|
621
|
+
|
|
622
|
+
//////////////////// py_dict_viewkeys ////////////////////
|
|
623
|
+
|
|
624
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewKeys(PyObject* d) {
|
|
625
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "keys", d);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
//////////////////// py_dict_viewvalues.proto ////////////////////
|
|
629
|
+
|
|
630
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d); /*proto*/
|
|
631
|
+
|
|
632
|
+
//////////////////// py_dict_viewvalues ////////////////////
|
|
633
|
+
|
|
634
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewValues(PyObject* d) {
|
|
635
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "values", d);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
//////////////////// py_dict_viewitems.proto ////////////////////
|
|
639
|
+
|
|
640
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d); /*proto*/
|
|
641
|
+
|
|
642
|
+
//////////////////// py_dict_viewitems ////////////////////
|
|
643
|
+
|
|
644
|
+
static CYTHON_INLINE PyObject* __Pyx_PyDict_ViewItems(PyObject* d) {
|
|
645
|
+
return CALL_UNBOUND_METHOD(PyDict_Type, "items", d);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
/////////////// dict_setdefault.proto ///////////////
|
|
650
|
+
|
|
651
|
+
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); /*proto*/
|
|
652
|
+
|
|
653
|
+
/////////////// dict_setdefault ///////////////
|
|
654
|
+
|
|
655
|
+
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
|
|
656
|
+
PyObject* value;
|
|
657
|
+
#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
|
|
658
|
+
PyDict_SetDefaultRef(d, key, default_value, &value);
|
|
659
|
+
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
|
|
660
|
+
PyObject *args[] = {d, key, default_value};
|
|
661
|
+
value = PyObject_VectorcallMethod(PYIDENT("setdefault"), args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
|
662
|
+
#elif CYTHON_COMPILING_IN_LIMITED_API
|
|
663
|
+
value = PyObject_CallMethodObjArgs(d, PYIDENT("setdefault"), key, default_value, NULL);
|
|
664
|
+
#else
|
|
665
|
+
value = PyDict_SetDefault(d, key, default_value);
|
|
666
|
+
if (unlikely(!value)) return NULL;
|
|
667
|
+
Py_INCREF(value);
|
|
668
|
+
#endif
|
|
669
|
+
return value;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
//////////////////// pyfrozenset_new.proto ////////////////////
|
|
674
|
+
|
|
675
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
|
|
676
|
+
|
|
677
|
+
//////////////////// pyfrozenset_new ////////////////////
|
|
678
|
+
//@requires: ObjectHandling.c::PyObjectCallNoArg
|
|
679
|
+
|
|
680
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
|
|
681
|
+
if (it) {
|
|
682
|
+
PyObject* result;
|
|
683
|
+
#if CYTHON_COMPILING_IN_PYPY
|
|
684
|
+
// PyPy currently lacks PyFrozenSet_CheckExact() and PyFrozenSet_New()
|
|
685
|
+
PyObject* args;
|
|
686
|
+
args = PyTuple_Pack(1, it);
|
|
687
|
+
if (unlikely(!args))
|
|
688
|
+
return NULL;
|
|
689
|
+
result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
|
|
690
|
+
Py_DECREF(args);
|
|
691
|
+
return result;
|
|
692
|
+
#else
|
|
693
|
+
if (PyFrozenSet_CheckExact(it)) {
|
|
694
|
+
Py_INCREF(it);
|
|
695
|
+
return it;
|
|
696
|
+
}
|
|
697
|
+
result = PyFrozenSet_New(it);
|
|
698
|
+
if (unlikely(!result))
|
|
699
|
+
return NULL;
|
|
700
|
+
if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
|
|
701
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
702
|
+
|| __Pyx_get_runtime_version() >= 0x030A0000
|
|
703
|
+
#endif
|
|
704
|
+
)
|
|
705
|
+
return result;
|
|
706
|
+
{
|
|
707
|
+
Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
|
|
708
|
+
if (likely(size > 0))
|
|
709
|
+
return result;
|
|
710
|
+
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
711
|
+
if (unlikely(size < 0)) {
|
|
712
|
+
Py_DECREF(result);
|
|
713
|
+
return NULL;
|
|
714
|
+
}
|
|
715
|
+
#endif
|
|
716
|
+
}
|
|
717
|
+
// empty frozenset is a singleton (on Python <3.10)
|
|
718
|
+
// seems wasteful, but CPython does the same
|
|
719
|
+
Py_DECREF(result);
|
|
720
|
+
#endif
|
|
721
|
+
}
|
|
722
|
+
return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
//////////////////// PySet_Update.proto ////////////////////
|
|
727
|
+
|
|
728
|
+
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it); /*proto*/
|
|
729
|
+
|
|
730
|
+
//////////////////// PySet_Update ////////////////////
|
|
731
|
+
|
|
732
|
+
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
|
|
733
|
+
PyObject *retval;
|
|
734
|
+
#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
|
|
735
|
+
if (PyAnySet_Check(it)) {
|
|
736
|
+
Py_ssize_t size = __Pyx_PySet_GET_SIZE(it);
|
|
737
|
+
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
738
|
+
if (unlikely(size < 0)) return -1;
|
|
739
|
+
#endif
|
|
740
|
+
if (size == 0)
|
|
741
|
+
return 0;
|
|
742
|
+
// fast and safe case: CPython will update our result set and return it
|
|
743
|
+
retval = PySet_Type.tp_as_number->nb_inplace_or(set, it);
|
|
744
|
+
if (likely(retval == set)) {
|
|
745
|
+
Py_DECREF(retval);
|
|
746
|
+
return 0;
|
|
747
|
+
}
|
|
748
|
+
if (unlikely(!retval))
|
|
749
|
+
return -1;
|
|
750
|
+
// unusual result, fall through to set.update() call below
|
|
751
|
+
Py_DECREF(retval);
|
|
752
|
+
}
|
|
753
|
+
#endif
|
|
754
|
+
retval = CALL_UNBOUND_METHOD(PySet_Type, "update", set, it);
|
|
755
|
+
if (unlikely(!retval)) return -1;
|
|
756
|
+
Py_DECREF(retval);
|
|
757
|
+
return 0;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
//////////////////// PyRange_Check.proto ////////////////////
|
|
761
|
+
|
|
762
|
+
#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
|
|
763
|
+
#define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type)
|
|
764
|
+
#endif
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
///////////////// memoryview_get_from_buffer.proto ////////////////////
|
|
768
|
+
|
|
769
|
+
#if !CYTHON_COMPILING_IN_LIMITED_API
|
|
770
|
+
#define __Pyx_PyMemoryView_Get_{{name}}(o) PyMemoryView_GET_BUFFER(o)->{{name}}
|
|
771
|
+
#else
|
|
772
|
+
{{py:
|
|
773
|
+
out_types = dict(
|
|
774
|
+
ndim='int', readonly='int',
|
|
775
|
+
len='Py_ssize_t', itemsize='Py_ssize_t')
|
|
776
|
+
}} // can't get format like this unfortunately. It's unicode via getattr
|
|
777
|
+
{{py: out_type = out_types[name]}}
|
|
778
|
+
static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj); /* proto */
|
|
779
|
+
#endif
|
|
780
|
+
|
|
781
|
+
////////////// memoryview_get_from_buffer /////////////////////////
|
|
782
|
+
|
|
783
|
+
#if !CYTHON_COMPILING_IN_LIMITED_API
|
|
784
|
+
#else
|
|
785
|
+
{{py:
|
|
786
|
+
out_types = dict(
|
|
787
|
+
ndim='int', readonly='int',
|
|
788
|
+
len='Py_ssize_t', itemsize='Py_ssize_t')
|
|
789
|
+
}}
|
|
790
|
+
{{py: out_type = out_types[name]}}
|
|
791
|
+
static {{out_type}} __Pyx_PyMemoryView_Get_{{name}}(PyObject *obj) {
|
|
792
|
+
{{out_type}} result;
|
|
793
|
+
PyObject *attr = PyObject_GetAttr(obj, PYIDENT("{{name}}"));
|
|
794
|
+
if (!attr) {
|
|
795
|
+
goto bad;
|
|
796
|
+
}
|
|
797
|
+
{{if out_type == 'int'}}
|
|
798
|
+
// I'm not worrying about overflow here because
|
|
799
|
+
// ultimately it comes from a C struct that's an int
|
|
800
|
+
result = PyLong_AsLong(attr);
|
|
801
|
+
{{elif out_type == 'Py_ssize_t'}}
|
|
802
|
+
result = PyLong_AsSsize_t(attr);
|
|
803
|
+
{{endif}}
|
|
804
|
+
Py_DECREF(attr);
|
|
805
|
+
return result;
|
|
806
|
+
|
|
807
|
+
bad:
|
|
808
|
+
Py_XDECREF(attr);
|
|
809
|
+
return -1;
|
|
810
|
+
}
|
|
811
|
+
#endif
|
|
812
|
+
|
|
813
|
+
////////////// PySliceAccessors.proto /////////////////////////
|
|
814
|
+
|
|
815
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
816
|
+
#define __Pyx_PySlice_Start(o) PyObject_GetAttr(o, PYIDENT("start"))
|
|
817
|
+
#define __Pyx_PySlice_Stop(o) PyObject_GetAttr(o, PYIDENT("stop"))
|
|
818
|
+
#define __Pyx_PySlice_Step(o) PyObject_GetAttr(o, PYIDENT("step"))
|
|
819
|
+
#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
|
|
820
|
+
// Graal defines it's own accessor functions
|
|
821
|
+
#define __Pyx_PySlice_Start(o) GraalPySlice_Start(o)
|
|
822
|
+
#define __Pyx_PySlice_Stop(o) GraalPySlice_Stop(o)
|
|
823
|
+
#define __Pyx_PySlice_Step(o) GraalPySlice_Step(o)
|
|
824
|
+
#elif CYTHON_COMPILING_IN_GRAAL
|
|
825
|
+
// Remove when GraalPy 24 goes EOL
|
|
826
|
+
#define __Pyx_PySlice_Start(o) __Pyx_NewRef(PySlice_Start((PySliceObject*)o))
|
|
827
|
+
#define __Pyx_PySlice_Stop(o) __Pyx_NewRef(PySlice_Stop((PySliceObject*)o))
|
|
828
|
+
#define __Pyx_PySlice_Step(o) __Pyx_NewRef(PySlice_Step((PySliceObject*)o))
|
|
829
|
+
#else
|
|
830
|
+
#define __Pyx_PySlice_Start(o) __Pyx_NewRef(((PySliceObject*)o)->start)
|
|
831
|
+
#define __Pyx_PySlice_Stop(o) __Pyx_NewRef(((PySliceObject*)o)->stop)
|
|
832
|
+
#define __Pyx_PySlice_Step(o) __Pyx_NewRef(((PySliceObject*)o)->step)
|
|
833
|
+
#endif
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
////////////// PyFrozenDict.proto /////////////////////////
|
|
837
|
+
|
|
838
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
839
|
+
// PyFrozenDict is not currently in the Limited API.
|
|
840
|
+
|
|
841
|
+
#define __Pyx_PyFrozenDict_TypePtr ((PyTypeObject*) CGLOBAL(__Pyx_PyFrozenDictType))
|
|
842
|
+
|
|
843
|
+
#define __Pyx_PyFrozenDict_New(it) __Pyx__PyFrozenDict_New(CGLOBAL(__Pyx_PyFrozenDictType), it)
|
|
844
|
+
static CYTHON_INLINE PyObject* __Pyx__PyFrozenDict_New(PyObject* frozendict_type, PyObject* it); /*proto*/
|
|
845
|
+
|
|
846
|
+
#define __Pyx_PyFrozenDict_NewEmpty() __Pyx_PyFrozenDict_New(NULL)
|
|
847
|
+
#define __Pyx_PyFrozenDict_Check(obj) PyObject_TypeCheck((obj), __Pyx_PyFrozenDict_TypePtr)
|
|
848
|
+
#define __Pyx_PyFrozenDict_CheckExact(obj) Py_IS_TYPE((obj), __Pyx_PyFrozenDict_TypePtr)
|
|
849
|
+
|
|
850
|
+
#define __Pyx_PyAnyDict_Check(obj) __Pyx__PyAnyDict_Check(obj, __Pyx_PyFrozenDict_TypePtr)
|
|
851
|
+
static CYTHON_INLINE int __Pyx__PyAnyDict_Check(PyObject *obj, PyTypeObject* frozendict_type) {
|
|
852
|
+
return PyObject_TypeCheck(obj, &PyDict_Type) || PyObject_TypeCheck(obj, frozendict_type);
|
|
853
|
+
}
|
|
854
|
+
#define __Pyx_PyAnyDict_CheckExact(obj) __Pyx__PyAnyDict_CheckExact(obj, __Pyx_PyFrozenDict_TypePtr)
|
|
855
|
+
static CYTHON_INLINE int __Pyx__PyAnyDict_CheckExact(PyObject *obj, PyTypeObject* frozendict_type) {
|
|
856
|
+
return Py_IS_TYPE(obj, &PyDict_Type) || Py_IS_TYPE(obj, frozendict_type);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
#elif PY_VERSION_HEX >= 0x030f00a6 || \
|
|
860
|
+
(defined(PyFrozenDict_Check) && defined(PyAnyDict_Check) && defined(PyFrozenDict_New))
|
|
861
|
+
#define __Pyx_PyFrozenDict_TypePtr (&PyFrozenDict_Type)
|
|
862
|
+
#define __Pyx_PyFrozenDict_New(it) PyFrozenDict_New(it)
|
|
863
|
+
#define __Pyx_PyFrozenDict_NewEmpty() PyFrozenDict_New(NULL)
|
|
864
|
+
#define __Pyx_PyFrozenDict_Check(obj) PyFrozenDict_Check(obj)
|
|
865
|
+
#define __Pyx_PyFrozenDict_CheckExact(obj) PyFrozenDict_CheckExact(obj)
|
|
866
|
+
#define __Pyx_PyAnyDict_Check(obj) PyAnyDict_Check(obj)
|
|
867
|
+
#define __Pyx_PyAnyDict_CheckExact(obj) PyAnyDict_CheckExact(obj)
|
|
868
|
+
|
|
869
|
+
#else
|
|
870
|
+
// Replacing PyFrozenDict with PyDict for older Python versions seems reasonable and helpful.
|
|
871
|
+
#define __Pyx_PyFrozenDict_TypePtr (&PyDict_Type)
|
|
872
|
+
|
|
873
|
+
static CYTHON_INLINE PyObject* __Pyx_PyFrozenDict_New(PyObject* it) {
|
|
874
|
+
if (!it) {
|
|
875
|
+
return PyDict_New();
|
|
876
|
+
} else if (PyDict_Check(it)) {
|
|
877
|
+
return PyDict_Copy(it);
|
|
878
|
+
} else {
|
|
879
|
+
PyObject *dict = PyDict_New();
|
|
880
|
+
if (!dict) return NULL;
|
|
881
|
+
// PyDict_Merge() and friends do not handle arbitrary iterables. '|' does.
|
|
882
|
+
PyObject *result = PyNumber_InPlaceOr(dict, it);
|
|
883
|
+
Py_DECREF(dict);
|
|
884
|
+
return result;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
#define __Pyx_PyFrozenDict_NewEmpty() PyDict_New()
|
|
888
|
+
#define __Pyx_PyFrozenDict_Check(obj) PyDict_Check(obj)
|
|
889
|
+
#define __Pyx_PyFrozenDict_CheckExact(obj) PyDict_CheckExact(obj)
|
|
890
|
+
#define __Pyx_PyAnyDict_Check(obj) PyDict_Check(obj)
|
|
891
|
+
#define __Pyx_PyAnyDict_CheckExact(obj) PyDict_CheckExact(obj)
|
|
892
|
+
#endif
|
|
893
|
+
|
|
894
|
+
/////////////////// PyFrozenDict.module_state_decls //////////
|
|
895
|
+
|
|
896
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
897
|
+
PyObject *__Pyx_PyFrozenDictType;
|
|
898
|
+
#endif
|
|
899
|
+
|
|
900
|
+
////////////// PyFrozenDict /////////////////////////
|
|
901
|
+
|
|
902
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
903
|
+
static CYTHON_INLINE PyObject* __Pyx__PyFrozenDict_New(PyObject* frozendict_type, PyObject* it) {
|
|
904
|
+
return PyObject_CallFunctionObjArgs(frozendict_type, it, NULL);
|
|
905
|
+
}
|
|
906
|
+
#endif
|
|
907
|
+
|
|
908
|
+
////////////////// PyFrozenDict.init ////////////////
|
|
909
|
+
|
|
910
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
911
|
+
{
|
|
912
|
+
PyObject *builtins = PyEval_GetBuiltins(); // borrowed
|
|
913
|
+
if (likely(builtins)) {
|
|
914
|
+
PyObject *type_name = PyUnicode_FromStringAndSize("frozendict", sizeof("frozendict")-1);
|
|
915
|
+
if (likely(type_name)) {
|
|
916
|
+
PyObject *frozendict_type = PyObject_GetItem(builtins, type_name);
|
|
917
|
+
Py_DECREF(type_name);
|
|
918
|
+
if (!frozendict_type && PyErr_ExceptionMatches(PyExc_KeyError)) {
|
|
919
|
+
PyErr_Clear();
|
|
920
|
+
frozendict_type = (PyObject*) &PyDict_Type;
|
|
921
|
+
Py_INCREF(frozendict_type);
|
|
922
|
+
}
|
|
923
|
+
CGLOBAL(__Pyx_PyFrozenDictType) = frozendict_type;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
} // error handling follows
|
|
927
|
+
#endif
|
|
928
|
+
|
|
929
|
+
/////////////// PyFrozenDict.cleanup ////////////////
|
|
930
|
+
|
|
931
|
+
#if CYTHON_COMPILING_IN_LIMITED_API
|
|
932
|
+
Py_CLEAR(CGLOBAL(__Pyx_PyFrozenDictType));
|
|
933
|
+
#endif
|