cstate.c 131 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202
  1. /* Generated by Cython 0.20.1 on Sun Mar 16 22:58:16 2014 */
  2. #define PY_SSIZE_T_CLEAN
  3. #ifndef CYTHON_USE_PYLONG_INTERNALS
  4. #ifdef PYLONG_BITS_IN_DIGIT
  5. #define CYTHON_USE_PYLONG_INTERNALS 0
  6. #else
  7. #include "pyconfig.h"
  8. #ifdef PYLONG_BITS_IN_DIGIT
  9. #define CYTHON_USE_PYLONG_INTERNALS 1
  10. #else
  11. #define CYTHON_USE_PYLONG_INTERNALS 0
  12. #endif
  13. #endif
  14. #endif
  15. #include "Python.h"
  16. #ifndef Py_PYTHON_H
  17. #error Python headers needed to compile C extensions, please install development version of Python.
  18. #elif PY_VERSION_HEX < 0x02040000
  19. #error Cython requires Python 2.4+.
  20. #else
  21. #define CYTHON_ABI "0_20_1"
  22. #include <stddef.h> /* For offsetof */
  23. #ifndef offsetof
  24. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  25. #endif
  26. #if !defined(WIN32) && !defined(MS_WINDOWS)
  27. #ifndef __stdcall
  28. #define __stdcall
  29. #endif
  30. #ifndef __cdecl
  31. #define __cdecl
  32. #endif
  33. #ifndef __fastcall
  34. #define __fastcall
  35. #endif
  36. #endif
  37. #ifndef DL_IMPORT
  38. #define DL_IMPORT(t) t
  39. #endif
  40. #ifndef DL_EXPORT
  41. #define DL_EXPORT(t) t
  42. #endif
  43. #ifndef PY_LONG_LONG
  44. #define PY_LONG_LONG LONG_LONG
  45. #endif
  46. #ifndef Py_HUGE_VAL
  47. #define Py_HUGE_VAL HUGE_VAL
  48. #endif
  49. #ifdef PYPY_VERSION
  50. #define CYTHON_COMPILING_IN_PYPY 1
  51. #define CYTHON_COMPILING_IN_CPYTHON 0
  52. #else
  53. #define CYTHON_COMPILING_IN_PYPY 0
  54. #define CYTHON_COMPILING_IN_CPYTHON 1
  55. #endif
  56. #if CYTHON_COMPILING_IN_PYPY
  57. #define Py_OptimizeFlag 0
  58. #endif
  59. #if PY_VERSION_HEX < 0x02050000
  60. typedef int Py_ssize_t;
  61. #define PY_SSIZE_T_MAX INT_MAX
  62. #define PY_SSIZE_T_MIN INT_MIN
  63. #define PY_FORMAT_SIZE_T ""
  64. #define CYTHON_FORMAT_SSIZE_T ""
  65. #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  66. #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
  67. #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
  68. (PyErr_Format(PyExc_TypeError, \
  69. "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
  70. (PyObject*)0))
  71. #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
  72. !PyComplex_Check(o))
  73. #define PyIndex_Check __Pyx_PyIndex_Check
  74. #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  75. #define __PYX_BUILD_PY_SSIZE_T "i"
  76. #else
  77. #define __PYX_BUILD_PY_SSIZE_T "n"
  78. #define CYTHON_FORMAT_SSIZE_T "z"
  79. #define __Pyx_PyIndex_Check PyIndex_Check
  80. #endif
  81. #if PY_VERSION_HEX < 0x02060000
  82. #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  83. #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
  84. #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
  85. #define PyVarObject_HEAD_INIT(type, size) \
  86. PyObject_HEAD_INIT(type) size,
  87. #define PyType_Modified(t)
  88. typedef struct {
  89. void *buf;
  90. PyObject *obj;
  91. Py_ssize_t len;
  92. Py_ssize_t itemsize;
  93. int readonly;
  94. int ndim;
  95. char *format;
  96. Py_ssize_t *shape;
  97. Py_ssize_t *strides;
  98. Py_ssize_t *suboffsets;
  99. void *internal;
  100. } Py_buffer;
  101. #define PyBUF_SIMPLE 0
  102. #define PyBUF_WRITABLE 0x0001
  103. #define PyBUF_FORMAT 0x0004
  104. #define PyBUF_ND 0x0008
  105. #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  106. #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  107. #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  108. #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  109. #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  110. #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  111. #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  112. typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  113. typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
  114. #endif
  115. #if PY_MAJOR_VERSION < 3
  116. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  117. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  118. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  119. #define __Pyx_DefaultClassType PyClass_Type
  120. #else
  121. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  122. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  123. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  124. #define __Pyx_DefaultClassType PyType_Type
  125. #endif
  126. #if PY_VERSION_HEX < 0x02060000
  127. #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
  128. #endif
  129. #if PY_MAJOR_VERSION >= 3
  130. #define Py_TPFLAGS_CHECKTYPES 0
  131. #define Py_TPFLAGS_HAVE_INDEX 0
  132. #endif
  133. #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  134. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  135. #endif
  136. #if PY_VERSION_HEX < 0x02060000
  137. #define Py_TPFLAGS_HAVE_VERSION_TAG 0
  138. #endif
  139. #if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
  140. #define Py_TPFLAGS_IS_ABSTRACT 0
  141. #endif
  142. #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  143. #define Py_TPFLAGS_HAVE_FINALIZE 0
  144. #endif
  145. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  146. #define CYTHON_PEP393_ENABLED 1
  147. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
  148. 0 : _PyUnicode_Ready((PyObject *)(op)))
  149. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  150. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  151. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  152. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  153. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  154. #else
  155. #define CYTHON_PEP393_ENABLED 0
  156. #define __Pyx_PyUnicode_READY(op) (0)
  157. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  158. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  159. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  160. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  161. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  162. #endif
  163. #if CYTHON_COMPILING_IN_PYPY
  164. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  165. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  166. #else
  167. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  168. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
  169. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  170. #endif
  171. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  172. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  173. #if PY_MAJOR_VERSION >= 3
  174. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  175. #else
  176. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  177. #endif
  178. #if PY_MAJOR_VERSION >= 3
  179. #define PyBaseString_Type PyUnicode_Type
  180. #define PyStringObject PyUnicodeObject
  181. #define PyString_Type PyUnicode_Type
  182. #define PyString_Check PyUnicode_Check
  183. #define PyString_CheckExact PyUnicode_CheckExact
  184. #endif
  185. #if PY_VERSION_HEX < 0x02060000
  186. #define PyBytesObject PyStringObject
  187. #define PyBytes_Type PyString_Type
  188. #define PyBytes_Check PyString_Check
  189. #define PyBytes_CheckExact PyString_CheckExact
  190. #define PyBytes_FromString PyString_FromString
  191. #define PyBytes_FromStringAndSize PyString_FromStringAndSize
  192. #define PyBytes_FromFormat PyString_FromFormat
  193. #define PyBytes_DecodeEscape PyString_DecodeEscape
  194. #define PyBytes_AsString PyString_AsString
  195. #define PyBytes_AsStringAndSize PyString_AsStringAndSize
  196. #define PyBytes_Size PyString_Size
  197. #define PyBytes_AS_STRING PyString_AS_STRING
  198. #define PyBytes_GET_SIZE PyString_GET_SIZE
  199. #define PyBytes_Repr PyString_Repr
  200. #define PyBytes_Concat PyString_Concat
  201. #define PyBytes_ConcatAndDel PyString_ConcatAndDel
  202. #endif
  203. #if PY_MAJOR_VERSION >= 3
  204. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  205. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  206. #else
  207. #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
  208. PyString_Check(obj) || PyUnicode_Check(obj))
  209. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  210. #endif
  211. #if PY_VERSION_HEX < 0x02060000
  212. #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
  213. #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
  214. #endif
  215. #ifndef PySet_CheckExact
  216. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  217. #endif
  218. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  219. #if PY_MAJOR_VERSION >= 3
  220. #define PyIntObject PyLongObject
  221. #define PyInt_Type PyLong_Type
  222. #define PyInt_Check(op) PyLong_Check(op)
  223. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  224. #define PyInt_FromString PyLong_FromString
  225. #define PyInt_FromUnicode PyLong_FromUnicode
  226. #define PyInt_FromLong PyLong_FromLong
  227. #define PyInt_FromSize_t PyLong_FromSize_t
  228. #define PyInt_FromSsize_t PyLong_FromSsize_t
  229. #define PyInt_AsLong PyLong_AsLong
  230. #define PyInt_AS_LONG PyLong_AS_LONG
  231. #define PyInt_AsSsize_t PyLong_AsSsize_t
  232. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  233. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  234. #define PyNumber_Int PyNumber_Long
  235. #endif
  236. #if PY_MAJOR_VERSION >= 3
  237. #define PyBoolObject PyLongObject
  238. #endif
  239. #if PY_VERSION_HEX < 0x030200A4
  240. typedef long Py_hash_t;
  241. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  242. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  243. #else
  244. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  245. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  246. #endif
  247. #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  248. #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  249. #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  250. #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
  251. #else
  252. #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
  253. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
  254. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
  255. (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  256. #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
  257. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  258. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
  259. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  260. #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
  261. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  262. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
  263. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
  264. #endif
  265. #if PY_MAJOR_VERSION >= 3
  266. #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  267. #endif
  268. #if PY_VERSION_HEX < 0x02050000
  269. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
  270. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  271. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
  272. #else
  273. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
  274. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  275. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
  276. #endif
  277. #if PY_VERSION_HEX < 0x02050000
  278. #define __Pyx_NAMESTR(n) ((char *)(n))
  279. #define __Pyx_DOCSTR(n) ((char *)(n))
  280. #else
  281. #define __Pyx_NAMESTR(n) (n)
  282. #define __Pyx_DOCSTR(n) (n)
  283. #endif
  284. #ifndef CYTHON_INLINE
  285. #if defined(__GNUC__)
  286. #define CYTHON_INLINE __inline__
  287. #elif defined(_MSC_VER)
  288. #define CYTHON_INLINE __inline
  289. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  290. #define CYTHON_INLINE inline
  291. #else
  292. #define CYTHON_INLINE
  293. #endif
  294. #endif
  295. #ifndef CYTHON_RESTRICT
  296. #if defined(__GNUC__)
  297. #define CYTHON_RESTRICT __restrict__
  298. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  299. #define CYTHON_RESTRICT __restrict
  300. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  301. #define CYTHON_RESTRICT restrict
  302. #else
  303. #define CYTHON_RESTRICT
  304. #endif
  305. #endif
  306. #ifdef NAN
  307. #define __PYX_NAN() ((float) NAN)
  308. #else
  309. static CYTHON_INLINE float __PYX_NAN() {
  310. /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
  311. a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
  312. a quiet NaN. */
  313. float value;
  314. memset(&value, 0xFF, sizeof(value));
  315. return value;
  316. }
  317. #endif
  318. #if PY_MAJOR_VERSION >= 3
  319. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  320. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  321. #else
  322. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  323. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  324. #endif
  325. #ifndef __PYX_EXTERN_C
  326. #ifdef __cplusplus
  327. #define __PYX_EXTERN_C extern "C"
  328. #else
  329. #define __PYX_EXTERN_C extern
  330. #endif
  331. #endif
  332. #if defined(WIN32) || defined(MS_WINDOWS)
  333. #define _USE_MATH_DEFINES
  334. #endif
  335. #include <math.h>
  336. #define __PYX_HAVE__lib__Naked__toolshed__c__cstate
  337. #define __PYX_HAVE_API__lib__Naked__toolshed__c__cstate
  338. #ifdef _OPENMP
  339. #include <omp.h>
  340. #endif /* _OPENMP */
  341. #ifdef PYREX_WITHOUT_ASSERTIONS
  342. #define CYTHON_WITHOUT_ASSERTIONS
  343. #endif
  344. #ifndef CYTHON_UNUSED
  345. # if defined(__GNUC__)
  346. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  347. # define CYTHON_UNUSED __attribute__ ((__unused__))
  348. # else
  349. # define CYTHON_UNUSED
  350. # endif
  351. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  352. # define CYTHON_UNUSED __attribute__ ((__unused__))
  353. # else
  354. # define CYTHON_UNUSED
  355. # endif
  356. #endif
  357. typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
  358. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
  359. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  360. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  361. #define __PYX_DEFAULT_STRING_ENCODING ""
  362. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  363. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  364. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
  365. (sizeof(type) < sizeof(Py_ssize_t)) || \
  366. (sizeof(type) > sizeof(Py_ssize_t) && \
  367. likely(v < (type)PY_SSIZE_T_MAX || \
  368. v == (type)PY_SSIZE_T_MAX) && \
  369. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
  370. v == (type)PY_SSIZE_T_MIN))) || \
  371. (sizeof(type) == sizeof(Py_ssize_t) && \
  372. (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
  373. v == (type)PY_SSIZE_T_MAX))) )
  374. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
  375. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  376. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  377. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  378. #define __Pyx_PyBytes_FromString PyBytes_FromString
  379. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  380. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
  381. #if PY_MAJOR_VERSION < 3
  382. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  383. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  384. #else
  385. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  386. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  387. #endif
  388. #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  389. #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  390. #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
  391. #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
  392. #define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s)
  393. #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
  394. #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
  395. #if PY_MAJOR_VERSION < 3
  396. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  397. {
  398. const Py_UNICODE *u_end = u;
  399. while (*u_end++) ;
  400. return u_end - u - 1;
  401. }
  402. #else
  403. #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
  404. #endif
  405. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  406. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  407. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  408. #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
  409. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  410. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  411. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  412. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  413. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  414. #if CYTHON_COMPILING_IN_CPYTHON
  415. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  416. #else
  417. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  418. #endif
  419. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  420. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  421. static int __Pyx_sys_getdefaultencoding_not_ascii;
  422. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  423. PyObject* sys = NULL;
  424. PyObject* default_encoding = NULL;
  425. PyObject* ascii_chars_u = NULL;
  426. PyObject* ascii_chars_b = NULL;
  427. sys = PyImport_ImportModule("sys");
  428. if (sys == NULL) goto bad;
  429. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  430. if (default_encoding == NULL) goto bad;
  431. if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
  432. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  433. } else {
  434. const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
  435. char ascii_chars[128];
  436. int c;
  437. for (c = 0; c < 128; c++) {
  438. ascii_chars[c] = c;
  439. }
  440. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  441. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  442. if (ascii_chars_u == NULL) goto bad;
  443. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  444. if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  445. PyErr_Format(
  446. PyExc_ValueError,
  447. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  448. default_encoding_c);
  449. goto bad;
  450. }
  451. }
  452. Py_XDECREF(sys);
  453. Py_XDECREF(default_encoding);
  454. Py_XDECREF(ascii_chars_u);
  455. Py_XDECREF(ascii_chars_b);
  456. return 0;
  457. bad:
  458. Py_XDECREF(sys);
  459. Py_XDECREF(default_encoding);
  460. Py_XDECREF(ascii_chars_u);
  461. Py_XDECREF(ascii_chars_b);
  462. return -1;
  463. }
  464. #endif
  465. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  466. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  467. #else
  468. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  469. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  470. static char* __PYX_DEFAULT_STRING_ENCODING;
  471. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  472. PyObject* sys = NULL;
  473. PyObject* default_encoding = NULL;
  474. char* default_encoding_c;
  475. sys = PyImport_ImportModule("sys");
  476. if (sys == NULL) goto bad;
  477. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  478. if (default_encoding == NULL) goto bad;
  479. default_encoding_c = PyBytes_AS_STRING(default_encoding);
  480. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  481. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  482. Py_DECREF(sys);
  483. Py_DECREF(default_encoding);
  484. return 0;
  485. bad:
  486. Py_XDECREF(sys);
  487. Py_XDECREF(default_encoding);
  488. return -1;
  489. }
  490. #endif
  491. #endif
  492. #ifdef __GNUC__
  493. /* Test for GCC > 2.95 */
  494. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  495. #define likely(x) __builtin_expect(!!(x), 1)
  496. #define unlikely(x) __builtin_expect(!!(x), 0)
  497. #else /* __GNUC__ > 2 ... */
  498. #define likely(x) (x)
  499. #define unlikely(x) (x)
  500. #endif /* __GNUC__ > 2 ... */
  501. #else /* __GNUC__ */
  502. #define likely(x) (x)
  503. #define unlikely(x) (x)
  504. #endif /* __GNUC__ */
  505. static PyObject *__pyx_m;
  506. static PyObject *__pyx_d;
  507. static PyObject *__pyx_b;
  508. static PyObject *__pyx_empty_tuple;
  509. static PyObject *__pyx_empty_bytes;
  510. static int __pyx_lineno;
  511. static int __pyx_clineno = 0;
  512. static const char * __pyx_cfilenm= __FILE__;
  513. static const char *__pyx_filename;
  514. static const char *__pyx_f[] = {
  515. "cstate.pyx",
  516. };
  517. /*--- Type declarations ---*/
  518. #ifndef CYTHON_REFNANNY
  519. #define CYTHON_REFNANNY 0
  520. #endif
  521. #if CYTHON_REFNANNY
  522. typedef struct {
  523. void (*INCREF)(void*, PyObject*, int);
  524. void (*DECREF)(void*, PyObject*, int);
  525. void (*GOTREF)(void*, PyObject*, int);
  526. void (*GIVEREF)(void*, PyObject*, int);
  527. void* (*SetupContext)(const char*, int, const char*);
  528. void (*FinishContext)(void**);
  529. } __Pyx_RefNannyAPIStruct;
  530. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  531. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  532. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  533. #ifdef WITH_THREAD
  534. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  535. if (acquire_gil) { \
  536. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
  537. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  538. PyGILState_Release(__pyx_gilstate_save); \
  539. } else { \
  540. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  541. }
  542. #else
  543. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  544. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  545. #endif
  546. #define __Pyx_RefNannyFinishContext() \
  547. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  548. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  549. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  550. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  551. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  552. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  553. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  554. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  555. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  556. #else
  557. #define __Pyx_RefNannyDeclarations
  558. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  559. #define __Pyx_RefNannyFinishContext()
  560. #define __Pyx_INCREF(r) Py_INCREF(r)
  561. #define __Pyx_DECREF(r) Py_DECREF(r)
  562. #define __Pyx_GOTREF(r)
  563. #define __Pyx_GIVEREF(r)
  564. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  565. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  566. #define __Pyx_XGOTREF(r)
  567. #define __Pyx_XGIVEREF(r)
  568. #endif /* CYTHON_REFNANNY */
  569. #define __Pyx_XDECREF_SET(r, v) do { \
  570. PyObject *tmp = (PyObject *) r; \
  571. r = v; __Pyx_XDECREF(tmp); \
  572. } while (0)
  573. #define __Pyx_DECREF_SET(r, v) do { \
  574. PyObject *tmp = (PyObject *) r; \
  575. r = v; __Pyx_DECREF(tmp); \
  576. } while (0)
  577. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  578. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  579. #if CYTHON_COMPILING_IN_CPYTHON
  580. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  581. PyTypeObject* tp = Py_TYPE(obj);
  582. if (likely(tp->tp_getattro))
  583. return tp->tp_getattro(obj, attr_name);
  584. #if PY_MAJOR_VERSION < 3
  585. if (likely(tp->tp_getattr))
  586. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  587. #endif
  588. return PyObject_GetAttr(obj, attr_name);
  589. }
  590. #else
  591. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  592. #endif
  593. static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
  594. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
  595. #if CYTHON_COMPILING_IN_CPYTHON
  596. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
  597. #else
  598. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  599. #endif
  600. #if CYTHON_COMPILING_IN_CPYTHON
  601. #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
  602. static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
  603. PyTypeObject* tp = Py_TYPE(obj);
  604. if (likely(tp->tp_setattro))
  605. return tp->tp_setattro(obj, attr_name, value);
  606. #if PY_MAJOR_VERSION < 3
  607. if (likely(tp->tp_setattr))
  608. return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
  609. #endif
  610. return PyObject_SetAttr(obj, attr_name, value);
  611. }
  612. #else
  613. #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
  614. #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
  615. #endif
  616. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
  617. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  618. #define __Pyx_CyFunction_USED 1
  619. #include <structmember.h>
  620. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  621. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  622. #define __Pyx_CYFUNCTION_CCLASS 0x04
  623. #define __Pyx_CyFunction_GetClosure(f) \
  624. (((__pyx_CyFunctionObject *) (f))->func_closure)
  625. #define __Pyx_CyFunction_GetClassObj(f) \
  626. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  627. #define __Pyx_CyFunction_Defaults(type, f) \
  628. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  629. #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
  630. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  631. typedef struct {
  632. PyCFunctionObject func;
  633. PyObject *func_dict;
  634. PyObject *func_weakreflist;
  635. PyObject *func_name;
  636. PyObject *func_qualname;
  637. PyObject *func_doc;
  638. PyObject *func_globals;
  639. PyObject *func_code;
  640. PyObject *func_closure;
  641. PyObject *func_classobj; /* No-args super() class cell */
  642. void *defaults;
  643. int defaults_pyobjects;
  644. int flags;
  645. PyObject *defaults_tuple; /* Const defaults tuple */
  646. PyObject *defaults_kwdict; /* Const kwonly defaults dict */
  647. PyObject *(*defaults_getter)(PyObject *);
  648. PyObject *func_annotations; /* function annotations dict */
  649. } __pyx_CyFunctionObject;
  650. static PyTypeObject *__pyx_CyFunctionType = 0;
  651. #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
  652. __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
  653. static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
  654. int flags, PyObject* qualname,
  655. PyObject *self,
  656. PyObject *module, PyObject *globals,
  657. PyObject* code);
  658. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  659. size_t size,
  660. int pyobjects);
  661. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  662. PyObject *tuple);
  663. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  664. PyObject *dict);
  665. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  666. PyObject *dict);
  667. static int __Pyx_CyFunction_init(void);
  668. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
  669. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
  670. PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/
  671. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
  672. PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /*proto*/
  673. #include <string.h>
  674. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  675. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  676. #if PY_MAJOR_VERSION >= 3
  677. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  678. #else
  679. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  680. #endif
  681. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
  682. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  683. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  684. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  685. static int __Pyx_check_binary_version(void);
  686. typedef struct {
  687. int code_line;
  688. PyCodeObject* code_object;
  689. } __Pyx_CodeObjectCacheEntry;
  690. struct __Pyx_CodeObjectCache {
  691. int count;
  692. int max_count;
  693. __Pyx_CodeObjectCacheEntry* entries;
  694. };
  695. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  696. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  697. static PyCodeObject *__pyx_find_code_object(int code_line);
  698. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  699. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  700. int py_line, const char *filename); /*proto*/
  701. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  702. /* Module declarations from 'lib.Naked.toolshed.c.cstate' */
  703. #define __Pyx_MODULE_NAME "lib.Naked.toolshed.c.cstate"
  704. int __pyx_module_is_main_lib__Naked__toolshed__c__cstate = 0;
  705. /* Implementation of 'lib.Naked.toolshed.c.cstate' */
  706. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_6cstate_11StateObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  707. static char __pyx_k_[] = "~";
  708. static char __pyx_k__3[] = "*";
  709. static char __pyx_k_os[] = "os";
  710. static char __pyx_k_py[] = "py";
  711. static char __pyx_k_cwd[] = "cwd";
  712. static char __pyx_k_day[] = "day";
  713. static char __pyx_k_doc[] = "__doc__";
  714. static char __pyx_k_min[] = "min";
  715. static char __pyx_k_now[] = "now";
  716. static char __pyx_k_py2[] = "py2";
  717. static char __pyx_k_py3[] = "py3";
  718. static char __pyx_k_sys[] = "sys";
  719. static char __pyx_k_hour[] = "hour";
  720. static char __pyx_k_init[] = "__init__";
  721. static char __pyx_k_main[] = "__main__";
  722. static char __pyx_k_name[] = "__name__";
  723. static char __pyx_k_path[] = "path";
  724. static char __pyx_k_self[] = "self";
  725. static char __pyx_k_test[] = "__test__";
  726. static char __pyx_k_year[] = "year";
  727. static char __pyx_k_debug[] = "debug";
  728. static char __pyx_k_month[] = "month";
  729. static char __pyx_k_import[] = "__import__";
  730. static char __pyx_k_is_py2[] = "is_py2";
  731. static char __pyx_k_is_py3[] = "is_py3";
  732. static char __pyx_k_minute[] = "minute";
  733. static char __pyx_k_module[] = "__module__";
  734. static char __pyx_k_pardir[] = "pardir";
  735. static char __pyx_k_second[] = "second";
  736. static char __pyx_k_defpath[] = "defpath";
  737. static char __pyx_k_prepare[] = "__prepare__";
  738. static char __pyx_k_datetime[] = "datetime";
  739. static char __pyx_k_platform[] = "platform";
  740. static char __pyx_k_py_major[] = "py_major";
  741. static char __pyx_k_py_minor[] = "py_minor";
  742. static char __pyx_k_py_patch[] = "py_patch";
  743. static char __pyx_k_qualname[] = "__qualname__";
  744. static char __pyx_k_metaclass[] = "__metaclass__";
  745. static char __pyx_k_user_path[] = "user_path";
  746. static char __pyx_k_DEBUG_FLAG[] = "DEBUG_FLAG";
  747. static char __pyx_k_expanduser[] = "expanduser";
  748. static char __pyx_k_parent_dir[] = "parent_dir";
  749. static char __pyx_k_StateObject[] = "StateObject";
  750. static char __pyx_k_default_path[] = "default_path";
  751. static char __pyx_k_file_encoding[] = "file_encoding";
  752. static char __pyx_k_Naked_settings[] = "Naked.settings";
  753. static char __pyx_k_string_encoding[] = "string_encoding";
  754. static char __pyx_k_py_major_version[] = "py_major_version";
  755. static char __pyx_k_py_minor_version[] = "py_minor_version";
  756. static char __pyx_k_py_patch_version[] = "py_patch_version";
  757. static char __pyx_k_StateObject___init[] = "StateObject.__init__";
  758. static char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
  759. static char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
  760. static char __pyx_k_Naked_toolshed_c_python[] = "Naked.toolshed.c.python";
  761. static char __pyx_k_Naked_toolshed_c_system[] = "Naked.toolshed.c.system";
  762. static char __pyx_k_lib_Naked_toolshed_c_cstate[] = "lib.Naked.toolshed.c.cstate";
  763. static char __pyx_k_Users_ces_Desktop_code_naked_li[] = "/Users/ces/Desktop/code/naked/lib/Naked/toolshed/c/cstate.pyx";
  764. static PyObject *__pyx_kp_s_;
  765. static PyObject *__pyx_n_s_DEBUG_FLAG;
  766. static PyObject *__pyx_n_s_Naked_settings;
  767. static PyObject *__pyx_n_s_Naked_toolshed_c_python;
  768. static PyObject *__pyx_n_s_Naked_toolshed_c_system;
  769. static PyObject *__pyx_n_s_StateObject;
  770. static PyObject *__pyx_n_s_StateObject___init;
  771. static PyObject *__pyx_kp_s_Users_ces_Desktop_code_naked_li;
  772. static PyObject *__pyx_n_s__3;
  773. static PyObject *__pyx_n_s_cwd;
  774. static PyObject *__pyx_n_s_datetime;
  775. static PyObject *__pyx_n_s_day;
  776. static PyObject *__pyx_n_s_debug;
  777. static PyObject *__pyx_n_s_default_path;
  778. static PyObject *__pyx_n_s_defpath;
  779. static PyObject *__pyx_n_s_doc;
  780. static PyObject *__pyx_n_s_expanduser;
  781. static PyObject *__pyx_n_s_file_encoding;
  782. static PyObject *__pyx_n_s_getdefaultencoding;
  783. static PyObject *__pyx_n_s_getfilesystemencoding;
  784. static PyObject *__pyx_n_s_hour;
  785. static PyObject *__pyx_n_s_import;
  786. static PyObject *__pyx_n_s_init;
  787. static PyObject *__pyx_n_s_is_py2;
  788. static PyObject *__pyx_n_s_is_py3;
  789. static PyObject *__pyx_n_s_lib_Naked_toolshed_c_cstate;
  790. static PyObject *__pyx_n_s_main;
  791. static PyObject *__pyx_n_s_metaclass;
  792. static PyObject *__pyx_n_s_min;
  793. static PyObject *__pyx_n_s_minute;
  794. static PyObject *__pyx_n_s_module;
  795. static PyObject *__pyx_n_s_month;
  796. static PyObject *__pyx_n_s_name;
  797. static PyObject *__pyx_n_s_now;
  798. static PyObject *__pyx_n_s_os;
  799. static PyObject *__pyx_n_s_pardir;
  800. static PyObject *__pyx_n_s_parent_dir;
  801. static PyObject *__pyx_n_s_path;
  802. static PyObject *__pyx_n_s_platform;
  803. static PyObject *__pyx_n_s_prepare;
  804. static PyObject *__pyx_n_s_py;
  805. static PyObject *__pyx_n_s_py2;
  806. static PyObject *__pyx_n_s_py3;
  807. static PyObject *__pyx_n_s_py_major;
  808. static PyObject *__pyx_n_s_py_major_version;
  809. static PyObject *__pyx_n_s_py_minor;
  810. static PyObject *__pyx_n_s_py_minor_version;
  811. static PyObject *__pyx_n_s_py_patch;
  812. static PyObject *__pyx_n_s_py_patch_version;
  813. static PyObject *__pyx_n_s_qualname;
  814. static PyObject *__pyx_n_s_second;
  815. static PyObject *__pyx_n_s_self;
  816. static PyObject *__pyx_n_s_string_encoding;
  817. static PyObject *__pyx_n_s_sys;
  818. static PyObject *__pyx_n_s_test;
  819. static PyObject *__pyx_n_s_user_path;
  820. static PyObject *__pyx_n_s_year;
  821. static PyObject *__pyx_tuple__2;
  822. static PyObject *__pyx_tuple__4;
  823. static PyObject *__pyx_codeobj__5;
  824. /* "lib/Naked/toolshed/c/cstate.pyx":13
  825. *
  826. * class StateObject:
  827. * def __init__(self): # <<<<<<<<<<<<<<
  828. * now = datetime.datetime.now()
  829. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  830. */
  831. /* Python wrapper */
  832. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_6cstate_11StateObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  833. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_6cstate_11StateObject_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_6cstate_11StateObject_1__init__, METH_O, __Pyx_DOCSTR(0)};
  834. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_6cstate_11StateObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  835. PyObject *__pyx_r = 0;
  836. __Pyx_RefNannyDeclarations
  837. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  838. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_6cstate_11StateObject___init__(__pyx_self, ((PyObject *)__pyx_v_self));
  839. /* function exit code */
  840. __Pyx_RefNannyFinishContext();
  841. return __pyx_r;
  842. }
  843. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_6cstate_11StateObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  844. PyObject *__pyx_v_now = NULL;
  845. PyObject *__pyx_r = NULL;
  846. __Pyx_RefNannyDeclarations
  847. PyObject *__pyx_t_1 = NULL;
  848. PyObject *__pyx_t_2 = NULL;
  849. int __pyx_lineno = 0;
  850. const char *__pyx_filename = NULL;
  851. int __pyx_clineno = 0;
  852. __Pyx_RefNannySetupContext("__init__", 0);
  853. /* "lib/Naked/toolshed/c/cstate.pyx":14
  854. * class StateObject:
  855. * def __init__(self):
  856. * now = datetime.datetime.now() # <<<<<<<<<<<<<<
  857. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  858. * self.py3 = py.is_py3() #truth test Python 3 interpreter
  859. */
  860. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  861. __Pyx_GOTREF(__pyx_t_1);
  862. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  863. __Pyx_GOTREF(__pyx_t_2);
  864. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  865. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_now); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  866. __Pyx_GOTREF(__pyx_t_1);
  867. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  868. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  869. __Pyx_GOTREF(__pyx_t_2);
  870. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  871. __pyx_v_now = __pyx_t_2;
  872. __pyx_t_2 = 0;
  873. /* "lib/Naked/toolshed/c/cstate.pyx":15
  874. * def __init__(self):
  875. * now = datetime.datetime.now()
  876. * self.py2 = py.is_py2() #truth test Python 2 interpreter # <<<<<<<<<<<<<<
  877. * self.py3 = py.is_py3() #truth test Python 3 interpreter
  878. * self.py_major = py.py_major_version() #Python major version
  879. */
  880. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  881. __Pyx_GOTREF(__pyx_t_2);
  882. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_py2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  883. __Pyx_GOTREF(__pyx_t_1);
  884. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  885. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  886. __Pyx_GOTREF(__pyx_t_2);
  887. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  888. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_py2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  889. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  890. /* "lib/Naked/toolshed/c/cstate.pyx":16
  891. * now = datetime.datetime.now()
  892. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  893. * self.py3 = py.is_py3() #truth test Python 3 interpreter # <<<<<<<<<<<<<<
  894. * self.py_major = py.py_major_version() #Python major version
  895. * self.py_minor = py.py_minor_version() #Python minor version
  896. */
  897. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  898. __Pyx_GOTREF(__pyx_t_2);
  899. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_py3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  900. __Pyx_GOTREF(__pyx_t_1);
  901. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  902. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  903. __Pyx_GOTREF(__pyx_t_2);
  904. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  905. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_py3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  906. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  907. /* "lib/Naked/toolshed/c/cstate.pyx":17
  908. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  909. * self.py3 = py.is_py3() #truth test Python 3 interpreter
  910. * self.py_major = py.py_major_version() #Python major version # <<<<<<<<<<<<<<
  911. * self.py_minor = py.py_minor_version() #Python minor version
  912. * self.py_patch = py.py_patch_version() #Python patch version
  913. */
  914. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  915. __Pyx_GOTREF(__pyx_t_2);
  916. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_py_major_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  917. __Pyx_GOTREF(__pyx_t_1);
  918. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  919. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  920. __Pyx_GOTREF(__pyx_t_2);
  921. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  922. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_py_major, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  923. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  924. /* "lib/Naked/toolshed/c/cstate.pyx":18
  925. * self.py3 = py.is_py3() #truth test Python 3 interpreter
  926. * self.py_major = py.py_major_version() #Python major version
  927. * self.py_minor = py.py_minor_version() #Python minor version # <<<<<<<<<<<<<<
  928. * self.py_patch = py.py_patch_version() #Python patch version
  929. * self.os = sys.platform #user operating system
  930. */
  931. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  932. __Pyx_GOTREF(__pyx_t_2);
  933. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_py_minor_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  934. __Pyx_GOTREF(__pyx_t_1);
  935. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  936. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  937. __Pyx_GOTREF(__pyx_t_2);
  938. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  939. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_py_minor, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  940. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  941. /* "lib/Naked/toolshed/c/cstate.pyx":19
  942. * self.py_major = py.py_major_version() #Python major version
  943. * self.py_minor = py.py_minor_version() #Python minor version
  944. * self.py_patch = py.py_patch_version() #Python patch version # <<<<<<<<<<<<<<
  945. * self.os = sys.platform #user operating system
  946. * self.cwd = cwd() #current (present) working directory
  947. */
  948. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_py); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  949. __Pyx_GOTREF(__pyx_t_2);
  950. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_py_patch_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  951. __Pyx_GOTREF(__pyx_t_1);
  952. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  953. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  954. __Pyx_GOTREF(__pyx_t_2);
  955. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  956. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_py_patch, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  957. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  958. /* "lib/Naked/toolshed/c/cstate.pyx":20
  959. * self.py_minor = py.py_minor_version() #Python minor version
  960. * self.py_patch = py.py_patch_version() #Python patch version
  961. * self.os = sys.platform #user operating system # <<<<<<<<<<<<<<
  962. * self.cwd = cwd() #current (present) working directory
  963. * self.parent_dir = os.pardir
  964. */
  965. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  966. __Pyx_GOTREF(__pyx_t_2);
  967. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  968. __Pyx_GOTREF(__pyx_t_1);
  969. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  970. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  971. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  972. /* "lib/Naked/toolshed/c/cstate.pyx":21
  973. * self.py_patch = py.py_patch_version() #Python patch version
  974. * self.os = sys.platform #user operating system
  975. * self.cwd = cwd() #current (present) working directory # <<<<<<<<<<<<<<
  976. * self.parent_dir = os.pardir
  977. * self.default_path = os.defpath
  978. */
  979. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_cwd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  980. __Pyx_GOTREF(__pyx_t_1);
  981. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  982. __Pyx_GOTREF(__pyx_t_2);
  983. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  984. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cwd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  985. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  986. /* "lib/Naked/toolshed/c/cstate.pyx":22
  987. * self.os = sys.platform #user operating system
  988. * self.cwd = cwd() #current (present) working directory
  989. * self.parent_dir = os.pardir # <<<<<<<<<<<<<<
  990. * self.default_path = os.defpath
  991. * self.user_path = os.path.expanduser("~")
  992. */
  993. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  994. __Pyx_GOTREF(__pyx_t_2);
  995. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pardir); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  996. __Pyx_GOTREF(__pyx_t_1);
  997. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  998. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_parent_dir, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  999. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1000. /* "lib/Naked/toolshed/c/cstate.pyx":23
  1001. * self.cwd = cwd() #current (present) working directory
  1002. * self.parent_dir = os.pardir
  1003. * self.default_path = os.defpath # <<<<<<<<<<<<<<
  1004. * self.user_path = os.path.expanduser("~")
  1005. * self.string_encoding = sys.getdefaultencoding()
  1006. */
  1007. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1008. __Pyx_GOTREF(__pyx_t_1);
  1009. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_defpath); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1010. __Pyx_GOTREF(__pyx_t_2);
  1011. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1012. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_path, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1013. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1014. /* "lib/Naked/toolshed/c/cstate.pyx":24
  1015. * self.parent_dir = os.pardir
  1016. * self.default_path = os.defpath
  1017. * self.user_path = os.path.expanduser("~") # <<<<<<<<<<<<<<
  1018. * self.string_encoding = sys.getdefaultencoding()
  1019. * self.file_encoding = sys.getfilesystemencoding()
  1020. */
  1021. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1022. __Pyx_GOTREF(__pyx_t_2);
  1023. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1024. __Pyx_GOTREF(__pyx_t_1);
  1025. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1026. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1027. __Pyx_GOTREF(__pyx_t_2);
  1028. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1029. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1030. __Pyx_GOTREF(__pyx_t_1);
  1031. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1032. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_user_path, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1033. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1034. /* "lib/Naked/toolshed/c/cstate.pyx":25
  1035. * self.default_path = os.defpath
  1036. * self.user_path = os.path.expanduser("~")
  1037. * self.string_encoding = sys.getdefaultencoding() # <<<<<<<<<<<<<<
  1038. * self.file_encoding = sys.getfilesystemencoding()
  1039. * self.hour = now.hour
  1040. */
  1041. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1042. __Pyx_GOTREF(__pyx_t_1);
  1043. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getdefaultencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1044. __Pyx_GOTREF(__pyx_t_2);
  1045. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1046. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1047. __Pyx_GOTREF(__pyx_t_1);
  1048. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1049. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_string_encoding, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1050. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1051. /* "lib/Naked/toolshed/c/cstate.pyx":26
  1052. * self.user_path = os.path.expanduser("~")
  1053. * self.string_encoding = sys.getdefaultencoding()
  1054. * self.file_encoding = sys.getfilesystemencoding() # <<<<<<<<<<<<<<
  1055. * self.hour = now.hour
  1056. * self.min = now.minute
  1057. */
  1058. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1059. __Pyx_GOTREF(__pyx_t_1);
  1060. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1061. __Pyx_GOTREF(__pyx_t_2);
  1062. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1063. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1064. __Pyx_GOTREF(__pyx_t_1);
  1065. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1066. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_encoding, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1067. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1068. /* "lib/Naked/toolshed/c/cstate.pyx":27
  1069. * self.string_encoding = sys.getdefaultencoding()
  1070. * self.file_encoding = sys.getfilesystemencoding()
  1071. * self.hour = now.hour # <<<<<<<<<<<<<<
  1072. * self.min = now.minute
  1073. * self.year = now.year
  1074. */
  1075. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_hour); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1076. __Pyx_GOTREF(__pyx_t_1);
  1077. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_hour, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1078. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1079. /* "lib/Naked/toolshed/c/cstate.pyx":28
  1080. * self.file_encoding = sys.getfilesystemencoding()
  1081. * self.hour = now.hour
  1082. * self.min = now.minute # <<<<<<<<<<<<<<
  1083. * self.year = now.year
  1084. * self.day = now.day
  1085. */
  1086. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_minute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1087. __Pyx_GOTREF(__pyx_t_1);
  1088. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1089. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1090. /* "lib/Naked/toolshed/c/cstate.pyx":29
  1091. * self.hour = now.hour
  1092. * self.min = now.minute
  1093. * self.year = now.year # <<<<<<<<<<<<<<
  1094. * self.day = now.day
  1095. * self.month = now.month
  1096. */
  1097. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_year); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1098. __Pyx_GOTREF(__pyx_t_1);
  1099. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_year, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1100. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1101. /* "lib/Naked/toolshed/c/cstate.pyx":30
  1102. * self.min = now.minute
  1103. * self.year = now.year
  1104. * self.day = now.day # <<<<<<<<<<<<<<
  1105. * self.month = now.month
  1106. * self.second = now.second
  1107. */
  1108. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_day); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1109. __Pyx_GOTREF(__pyx_t_1);
  1110. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_day, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1111. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1112. /* "lib/Naked/toolshed/c/cstate.pyx":31
  1113. * self.year = now.year
  1114. * self.day = now.day
  1115. * self.month = now.month # <<<<<<<<<<<<<<
  1116. * self.second = now.second
  1117. *
  1118. */
  1119. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_month); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1120. __Pyx_GOTREF(__pyx_t_1);
  1121. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_month, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1122. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1123. /* "lib/Naked/toolshed/c/cstate.pyx":32
  1124. * self.day = now.day
  1125. * self.month = now.month
  1126. * self.second = now.second # <<<<<<<<<<<<<<
  1127. *
  1128. * if __name__ == '__main__':
  1129. */
  1130. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_second); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1131. __Pyx_GOTREF(__pyx_t_1);
  1132. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_second, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1133. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1134. /* "lib/Naked/toolshed/c/cstate.pyx":13
  1135. *
  1136. * class StateObject:
  1137. * def __init__(self): # <<<<<<<<<<<<<<
  1138. * now = datetime.datetime.now()
  1139. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  1140. */
  1141. /* function exit code */
  1142. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1143. goto __pyx_L0;
  1144. __pyx_L1_error:;
  1145. __Pyx_XDECREF(__pyx_t_1);
  1146. __Pyx_XDECREF(__pyx_t_2);
  1147. __Pyx_AddTraceback("lib.Naked.toolshed.c.cstate.StateObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1148. __pyx_r = NULL;
  1149. __pyx_L0:;
  1150. __Pyx_XDECREF(__pyx_v_now);
  1151. __Pyx_XGIVEREF(__pyx_r);
  1152. __Pyx_RefNannyFinishContext();
  1153. return __pyx_r;
  1154. }
  1155. static PyMethodDef __pyx_methods[] = {
  1156. {0, 0, 0, 0}
  1157. };
  1158. #if PY_MAJOR_VERSION >= 3
  1159. static struct PyModuleDef __pyx_moduledef = {
  1160. #if PY_VERSION_HEX < 0x03020000
  1161. { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  1162. #else
  1163. PyModuleDef_HEAD_INIT,
  1164. #endif
  1165. __Pyx_NAMESTR("cstate"),
  1166. 0, /* m_doc */
  1167. -1, /* m_size */
  1168. __pyx_methods /* m_methods */,
  1169. NULL, /* m_reload */
  1170. NULL, /* m_traverse */
  1171. NULL, /* m_clear */
  1172. NULL /* m_free */
  1173. };
  1174. #endif
  1175. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  1176. {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  1177. {&__pyx_n_s_DEBUG_FLAG, __pyx_k_DEBUG_FLAG, sizeof(__pyx_k_DEBUG_FLAG), 0, 0, 1, 1},
  1178. {&__pyx_n_s_Naked_settings, __pyx_k_Naked_settings, sizeof(__pyx_k_Naked_settings), 0, 0, 1, 1},
  1179. {&__pyx_n_s_Naked_toolshed_c_python, __pyx_k_Naked_toolshed_c_python, sizeof(__pyx_k_Naked_toolshed_c_python), 0, 0, 1, 1},
  1180. {&__pyx_n_s_Naked_toolshed_c_system, __pyx_k_Naked_toolshed_c_system, sizeof(__pyx_k_Naked_toolshed_c_system), 0, 0, 1, 1},
  1181. {&__pyx_n_s_StateObject, __pyx_k_StateObject, sizeof(__pyx_k_StateObject), 0, 0, 1, 1},
  1182. {&__pyx_n_s_StateObject___init, __pyx_k_StateObject___init, sizeof(__pyx_k_StateObject___init), 0, 0, 1, 1},
  1183. {&__pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_k_Users_ces_Desktop_code_naked_li, sizeof(__pyx_k_Users_ces_Desktop_code_naked_li), 0, 0, 1, 0},
  1184. {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1},
  1185. {&__pyx_n_s_cwd, __pyx_k_cwd, sizeof(__pyx_k_cwd), 0, 0, 1, 1},
  1186. {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
  1187. {&__pyx_n_s_day, __pyx_k_day, sizeof(__pyx_k_day), 0, 0, 1, 1},
  1188. {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  1189. {&__pyx_n_s_default_path, __pyx_k_default_path, sizeof(__pyx_k_default_path), 0, 0, 1, 1},
  1190. {&__pyx_n_s_defpath, __pyx_k_defpath, sizeof(__pyx_k_defpath), 0, 0, 1, 1},
  1191. {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  1192. {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1},
  1193. {&__pyx_n_s_file_encoding, __pyx_k_file_encoding, sizeof(__pyx_k_file_encoding), 0, 0, 1, 1},
  1194. {&__pyx_n_s_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 0, 0, 1, 1},
  1195. {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
  1196. {&__pyx_n_s_hour, __pyx_k_hour, sizeof(__pyx_k_hour), 0, 0, 1, 1},
  1197. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  1198. {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  1199. {&__pyx_n_s_is_py2, __pyx_k_is_py2, sizeof(__pyx_k_is_py2), 0, 0, 1, 1},
  1200. {&__pyx_n_s_is_py3, __pyx_k_is_py3, sizeof(__pyx_k_is_py3), 0, 0, 1, 1},
  1201. {&__pyx_n_s_lib_Naked_toolshed_c_cstate, __pyx_k_lib_Naked_toolshed_c_cstate, sizeof(__pyx_k_lib_Naked_toolshed_c_cstate), 0, 0, 1, 1},
  1202. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  1203. {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  1204. {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  1205. {&__pyx_n_s_minute, __pyx_k_minute, sizeof(__pyx_k_minute), 0, 0, 1, 1},
  1206. {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  1207. {&__pyx_n_s_month, __pyx_k_month, sizeof(__pyx_k_month), 0, 0, 1, 1},
  1208. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  1209. {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  1210. {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  1211. {&__pyx_n_s_pardir, __pyx_k_pardir, sizeof(__pyx_k_pardir), 0, 0, 1, 1},
  1212. {&__pyx_n_s_parent_dir, __pyx_k_parent_dir, sizeof(__pyx_k_parent_dir), 0, 0, 1, 1},
  1213. {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  1214. {&__pyx_n_s_platform, __pyx_k_platform, sizeof(__pyx_k_platform), 0, 0, 1, 1},
  1215. {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  1216. {&__pyx_n_s_py, __pyx_k_py, sizeof(__pyx_k_py), 0, 0, 1, 1},
  1217. {&__pyx_n_s_py2, __pyx_k_py2, sizeof(__pyx_k_py2), 0, 0, 1, 1},
  1218. {&__pyx_n_s_py3, __pyx_k_py3, sizeof(__pyx_k_py3), 0, 0, 1, 1},
  1219. {&__pyx_n_s_py_major, __pyx_k_py_major, sizeof(__pyx_k_py_major), 0, 0, 1, 1},
  1220. {&__pyx_n_s_py_major_version, __pyx_k_py_major_version, sizeof(__pyx_k_py_major_version), 0, 0, 1, 1},
  1221. {&__pyx_n_s_py_minor, __pyx_k_py_minor, sizeof(__pyx_k_py_minor), 0, 0, 1, 1},
  1222. {&__pyx_n_s_py_minor_version, __pyx_k_py_minor_version, sizeof(__pyx_k_py_minor_version), 0, 0, 1, 1},
  1223. {&__pyx_n_s_py_patch, __pyx_k_py_patch, sizeof(__pyx_k_py_patch), 0, 0, 1, 1},
  1224. {&__pyx_n_s_py_patch_version, __pyx_k_py_patch_version, sizeof(__pyx_k_py_patch_version), 0, 0, 1, 1},
  1225. {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  1226. {&__pyx_n_s_second, __pyx_k_second, sizeof(__pyx_k_second), 0, 0, 1, 1},
  1227. {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  1228. {&__pyx_n_s_string_encoding, __pyx_k_string_encoding, sizeof(__pyx_k_string_encoding), 0, 0, 1, 1},
  1229. {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  1230. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  1231. {&__pyx_n_s_user_path, __pyx_k_user_path, sizeof(__pyx_k_user_path), 0, 0, 1, 1},
  1232. {&__pyx_n_s_year, __pyx_k_year, sizeof(__pyx_k_year), 0, 0, 1, 1},
  1233. {0, 0, 0, 0, 0, 0, 0}
  1234. };
  1235. static int __Pyx_InitCachedBuiltins(void) {
  1236. return 0;
  1237. }
  1238. static int __Pyx_InitCachedConstants(void) {
  1239. __Pyx_RefNannyDeclarations
  1240. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  1241. /* "lib/Naked/toolshed/c/cstate.pyx":24
  1242. * self.parent_dir = os.pardir
  1243. * self.default_path = os.defpath
  1244. * self.user_path = os.path.expanduser("~") # <<<<<<<<<<<<<<
  1245. * self.string_encoding = sys.getdefaultencoding()
  1246. * self.file_encoding = sys.getfilesystemencoding()
  1247. */
  1248. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1249. __Pyx_GOTREF(__pyx_tuple__2);
  1250. __Pyx_GIVEREF(__pyx_tuple__2);
  1251. /* "lib/Naked/toolshed/c/cstate.pyx":13
  1252. *
  1253. * class StateObject:
  1254. * def __init__(self): # <<<<<<<<<<<<<<
  1255. * now = datetime.datetime.now()
  1256. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  1257. */
  1258. __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_now); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1259. __Pyx_GOTREF(__pyx_tuple__4);
  1260. __Pyx_GIVEREF(__pyx_tuple__4);
  1261. __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_init, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1262. __Pyx_RefNannyFinishContext();
  1263. return 0;
  1264. __pyx_L1_error:;
  1265. __Pyx_RefNannyFinishContext();
  1266. return -1;
  1267. }
  1268. static int __Pyx_InitGlobals(void) {
  1269. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1270. return 0;
  1271. __pyx_L1_error:;
  1272. return -1;
  1273. }
  1274. #if PY_MAJOR_VERSION < 3
  1275. PyMODINIT_FUNC initcstate(void); /*proto*/
  1276. PyMODINIT_FUNC initcstate(void)
  1277. #else
  1278. PyMODINIT_FUNC PyInit_cstate(void); /*proto*/
  1279. PyMODINIT_FUNC PyInit_cstate(void)
  1280. #endif
  1281. {
  1282. PyObject *__pyx_t_1 = NULL;
  1283. PyObject *__pyx_t_2 = NULL;
  1284. int __pyx_t_3;
  1285. int __pyx_lineno = 0;
  1286. const char *__pyx_filename = NULL;
  1287. int __pyx_clineno = 0;
  1288. __Pyx_RefNannyDeclarations
  1289. #if CYTHON_REFNANNY
  1290. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  1291. if (!__Pyx_RefNanny) {
  1292. PyErr_Clear();
  1293. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  1294. if (!__Pyx_RefNanny)
  1295. Py_FatalError("failed to import 'refnanny' module");
  1296. }
  1297. #endif
  1298. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cstate(void)", 0);
  1299. if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1300. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1301. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1302. #ifdef __Pyx_CyFunction_USED
  1303. if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1304. #endif
  1305. #ifdef __Pyx_FusedFunction_USED
  1306. if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1307. #endif
  1308. #ifdef __Pyx_Generator_USED
  1309. if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1310. #endif
  1311. /*--- Library function declarations ---*/
  1312. /*--- Threads initialization code ---*/
  1313. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  1314. #ifdef WITH_THREAD /* Python build with threading support? */
  1315. PyEval_InitThreads();
  1316. #endif
  1317. #endif
  1318. /*--- Module creation code ---*/
  1319. #if PY_MAJOR_VERSION < 3
  1320. __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cstate"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  1321. #else
  1322. __pyx_m = PyModule_Create(&__pyx_moduledef);
  1323. #endif
  1324. if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1325. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1326. Py_INCREF(__pyx_d);
  1327. __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1328. #if CYTHON_COMPILING_IN_PYPY
  1329. Py_INCREF(__pyx_b);
  1330. #endif
  1331. if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1332. /*--- Initialize various global constants etc. ---*/
  1333. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1334. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  1335. if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1336. #endif
  1337. if (__pyx_module_is_main_lib__Naked__toolshed__c__cstate) {
  1338. if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1339. }
  1340. #if PY_MAJOR_VERSION >= 3
  1341. {
  1342. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1343. if (!PyDict_GetItemString(modules, "lib.Naked.toolshed.c.cstate")) {
  1344. if (unlikely(PyDict_SetItemString(modules, "lib.Naked.toolshed.c.cstate", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1345. }
  1346. }
  1347. #endif
  1348. /*--- Builtin init code ---*/
  1349. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1350. /*--- Constants init code ---*/
  1351. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1352. /*--- Global init code ---*/
  1353. /*--- Variable export code ---*/
  1354. /*--- Function export code ---*/
  1355. /*--- Type init code ---*/
  1356. /*--- Type import code ---*/
  1357. /*--- Variable import code ---*/
  1358. /*--- Function import code ---*/
  1359. /*--- Execution code ---*/
  1360. /* "lib/Naked/toolshed/c/cstate.pyx":5
  1361. * # cython: profile=False
  1362. *
  1363. * from Naked.settings import debug as DEBUG_FLAG # <<<<<<<<<<<<<<
  1364. * from Naked.toolshed.c.system import cwd
  1365. * import Naked.toolshed.c.python as py
  1366. */
  1367. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1368. __Pyx_GOTREF(__pyx_t_1);
  1369. __Pyx_INCREF(__pyx_n_s_debug);
  1370. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_debug);
  1371. __Pyx_GIVEREF(__pyx_n_s_debug);
  1372. __pyx_t_2 = __Pyx_Import(__pyx_n_s_Naked_settings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1373. __Pyx_GOTREF(__pyx_t_2);
  1374. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1375. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1376. __Pyx_GOTREF(__pyx_t_1);
  1377. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_FLAG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1378. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1379. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1380. /* "lib/Naked/toolshed/c/cstate.pyx":6
  1381. *
  1382. * from Naked.settings import debug as DEBUG_FLAG
  1383. * from Naked.toolshed.c.system import cwd # <<<<<<<<<<<<<<
  1384. * import Naked.toolshed.c.python as py
  1385. * import sys
  1386. */
  1387. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1388. __Pyx_GOTREF(__pyx_t_2);
  1389. __Pyx_INCREF(__pyx_n_s_cwd);
  1390. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_cwd);
  1391. __Pyx_GIVEREF(__pyx_n_s_cwd);
  1392. __pyx_t_1 = __Pyx_Import(__pyx_n_s_Naked_toolshed_c_system, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1393. __Pyx_GOTREF(__pyx_t_1);
  1394. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1395. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_cwd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1396. __Pyx_GOTREF(__pyx_t_2);
  1397. if (PyDict_SetItem(__pyx_d, __pyx_n_s_cwd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1398. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1399. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1400. /* "lib/Naked/toolshed/c/cstate.pyx":7
  1401. * from Naked.settings import debug as DEBUG_FLAG
  1402. * from Naked.toolshed.c.system import cwd
  1403. * import Naked.toolshed.c.python as py # <<<<<<<<<<<<<<
  1404. * import sys
  1405. * import os
  1406. */
  1407. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1408. __Pyx_GOTREF(__pyx_t_1);
  1409. __Pyx_INCREF(__pyx_n_s__3);
  1410. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__3);
  1411. __Pyx_GIVEREF(__pyx_n_s__3);
  1412. __pyx_t_2 = __Pyx_Import(__pyx_n_s_Naked_toolshed_c_python, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1413. __Pyx_GOTREF(__pyx_t_2);
  1414. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1415. if (PyDict_SetItem(__pyx_d, __pyx_n_s_py, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1416. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1417. /* "lib/Naked/toolshed/c/cstate.pyx":8
  1418. * from Naked.toolshed.c.system import cwd
  1419. * import Naked.toolshed.c.python as py
  1420. * import sys # <<<<<<<<<<<<<<
  1421. * import os
  1422. * import datetime
  1423. */
  1424. __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1425. __Pyx_GOTREF(__pyx_t_2);
  1426. if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1427. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1428. /* "lib/Naked/toolshed/c/cstate.pyx":9
  1429. * import Naked.toolshed.c.python as py
  1430. * import sys
  1431. * import os # <<<<<<<<<<<<<<
  1432. * import datetime
  1433. *
  1434. */
  1435. __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1436. __Pyx_GOTREF(__pyx_t_2);
  1437. if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1438. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1439. /* "lib/Naked/toolshed/c/cstate.pyx":10
  1440. * import sys
  1441. * import os
  1442. * import datetime # <<<<<<<<<<<<<<
  1443. *
  1444. * class StateObject:
  1445. */
  1446. __pyx_t_2 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1447. __Pyx_GOTREF(__pyx_t_2);
  1448. if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1449. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1450. /* "lib/Naked/toolshed/c/cstate.pyx":12
  1451. * import datetime
  1452. *
  1453. * class StateObject: # <<<<<<<<<<<<<<
  1454. * def __init__(self):
  1455. * now = datetime.datetime.now()
  1456. */
  1457. __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_StateObject, __pyx_n_s_StateObject, (PyObject *) NULL, __pyx_n_s_lib_Naked_toolshed_c_cstate, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1458. __Pyx_GOTREF(__pyx_t_2);
  1459. /* "lib/Naked/toolshed/c/cstate.pyx":13
  1460. *
  1461. * class StateObject:
  1462. * def __init__(self): # <<<<<<<<<<<<<<
  1463. * now = datetime.datetime.now()
  1464. * self.py2 = py.is_py2() #truth test Python 2 interpreter
  1465. */
  1466. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_6cstate_11StateObject_1__init__, 0, __pyx_n_s_StateObject___init, NULL, __pyx_n_s_lib_Naked_toolshed_c_cstate, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1467. __Pyx_GOTREF(__pyx_t_1);
  1468. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1469. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1470. /* "lib/Naked/toolshed/c/cstate.pyx":12
  1471. * import datetime
  1472. *
  1473. * class StateObject: # <<<<<<<<<<<<<<
  1474. * def __init__(self):
  1475. * now = datetime.datetime.now()
  1476. */
  1477. __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_StateObject, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1478. __Pyx_GOTREF(__pyx_t_1);
  1479. if (PyDict_SetItem(__pyx_d, __pyx_n_s_StateObject, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1480. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1481. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1482. /* "lib/Naked/toolshed/c/cstate.pyx":34
  1483. * self.second = now.second
  1484. *
  1485. * if __name__ == '__main__': # <<<<<<<<<<<<<<
  1486. * pass
  1487. */
  1488. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1489. __Pyx_GOTREF(__pyx_t_2);
  1490. __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_main, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1491. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1492. if (__pyx_t_3) {
  1493. goto __pyx_L2;
  1494. }
  1495. __pyx_L2:;
  1496. /* "lib/Naked/toolshed/c/cstate.pyx":1
  1497. * #!/usr/bin/env python # <<<<<<<<<<<<<<
  1498. * # encoding: utf-8
  1499. * # cython: profile=False
  1500. */
  1501. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1502. __Pyx_GOTREF(__pyx_t_2);
  1503. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1504. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1505. goto __pyx_L0;
  1506. __pyx_L1_error:;
  1507. __Pyx_XDECREF(__pyx_t_1);
  1508. __Pyx_XDECREF(__pyx_t_2);
  1509. if (__pyx_m) {
  1510. __Pyx_AddTraceback("init lib.Naked.toolshed.c.cstate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1511. Py_DECREF(__pyx_m); __pyx_m = 0;
  1512. } else if (!PyErr_Occurred()) {
  1513. PyErr_SetString(PyExc_ImportError, "init lib.Naked.toolshed.c.cstate");
  1514. }
  1515. __pyx_L0:;
  1516. __Pyx_RefNannyFinishContext();
  1517. #if PY_MAJOR_VERSION < 3
  1518. return;
  1519. #else
  1520. return __pyx_m;
  1521. #endif
  1522. }
  1523. /* Runtime support code */
  1524. #if CYTHON_REFNANNY
  1525. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  1526. PyObject *m = NULL, *p = NULL;
  1527. void *r = NULL;
  1528. m = PyImport_ImportModule((char *)modname);
  1529. if (!m) goto end;
  1530. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  1531. if (!p) goto end;
  1532. r = PyLong_AsVoidPtr(p);
  1533. end:
  1534. Py_XDECREF(p);
  1535. Py_XDECREF(m);
  1536. return (__Pyx_RefNannyAPIStruct *)r;
  1537. }
  1538. #endif /* CYTHON_REFNANNY */
  1539. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  1540. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  1541. if (unlikely(!result)) {
  1542. PyErr_Format(PyExc_NameError,
  1543. #if PY_MAJOR_VERSION >= 3
  1544. "name '%U' is not defined", name);
  1545. #else
  1546. "name '%.200s' is not defined", PyString_AS_STRING(name));
  1547. #endif
  1548. }
  1549. return result;
  1550. }
  1551. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  1552. PyObject *result;
  1553. #if CYTHON_COMPILING_IN_CPYTHON
  1554. result = PyDict_GetItem(__pyx_d, name);
  1555. if (result) {
  1556. Py_INCREF(result);
  1557. } else {
  1558. #else
  1559. result = PyObject_GetItem(__pyx_d, name);
  1560. if (!result) {
  1561. PyErr_Clear();
  1562. #endif
  1563. result = __Pyx_GetBuiltinName(name);
  1564. }
  1565. return result;
  1566. }
  1567. #if CYTHON_COMPILING_IN_CPYTHON
  1568. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  1569. PyObject *result;
  1570. ternaryfunc call = func->ob_type->tp_call;
  1571. if (unlikely(!call))
  1572. return PyObject_Call(func, arg, kw);
  1573. #if PY_VERSION_HEX >= 0x02060000
  1574. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  1575. return NULL;
  1576. #endif
  1577. result = (*call)(func, arg, kw);
  1578. #if PY_VERSION_HEX >= 0x02060000
  1579. Py_LeaveRecursiveCall();
  1580. #endif
  1581. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  1582. PyErr_SetString(
  1583. PyExc_SystemError,
  1584. "NULL result without error in PyObject_Call");
  1585. }
  1586. return result;
  1587. }
  1588. #endif
  1589. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  1590. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  1591. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  1592. PyErr_Format(PyExc_ImportError,
  1593. #if PY_MAJOR_VERSION < 3
  1594. "cannot import name %.230s", PyString_AS_STRING(name));
  1595. #else
  1596. "cannot import name %S", name);
  1597. #endif
  1598. }
  1599. return value;
  1600. }
  1601. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  1602. PyObject* fake_module;
  1603. PyTypeObject* cached_type = NULL;
  1604. fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
  1605. if (!fake_module) return NULL;
  1606. Py_INCREF(fake_module);
  1607. cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
  1608. if (cached_type) {
  1609. if (!PyType_Check((PyObject*)cached_type)) {
  1610. PyErr_Format(PyExc_TypeError,
  1611. "Shared Cython type %.200s is not a type object",
  1612. type->tp_name);
  1613. goto bad;
  1614. }
  1615. if (cached_type->tp_basicsize != type->tp_basicsize) {
  1616. PyErr_Format(PyExc_TypeError,
  1617. "Shared Cython type %.200s has the wrong size, try recompiling",
  1618. type->tp_name);
  1619. goto bad;
  1620. }
  1621. } else {
  1622. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  1623. PyErr_Clear();
  1624. if (PyType_Ready(type) < 0) goto bad;
  1625. if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
  1626. goto bad;
  1627. Py_INCREF(type);
  1628. cached_type = type;
  1629. }
  1630. done:
  1631. Py_DECREF(fake_module);
  1632. return cached_type;
  1633. bad:
  1634. Py_XDECREF(cached_type);
  1635. cached_type = NULL;
  1636. goto done;
  1637. }
  1638. static PyObject *
  1639. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
  1640. {
  1641. if (unlikely(op->func_doc == NULL)) {
  1642. if (op->func.m_ml->ml_doc) {
  1643. #if PY_MAJOR_VERSION >= 3
  1644. op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
  1645. #else
  1646. op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
  1647. #endif
  1648. if (unlikely(op->func_doc == NULL))
  1649. return NULL;
  1650. } else {
  1651. Py_INCREF(Py_None);
  1652. return Py_None;
  1653. }
  1654. }
  1655. Py_INCREF(op->func_doc);
  1656. return op->func_doc;
  1657. }
  1658. static int
  1659. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
  1660. {
  1661. PyObject *tmp = op->func_doc;
  1662. if (value == NULL)
  1663. value = Py_None; /* Mark as deleted */
  1664. Py_INCREF(value);
  1665. op->func_doc = value;
  1666. Py_XDECREF(tmp);
  1667. return 0;
  1668. }
  1669. static PyObject *
  1670. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
  1671. {
  1672. if (unlikely(op->func_name == NULL)) {
  1673. #if PY_MAJOR_VERSION >= 3
  1674. op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
  1675. #else
  1676. op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
  1677. #endif
  1678. if (unlikely(op->func_name == NULL))
  1679. return NULL;
  1680. }
  1681. Py_INCREF(op->func_name);
  1682. return op->func_name;
  1683. }
  1684. static int
  1685. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
  1686. {
  1687. PyObject *tmp;
  1688. #if PY_MAJOR_VERSION >= 3
  1689. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  1690. #else
  1691. if (unlikely(value == NULL || !PyString_Check(value))) {
  1692. #endif
  1693. PyErr_SetString(PyExc_TypeError,
  1694. "__name__ must be set to a string object");
  1695. return -1;
  1696. }
  1697. tmp = op->func_name;
  1698. Py_INCREF(value);
  1699. op->func_name = value;
  1700. Py_XDECREF(tmp);
  1701. return 0;
  1702. }
  1703. static PyObject *
  1704. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
  1705. {
  1706. Py_INCREF(op->func_qualname);
  1707. return op->func_qualname;
  1708. }
  1709. static int
  1710. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
  1711. {
  1712. PyObject *tmp;
  1713. #if PY_MAJOR_VERSION >= 3
  1714. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  1715. #else
  1716. if (unlikely(value == NULL || !PyString_Check(value))) {
  1717. #endif
  1718. PyErr_SetString(PyExc_TypeError,
  1719. "__qualname__ must be set to a string object");
  1720. return -1;
  1721. }
  1722. tmp = op->func_qualname;
  1723. Py_INCREF(value);
  1724. op->func_qualname = value;
  1725. Py_XDECREF(tmp);
  1726. return 0;
  1727. }
  1728. static PyObject *
  1729. __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
  1730. {
  1731. PyObject *self;
  1732. self = m->func_closure;
  1733. if (self == NULL)
  1734. self = Py_None;
  1735. Py_INCREF(self);
  1736. return self;
  1737. }
  1738. static PyObject *
  1739. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
  1740. {
  1741. if (unlikely(op->func_dict == NULL)) {
  1742. op->func_dict = PyDict_New();
  1743. if (unlikely(op->func_dict == NULL))
  1744. return NULL;
  1745. }
  1746. Py_INCREF(op->func_dict);
  1747. return op->func_dict;
  1748. }
  1749. static int
  1750. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
  1751. {
  1752. PyObject *tmp;
  1753. if (unlikely(value == NULL)) {
  1754. PyErr_SetString(PyExc_TypeError,
  1755. "function's dictionary may not be deleted");
  1756. return -1;
  1757. }
  1758. if (unlikely(!PyDict_Check(value))) {
  1759. PyErr_SetString(PyExc_TypeError,
  1760. "setting function's dictionary to a non-dict");
  1761. return -1;
  1762. }
  1763. tmp = op->func_dict;
  1764. Py_INCREF(value);
  1765. op->func_dict = value;
  1766. Py_XDECREF(tmp);
  1767. return 0;
  1768. }
  1769. static PyObject *
  1770. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
  1771. {
  1772. Py_INCREF(op->func_globals);
  1773. return op->func_globals;
  1774. }
  1775. static PyObject *
  1776. __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
  1777. {
  1778. Py_INCREF(Py_None);
  1779. return Py_None;
  1780. }
  1781. static PyObject *
  1782. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
  1783. {
  1784. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  1785. Py_INCREF(result);
  1786. return result;
  1787. }
  1788. static int
  1789. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  1790. PyObject *res = op->defaults_getter((PyObject *) op);
  1791. if (unlikely(!res))
  1792. return -1;
  1793. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  1794. Py_INCREF(op->defaults_tuple);
  1795. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  1796. Py_INCREF(op->defaults_kwdict);
  1797. Py_DECREF(res);
  1798. return 0;
  1799. }
  1800. static int
  1801. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
  1802. PyObject* tmp;
  1803. if (!value) {
  1804. value = Py_None;
  1805. } else if (value != Py_None && !PyTuple_Check(value)) {
  1806. PyErr_SetString(PyExc_TypeError,
  1807. "__defaults__ must be set to a tuple object");
  1808. return -1;
  1809. }
  1810. Py_INCREF(value);
  1811. tmp = op->defaults_tuple;
  1812. op->defaults_tuple = value;
  1813. Py_XDECREF(tmp);
  1814. return 0;
  1815. }
  1816. static PyObject *
  1817. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
  1818. PyObject* result = op->defaults_tuple;
  1819. if (unlikely(!result)) {
  1820. if (op->defaults_getter) {
  1821. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  1822. result = op->defaults_tuple;
  1823. } else {
  1824. result = Py_None;
  1825. }
  1826. }
  1827. Py_INCREF(result);
  1828. return result;
  1829. }
  1830. static int
  1831. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
  1832. PyObject* tmp;
  1833. if (!value) {
  1834. value = Py_None;
  1835. } else if (value != Py_None && !PyDict_Check(value)) {
  1836. PyErr_SetString(PyExc_TypeError,
  1837. "__kwdefaults__ must be set to a dict object");
  1838. return -1;
  1839. }
  1840. Py_INCREF(value);
  1841. tmp = op->defaults_kwdict;
  1842. op->defaults_kwdict = value;
  1843. Py_XDECREF(tmp);
  1844. return 0;
  1845. }
  1846. static PyObject *
  1847. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
  1848. PyObject* result = op->defaults_kwdict;
  1849. if (unlikely(!result)) {
  1850. if (op->defaults_getter) {
  1851. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  1852. result = op->defaults_kwdict;
  1853. } else {
  1854. result = Py_None;
  1855. }
  1856. }
  1857. Py_INCREF(result);
  1858. return result;
  1859. }
  1860. static int
  1861. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
  1862. PyObject* tmp;
  1863. if (!value || value == Py_None) {
  1864. value = NULL;
  1865. } else if (!PyDict_Check(value)) {
  1866. PyErr_SetString(PyExc_TypeError,
  1867. "__annotations__ must be set to a dict object");
  1868. return -1;
  1869. }
  1870. Py_XINCREF(value);
  1871. tmp = op->func_annotations;
  1872. op->func_annotations = value;
  1873. Py_XDECREF(tmp);
  1874. return 0;
  1875. }
  1876. static PyObject *
  1877. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
  1878. PyObject* result = op->func_annotations;
  1879. if (unlikely(!result)) {
  1880. result = PyDict_New();
  1881. if (unlikely(!result)) return NULL;
  1882. op->func_annotations = result;
  1883. }
  1884. Py_INCREF(result);
  1885. return result;
  1886. }
  1887. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  1888. {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  1889. {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  1890. {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  1891. {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  1892. {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  1893. {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
  1894. {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  1895. {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  1896. {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  1897. {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  1898. {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  1899. {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  1900. {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  1901. {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  1902. {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  1903. {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  1904. {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  1905. {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  1906. {0, 0, 0, 0, 0}
  1907. };
  1908. #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
  1909. #define PY_WRITE_RESTRICTED WRITE_RESTRICTED
  1910. #endif
  1911. static PyMemberDef __pyx_CyFunction_members[] = {
  1912. {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
  1913. {0, 0, 0, 0, 0}
  1914. };
  1915. static PyObject *
  1916. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
  1917. {
  1918. #if PY_MAJOR_VERSION >= 3
  1919. return PyUnicode_FromString(m->func.m_ml->ml_name);
  1920. #else
  1921. return PyString_FromString(m->func.m_ml->ml_name);
  1922. #endif
  1923. }
  1924. static PyMethodDef __pyx_CyFunction_methods[] = {
  1925. {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  1926. {0, 0, 0, 0}
  1927. };
  1928. static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
  1929. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  1930. __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
  1931. if (op == NULL)
  1932. return NULL;
  1933. op->flags = flags;
  1934. op->func_weakreflist = NULL;
  1935. op->func.m_ml = ml;
  1936. op->func.m_self = (PyObject *) op;
  1937. Py_XINCREF(closure);
  1938. op->func_closure = closure;
  1939. Py_XINCREF(module);
  1940. op->func.m_module = module;
  1941. op->func_dict = NULL;
  1942. op->func_name = NULL;
  1943. Py_INCREF(qualname);
  1944. op->func_qualname = qualname;
  1945. op->func_doc = NULL;
  1946. op->func_classobj = NULL;
  1947. op->func_globals = globals;
  1948. Py_INCREF(op->func_globals);
  1949. Py_XINCREF(code);
  1950. op->func_code = code;
  1951. op->defaults_pyobjects = 0;
  1952. op->defaults = NULL;
  1953. op->defaults_tuple = NULL;
  1954. op->defaults_kwdict = NULL;
  1955. op->defaults_getter = NULL;
  1956. op->func_annotations = NULL;
  1957. PyObject_GC_Track(op);
  1958. return (PyObject *) op;
  1959. }
  1960. static int
  1961. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  1962. {
  1963. Py_CLEAR(m->func_closure);
  1964. Py_CLEAR(m->func.m_module);
  1965. Py_CLEAR(m->func_dict);
  1966. Py_CLEAR(m->func_name);
  1967. Py_CLEAR(m->func_qualname);
  1968. Py_CLEAR(m->func_doc);
  1969. Py_CLEAR(m->func_globals);
  1970. Py_CLEAR(m->func_code);
  1971. Py_CLEAR(m->func_classobj);
  1972. Py_CLEAR(m->defaults_tuple);
  1973. Py_CLEAR(m->defaults_kwdict);
  1974. Py_CLEAR(m->func_annotations);
  1975. if (m->defaults) {
  1976. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  1977. int i;
  1978. for (i = 0; i < m->defaults_pyobjects; i++)
  1979. Py_XDECREF(pydefaults[i]);
  1980. PyMem_Free(m->defaults);
  1981. m->defaults = NULL;
  1982. }
  1983. return 0;
  1984. }
  1985. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  1986. {
  1987. PyObject_GC_UnTrack(m);
  1988. if (m->func_weakreflist != NULL)
  1989. PyObject_ClearWeakRefs((PyObject *) m);
  1990. __Pyx_CyFunction_clear(m);
  1991. PyObject_GC_Del(m);
  1992. }
  1993. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  1994. {
  1995. Py_VISIT(m->func_closure);
  1996. Py_VISIT(m->func.m_module);
  1997. Py_VISIT(m->func_dict);
  1998. Py_VISIT(m->func_name);
  1999. Py_VISIT(m->func_qualname);
  2000. Py_VISIT(m->func_doc);
  2001. Py_VISIT(m->func_globals);
  2002. Py_VISIT(m->func_code);
  2003. Py_VISIT(m->func_classobj);
  2004. Py_VISIT(m->defaults_tuple);
  2005. Py_VISIT(m->defaults_kwdict);
  2006. if (m->defaults) {
  2007. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  2008. int i;
  2009. for (i = 0; i < m->defaults_pyobjects; i++)
  2010. Py_VISIT(pydefaults[i]);
  2011. }
  2012. return 0;
  2013. }
  2014. static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
  2015. {
  2016. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  2017. if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
  2018. Py_INCREF(func);
  2019. return func;
  2020. }
  2021. if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
  2022. if (type == NULL)
  2023. type = (PyObject *)(Py_TYPE(obj));
  2024. return PyMethod_New(func,
  2025. type, (PyObject *)(Py_TYPE(type)));
  2026. }
  2027. if (obj == Py_None)
  2028. obj = NULL;
  2029. return PyMethod_New(func, obj, type);
  2030. }
  2031. static PyObject*
  2032. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  2033. {
  2034. #if PY_MAJOR_VERSION >= 3
  2035. return PyUnicode_FromFormat("<cyfunction %U at %p>",
  2036. op->func_qualname, (void *)op);
  2037. #else
  2038. return PyString_FromFormat("<cyfunction %s at %p>",
  2039. PyString_AsString(op->func_qualname), (void *)op);
  2040. #endif
  2041. }
  2042. #if CYTHON_COMPILING_IN_PYPY
  2043. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  2044. PyCFunctionObject* f = (PyCFunctionObject*)func;
  2045. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  2046. PyObject *self = PyCFunction_GET_SELF(func);
  2047. Py_ssize_t size;
  2048. switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
  2049. case METH_VARARGS:
  2050. if (likely(kw == NULL) || PyDict_Size(kw) == 0)
  2051. return (*meth)(self, arg);
  2052. break;
  2053. case METH_VARARGS | METH_KEYWORDS:
  2054. return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
  2055. case METH_NOARGS:
  2056. if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
  2057. size = PyTuple_GET_SIZE(arg);
  2058. if (size == 0)
  2059. return (*meth)(self, NULL);
  2060. PyErr_Format(PyExc_TypeError,
  2061. "%.200s() takes no arguments (%zd given)",
  2062. f->m_ml->ml_name, size);
  2063. return NULL;
  2064. }
  2065. break;
  2066. case METH_O:
  2067. if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
  2068. size = PyTuple_GET_SIZE(arg);
  2069. if (size == 1)
  2070. return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
  2071. PyErr_Format(PyExc_TypeError,
  2072. "%.200s() takes exactly one argument (%zd given)",
  2073. f->m_ml->ml_name, size);
  2074. return NULL;
  2075. }
  2076. break;
  2077. default:
  2078. PyErr_SetString(PyExc_SystemError, "Bad call flags in "
  2079. "__Pyx_CyFunction_Call. METH_OLDARGS is no "
  2080. "longer supported!");
  2081. return NULL;
  2082. }
  2083. PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  2084. f->m_ml->ml_name);
  2085. return NULL;
  2086. }
  2087. #else
  2088. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  2089. return PyCFunction_Call(func, arg, kw);
  2090. }
  2091. #endif
  2092. static PyTypeObject __pyx_CyFunctionType_type = {
  2093. PyVarObject_HEAD_INIT(0, 0)
  2094. __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
  2095. sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
  2096. 0, /*tp_itemsize*/
  2097. (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
  2098. 0, /*tp_print*/
  2099. 0, /*tp_getattr*/
  2100. 0, /*tp_setattr*/
  2101. #if PY_MAJOR_VERSION < 3
  2102. 0, /*tp_compare*/
  2103. #else
  2104. 0, /*reserved*/
  2105. #endif
  2106. (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
  2107. 0, /*tp_as_number*/
  2108. 0, /*tp_as_sequence*/
  2109. 0, /*tp_as_mapping*/
  2110. 0, /*tp_hash*/
  2111. __Pyx_CyFunction_Call, /*tp_call*/
  2112. 0, /*tp_str*/
  2113. 0, /*tp_getattro*/
  2114. 0, /*tp_setattro*/
  2115. 0, /*tp_as_buffer*/
  2116. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
  2117. 0, /*tp_doc*/
  2118. (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
  2119. (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
  2120. 0, /*tp_richcompare*/
  2121. offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
  2122. 0, /*tp_iter*/
  2123. 0, /*tp_iternext*/
  2124. __pyx_CyFunction_methods, /*tp_methods*/
  2125. __pyx_CyFunction_members, /*tp_members*/
  2126. __pyx_CyFunction_getsets, /*tp_getset*/
  2127. 0, /*tp_base*/
  2128. 0, /*tp_dict*/
  2129. __Pyx_CyFunction_descr_get, /*tp_descr_get*/
  2130. 0, /*tp_descr_set*/
  2131. offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
  2132. 0, /*tp_init*/
  2133. 0, /*tp_alloc*/
  2134. 0, /*tp_new*/
  2135. 0, /*tp_free*/
  2136. 0, /*tp_is_gc*/
  2137. 0, /*tp_bases*/
  2138. 0, /*tp_mro*/
  2139. 0, /*tp_cache*/
  2140. 0, /*tp_subclasses*/
  2141. 0, /*tp_weaklist*/
  2142. 0, /*tp_del*/
  2143. #if PY_VERSION_HEX >= 0x02060000
  2144. 0, /*tp_version_tag*/
  2145. #endif
  2146. #if PY_VERSION_HEX >= 0x030400a1
  2147. 0, /*tp_finalize*/
  2148. #endif
  2149. };
  2150. static int __Pyx_CyFunction_init(void) {
  2151. #if !CYTHON_COMPILING_IN_PYPY
  2152. __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
  2153. #endif
  2154. __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  2155. if (__pyx_CyFunctionType == NULL) {
  2156. return -1;
  2157. }
  2158. return 0;
  2159. }
  2160. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  2161. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  2162. m->defaults = PyMem_Malloc(size);
  2163. if (!m->defaults)
  2164. return PyErr_NoMemory();
  2165. memset(m->defaults, 0, size);
  2166. m->defaults_pyobjects = pyobjects;
  2167. return m->defaults;
  2168. }
  2169. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  2170. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  2171. m->defaults_tuple = tuple;
  2172. Py_INCREF(tuple);
  2173. }
  2174. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  2175. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  2176. m->defaults_kwdict = dict;
  2177. Py_INCREF(dict);
  2178. }
  2179. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  2180. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  2181. m->func_annotations = dict;
  2182. Py_INCREF(dict);
  2183. }
  2184. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
  2185. Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
  2186. for (i=0; i < nbases; i++) {
  2187. PyTypeObject *tmptype;
  2188. PyObject *tmp = PyTuple_GET_ITEM(bases, i);
  2189. tmptype = Py_TYPE(tmp);
  2190. #if PY_MAJOR_VERSION < 3
  2191. if (tmptype == &PyClass_Type)
  2192. continue;
  2193. #endif
  2194. if (!metaclass) {
  2195. metaclass = tmptype;
  2196. continue;
  2197. }
  2198. if (PyType_IsSubtype(metaclass, tmptype))
  2199. continue;
  2200. if (PyType_IsSubtype(tmptype, metaclass)) {
  2201. metaclass = tmptype;
  2202. continue;
  2203. }
  2204. PyErr_SetString(PyExc_TypeError,
  2205. "metaclass conflict: "
  2206. "the metaclass of a derived class "
  2207. "must be a (non-strict) subclass "
  2208. "of the metaclasses of all its bases");
  2209. return NULL;
  2210. }
  2211. if (!metaclass) {
  2212. #if PY_MAJOR_VERSION < 3
  2213. metaclass = &PyClass_Type;
  2214. #else
  2215. metaclass = &PyType_Type;
  2216. #endif
  2217. }
  2218. Py_INCREF((PyObject*) metaclass);
  2219. return (PyObject*) metaclass;
  2220. }
  2221. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
  2222. PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
  2223. PyObject *ns;
  2224. if (metaclass) {
  2225. PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
  2226. if (prep) {
  2227. PyObject *pargs = PyTuple_Pack(2, name, bases);
  2228. if (unlikely(!pargs)) {
  2229. Py_DECREF(prep);
  2230. return NULL;
  2231. }
  2232. ns = PyObject_Call(prep, pargs, mkw);
  2233. Py_DECREF(prep);
  2234. Py_DECREF(pargs);
  2235. } else {
  2236. if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
  2237. return NULL;
  2238. PyErr_Clear();
  2239. ns = PyDict_New();
  2240. }
  2241. } else {
  2242. ns = PyDict_New();
  2243. }
  2244. if (unlikely(!ns))
  2245. return NULL;
  2246. if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
  2247. if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
  2248. if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
  2249. return ns;
  2250. bad:
  2251. Py_DECREF(ns);
  2252. return NULL;
  2253. }
  2254. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
  2255. PyObject *dict, PyObject *mkw,
  2256. int calculate_metaclass, int allow_py2_metaclass) {
  2257. PyObject *result, *margs;
  2258. PyObject *owned_metaclass = NULL;
  2259. if (allow_py2_metaclass) {
  2260. owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
  2261. if (owned_metaclass) {
  2262. metaclass = owned_metaclass;
  2263. } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
  2264. PyErr_Clear();
  2265. } else {
  2266. return NULL;
  2267. }
  2268. }
  2269. if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
  2270. metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
  2271. Py_XDECREF(owned_metaclass);
  2272. if (unlikely(!metaclass))
  2273. return NULL;
  2274. owned_metaclass = metaclass;
  2275. }
  2276. margs = PyTuple_Pack(3, name, bases, dict);
  2277. if (unlikely(!margs)) {
  2278. result = NULL;
  2279. } else {
  2280. result = PyObject_Call(metaclass, margs, mkw);
  2281. Py_DECREF(margs);
  2282. }
  2283. Py_XDECREF(owned_metaclass);
  2284. return result;
  2285. }
  2286. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  2287. #if CYTHON_COMPILING_IN_PYPY
  2288. return PyObject_RichCompareBool(s1, s2, equals);
  2289. #else
  2290. if (s1 == s2) {
  2291. return (equals == Py_EQ);
  2292. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  2293. const char *ps1, *ps2;
  2294. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  2295. if (length != PyBytes_GET_SIZE(s2))
  2296. return (equals == Py_NE);
  2297. ps1 = PyBytes_AS_STRING(s1);
  2298. ps2 = PyBytes_AS_STRING(s2);
  2299. if (ps1[0] != ps2[0]) {
  2300. return (equals == Py_NE);
  2301. } else if (length == 1) {
  2302. return (equals == Py_EQ);
  2303. } else {
  2304. int result = memcmp(ps1, ps2, (size_t)length);
  2305. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  2306. }
  2307. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  2308. return (equals == Py_NE);
  2309. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  2310. return (equals == Py_NE);
  2311. } else {
  2312. int result;
  2313. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  2314. if (!py_result)
  2315. return -1;
  2316. result = __Pyx_PyObject_IsTrue(py_result);
  2317. Py_DECREF(py_result);
  2318. return result;
  2319. }
  2320. #endif
  2321. }
  2322. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  2323. #if CYTHON_COMPILING_IN_PYPY
  2324. return PyObject_RichCompareBool(s1, s2, equals);
  2325. #else
  2326. #if PY_MAJOR_VERSION < 3
  2327. PyObject* owned_ref = NULL;
  2328. #endif
  2329. int s1_is_unicode, s2_is_unicode;
  2330. if (s1 == s2) {
  2331. goto return_eq;
  2332. }
  2333. s1_is_unicode = PyUnicode_CheckExact(s1);
  2334. s2_is_unicode = PyUnicode_CheckExact(s2);
  2335. #if PY_MAJOR_VERSION < 3
  2336. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  2337. owned_ref = PyUnicode_FromObject(s2);
  2338. if (unlikely(!owned_ref))
  2339. return -1;
  2340. s2 = owned_ref;
  2341. s2_is_unicode = 1;
  2342. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  2343. owned_ref = PyUnicode_FromObject(s1);
  2344. if (unlikely(!owned_ref))
  2345. return -1;
  2346. s1 = owned_ref;
  2347. s1_is_unicode = 1;
  2348. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  2349. return __Pyx_PyBytes_Equals(s1, s2, equals);
  2350. }
  2351. #endif
  2352. if (s1_is_unicode & s2_is_unicode) {
  2353. Py_ssize_t length;
  2354. int kind;
  2355. void *data1, *data2;
  2356. #if CYTHON_PEP393_ENABLED
  2357. if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
  2358. return -1;
  2359. #endif
  2360. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  2361. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  2362. goto return_ne;
  2363. }
  2364. kind = __Pyx_PyUnicode_KIND(s1);
  2365. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  2366. goto return_ne;
  2367. }
  2368. data1 = __Pyx_PyUnicode_DATA(s1);
  2369. data2 = __Pyx_PyUnicode_DATA(s2);
  2370. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  2371. goto return_ne;
  2372. } else if (length == 1) {
  2373. goto return_eq;
  2374. } else {
  2375. int result = memcmp(data1, data2, length * kind);
  2376. #if PY_MAJOR_VERSION < 3
  2377. Py_XDECREF(owned_ref);
  2378. #endif
  2379. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  2380. }
  2381. } else if ((s1 == Py_None) & s2_is_unicode) {
  2382. goto return_ne;
  2383. } else if ((s2 == Py_None) & s1_is_unicode) {
  2384. goto return_ne;
  2385. } else {
  2386. int result;
  2387. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  2388. if (!py_result)
  2389. return -1;
  2390. result = __Pyx_PyObject_IsTrue(py_result);
  2391. Py_DECREF(py_result);
  2392. return result;
  2393. }
  2394. return_eq:
  2395. #if PY_MAJOR_VERSION < 3
  2396. Py_XDECREF(owned_ref);
  2397. #endif
  2398. return (equals == Py_EQ);
  2399. return_ne:
  2400. #if PY_MAJOR_VERSION < 3
  2401. Py_XDECREF(owned_ref);
  2402. #endif
  2403. return (equals == Py_NE);
  2404. #endif
  2405. }
  2406. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  2407. PyObject *empty_list = 0;
  2408. PyObject *module = 0;
  2409. PyObject *global_dict = 0;
  2410. PyObject *empty_dict = 0;
  2411. PyObject *list;
  2412. #if PY_VERSION_HEX < 0x03030000
  2413. PyObject *py_import;
  2414. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  2415. if (!py_import)
  2416. goto bad;
  2417. #endif
  2418. if (from_list)
  2419. list = from_list;
  2420. else {
  2421. empty_list = PyList_New(0);
  2422. if (!empty_list)
  2423. goto bad;
  2424. list = empty_list;
  2425. }
  2426. global_dict = PyModule_GetDict(__pyx_m);
  2427. if (!global_dict)
  2428. goto bad;
  2429. empty_dict = PyDict_New();
  2430. if (!empty_dict)
  2431. goto bad;
  2432. #if PY_VERSION_HEX >= 0x02050000
  2433. {
  2434. #if PY_MAJOR_VERSION >= 3
  2435. if (level == -1) {
  2436. if (strchr(__Pyx_MODULE_NAME, '.')) {
  2437. #if PY_VERSION_HEX < 0x03030000
  2438. PyObject *py_level = PyInt_FromLong(1);
  2439. if (!py_level)
  2440. goto bad;
  2441. module = PyObject_CallFunctionObjArgs(py_import,
  2442. name, global_dict, empty_dict, list, py_level, NULL);
  2443. Py_DECREF(py_level);
  2444. #else
  2445. module = PyImport_ImportModuleLevelObject(
  2446. name, global_dict, empty_dict, list, 1);
  2447. #endif
  2448. if (!module) {
  2449. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  2450. goto bad;
  2451. PyErr_Clear();
  2452. }
  2453. }
  2454. level = 0; /* try absolute import on failure */
  2455. }
  2456. #endif
  2457. if (!module) {
  2458. #if PY_VERSION_HEX < 0x03030000
  2459. PyObject *py_level = PyInt_FromLong(level);
  2460. if (!py_level)
  2461. goto bad;
  2462. module = PyObject_CallFunctionObjArgs(py_import,
  2463. name, global_dict, empty_dict, list, py_level, NULL);
  2464. Py_DECREF(py_level);
  2465. #else
  2466. module = PyImport_ImportModuleLevelObject(
  2467. name, global_dict, empty_dict, list, level);
  2468. #endif
  2469. }
  2470. }
  2471. #else
  2472. if (level>0) {
  2473. PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
  2474. goto bad;
  2475. }
  2476. module = PyObject_CallFunctionObjArgs(py_import,
  2477. name, global_dict, empty_dict, list, NULL);
  2478. #endif
  2479. bad:
  2480. #if PY_VERSION_HEX < 0x03030000
  2481. Py_XDECREF(py_import);
  2482. #endif
  2483. Py_XDECREF(empty_list);
  2484. Py_XDECREF(empty_dict);
  2485. return module;
  2486. }
  2487. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  2488. const long neg_one = (long) -1, const_zero = 0;
  2489. const int is_unsigned = neg_one > const_zero;
  2490. if (is_unsigned) {
  2491. if (sizeof(long) < sizeof(long)) {
  2492. return PyInt_FromLong((long) value);
  2493. } else if (sizeof(long) <= sizeof(unsigned long)) {
  2494. return PyLong_FromUnsignedLong((unsigned long) value);
  2495. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  2496. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  2497. }
  2498. } else {
  2499. if (sizeof(long) <= sizeof(long)) {
  2500. return PyInt_FromLong((long) value);
  2501. } else if (sizeof(long) <= sizeof(long long)) {
  2502. return PyLong_FromLongLong((long long) value);
  2503. }
  2504. }
  2505. {
  2506. int one = 1; int little = (int)*(unsigned char *)&one;
  2507. unsigned char *bytes = (unsigned char *)&value;
  2508. return _PyLong_FromByteArray(bytes, sizeof(long),
  2509. little, !is_unsigned);
  2510. }
  2511. }
  2512. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \
  2513. { \
  2514. func_type value = func(x); \
  2515. if (sizeof(target_type) < sizeof(func_type)) { \
  2516. if (unlikely(value != (func_type) (target_type) value)) { \
  2517. func_type zero = 0; \
  2518. PyErr_SetString(PyExc_OverflowError, \
  2519. (is_unsigned && unlikely(value < zero)) ? \
  2520. "can't convert negative value to " #target_type : \
  2521. "value too large to convert to " #target_type); \
  2522. return (target_type) -1; \
  2523. } \
  2524. } \
  2525. return (target_type) value; \
  2526. }
  2527. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2528. #if CYTHON_USE_PYLONG_INTERNALS
  2529. #include "longintrepr.h"
  2530. #endif
  2531. #endif
  2532. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  2533. const long neg_one = (long) -1, const_zero = 0;
  2534. const int is_unsigned = neg_one > const_zero;
  2535. #if PY_MAJOR_VERSION < 3
  2536. if (likely(PyInt_Check(x))) {
  2537. if (sizeof(long) < sizeof(long)) {
  2538. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
  2539. } else {
  2540. long val = PyInt_AS_LONG(x);
  2541. if (is_unsigned && unlikely(val < 0)) {
  2542. PyErr_SetString(PyExc_OverflowError,
  2543. "can't convert negative value to long");
  2544. return (long) -1;
  2545. }
  2546. return (long) val;
  2547. }
  2548. } else
  2549. #endif
  2550. if (likely(PyLong_Check(x))) {
  2551. if (is_unsigned) {
  2552. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2553. #if CYTHON_USE_PYLONG_INTERNALS
  2554. if (sizeof(digit) <= sizeof(long)) {
  2555. switch (Py_SIZE(x)) {
  2556. case 0: return 0;
  2557. case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
  2558. }
  2559. }
  2560. #endif
  2561. #endif
  2562. if (unlikely(Py_SIZE(x) < 0)) {
  2563. PyErr_SetString(PyExc_OverflowError,
  2564. "can't convert negative value to long");
  2565. return (long) -1;
  2566. }
  2567. if (sizeof(long) <= sizeof(unsigned long)) {
  2568. __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
  2569. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  2570. __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
  2571. }
  2572. } else {
  2573. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2574. #if CYTHON_USE_PYLONG_INTERNALS
  2575. if (sizeof(digit) <= sizeof(long)) {
  2576. switch (Py_SIZE(x)) {
  2577. case 0: return 0;
  2578. case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
  2579. case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
  2580. }
  2581. }
  2582. #endif
  2583. #endif
  2584. if (sizeof(long) <= sizeof(long)) {
  2585. __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
  2586. } else if (sizeof(long) <= sizeof(long long)) {
  2587. __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
  2588. }
  2589. }
  2590. {
  2591. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  2592. PyErr_SetString(PyExc_RuntimeError,
  2593. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  2594. #else
  2595. long val;
  2596. PyObject *v = __Pyx_PyNumber_Int(x);
  2597. #if PY_MAJOR_VERSION < 3
  2598. if (likely(v) && !PyLong_Check(v)) {
  2599. PyObject *tmp = v;
  2600. v = PyNumber_Long(tmp);
  2601. Py_DECREF(tmp);
  2602. }
  2603. #endif
  2604. if (likely(v)) {
  2605. int one = 1; int is_little = (int)*(unsigned char *)&one;
  2606. unsigned char *bytes = (unsigned char *)&val;
  2607. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  2608. bytes, sizeof(val),
  2609. is_little, !is_unsigned);
  2610. Py_DECREF(v);
  2611. if (likely(!ret))
  2612. return val;
  2613. }
  2614. #endif
  2615. return (long) -1;
  2616. }
  2617. } else {
  2618. long val;
  2619. PyObject *tmp = __Pyx_PyNumber_Int(x);
  2620. if (!tmp) return (long) -1;
  2621. val = __Pyx_PyInt_As_long(tmp);
  2622. Py_DECREF(tmp);
  2623. return val;
  2624. }
  2625. }
  2626. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2627. #if CYTHON_USE_PYLONG_INTERNALS
  2628. #include "longintrepr.h"
  2629. #endif
  2630. #endif
  2631. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  2632. const int neg_one = (int) -1, const_zero = 0;
  2633. const int is_unsigned = neg_one > const_zero;
  2634. #if PY_MAJOR_VERSION < 3
  2635. if (likely(PyInt_Check(x))) {
  2636. if (sizeof(int) < sizeof(long)) {
  2637. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
  2638. } else {
  2639. long val = PyInt_AS_LONG(x);
  2640. if (is_unsigned && unlikely(val < 0)) {
  2641. PyErr_SetString(PyExc_OverflowError,
  2642. "can't convert negative value to int");
  2643. return (int) -1;
  2644. }
  2645. return (int) val;
  2646. }
  2647. } else
  2648. #endif
  2649. if (likely(PyLong_Check(x))) {
  2650. if (is_unsigned) {
  2651. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2652. #if CYTHON_USE_PYLONG_INTERNALS
  2653. if (sizeof(digit) <= sizeof(int)) {
  2654. switch (Py_SIZE(x)) {
  2655. case 0: return 0;
  2656. case 1: return (int) ((PyLongObject*)x)->ob_digit[0];
  2657. }
  2658. }
  2659. #endif
  2660. #endif
  2661. if (unlikely(Py_SIZE(x) < 0)) {
  2662. PyErr_SetString(PyExc_OverflowError,
  2663. "can't convert negative value to int");
  2664. return (int) -1;
  2665. }
  2666. if (sizeof(int) <= sizeof(unsigned long)) {
  2667. __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
  2668. } else if (sizeof(int) <= sizeof(unsigned long long)) {
  2669. __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
  2670. }
  2671. } else {
  2672. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  2673. #if CYTHON_USE_PYLONG_INTERNALS
  2674. if (sizeof(digit) <= sizeof(int)) {
  2675. switch (Py_SIZE(x)) {
  2676. case 0: return 0;
  2677. case 1: return +(int) ((PyLongObject*)x)->ob_digit[0];
  2678. case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
  2679. }
  2680. }
  2681. #endif
  2682. #endif
  2683. if (sizeof(int) <= sizeof(long)) {
  2684. __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
  2685. } else if (sizeof(int) <= sizeof(long long)) {
  2686. __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
  2687. }
  2688. }
  2689. {
  2690. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  2691. PyErr_SetString(PyExc_RuntimeError,
  2692. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  2693. #else
  2694. int val;
  2695. PyObject *v = __Pyx_PyNumber_Int(x);
  2696. #if PY_MAJOR_VERSION < 3
  2697. if (likely(v) && !PyLong_Check(v)) {
  2698. PyObject *tmp = v;
  2699. v = PyNumber_Long(tmp);
  2700. Py_DECREF(tmp);
  2701. }
  2702. #endif
  2703. if (likely(v)) {
  2704. int one = 1; int is_little = (int)*(unsigned char *)&one;
  2705. unsigned char *bytes = (unsigned char *)&val;
  2706. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  2707. bytes, sizeof(val),
  2708. is_little, !is_unsigned);
  2709. Py_DECREF(v);
  2710. if (likely(!ret))
  2711. return val;
  2712. }
  2713. #endif
  2714. return (int) -1;
  2715. }
  2716. } else {
  2717. int val;
  2718. PyObject *tmp = __Pyx_PyNumber_Int(x);
  2719. if (!tmp) return (int) -1;
  2720. val = __Pyx_PyInt_As_int(tmp);
  2721. Py_DECREF(tmp);
  2722. return val;
  2723. }
  2724. }
  2725. static int __Pyx_check_binary_version(void) {
  2726. char ctversion[4], rtversion[4];
  2727. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  2728. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  2729. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  2730. char message[200];
  2731. PyOS_snprintf(message, sizeof(message),
  2732. "compiletime version %s of module '%.100s' "
  2733. "does not match runtime version %s",
  2734. ctversion, __Pyx_MODULE_NAME, rtversion);
  2735. #if PY_VERSION_HEX < 0x02050000
  2736. return PyErr_Warn(NULL, message);
  2737. #else
  2738. return PyErr_WarnEx(NULL, message, 1);
  2739. #endif
  2740. }
  2741. return 0;
  2742. }
  2743. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  2744. int start = 0, mid = 0, end = count - 1;
  2745. if (end >= 0 && code_line > entries[end].code_line) {
  2746. return count;
  2747. }
  2748. while (start < end) {
  2749. mid = (start + end) / 2;
  2750. if (code_line < entries[mid].code_line) {
  2751. end = mid;
  2752. } else if (code_line > entries[mid].code_line) {
  2753. start = mid + 1;
  2754. } else {
  2755. return mid;
  2756. }
  2757. }
  2758. if (code_line <= entries[mid].code_line) {
  2759. return mid;
  2760. } else {
  2761. return mid + 1;
  2762. }
  2763. }
  2764. static PyCodeObject *__pyx_find_code_object(int code_line) {
  2765. PyCodeObject* code_object;
  2766. int pos;
  2767. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  2768. return NULL;
  2769. }
  2770. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  2771. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  2772. return NULL;
  2773. }
  2774. code_object = __pyx_code_cache.entries[pos].code_object;
  2775. Py_INCREF(code_object);
  2776. return code_object;
  2777. }
  2778. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  2779. int pos, i;
  2780. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  2781. if (unlikely(!code_line)) {
  2782. return;
  2783. }
  2784. if (unlikely(!entries)) {
  2785. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  2786. if (likely(entries)) {
  2787. __pyx_code_cache.entries = entries;
  2788. __pyx_code_cache.max_count = 64;
  2789. __pyx_code_cache.count = 1;
  2790. entries[0].code_line = code_line;
  2791. entries[0].code_object = code_object;
  2792. Py_INCREF(code_object);
  2793. }
  2794. return;
  2795. }
  2796. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  2797. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  2798. PyCodeObject* tmp = entries[pos].code_object;
  2799. entries[pos].code_object = code_object;
  2800. Py_DECREF(tmp);
  2801. return;
  2802. }
  2803. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  2804. int new_max = __pyx_code_cache.max_count + 64;
  2805. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  2806. __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  2807. if (unlikely(!entries)) {
  2808. return;
  2809. }
  2810. __pyx_code_cache.entries = entries;
  2811. __pyx_code_cache.max_count = new_max;
  2812. }
  2813. for (i=__pyx_code_cache.count; i>pos; i--) {
  2814. entries[i] = entries[i-1];
  2815. }
  2816. entries[pos].code_line = code_line;
  2817. entries[pos].code_object = code_object;
  2818. __pyx_code_cache.count++;
  2819. Py_INCREF(code_object);
  2820. }
  2821. #include "compile.h"
  2822. #include "frameobject.h"
  2823. #include "traceback.h"
  2824. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  2825. const char *funcname, int c_line,
  2826. int py_line, const char *filename) {
  2827. PyCodeObject *py_code = 0;
  2828. PyObject *py_srcfile = 0;
  2829. PyObject *py_funcname = 0;
  2830. #if PY_MAJOR_VERSION < 3
  2831. py_srcfile = PyString_FromString(filename);
  2832. #else
  2833. py_srcfile = PyUnicode_FromString(filename);
  2834. #endif
  2835. if (!py_srcfile) goto bad;
  2836. if (c_line) {
  2837. #if PY_MAJOR_VERSION < 3
  2838. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  2839. #else
  2840. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  2841. #endif
  2842. }
  2843. else {
  2844. #if PY_MAJOR_VERSION < 3
  2845. py_funcname = PyString_FromString(funcname);
  2846. #else
  2847. py_funcname = PyUnicode_FromString(funcname);
  2848. #endif
  2849. }
  2850. if (!py_funcname) goto bad;
  2851. py_code = __Pyx_PyCode_New(
  2852. 0, /*int argcount,*/
  2853. 0, /*int kwonlyargcount,*/
  2854. 0, /*int nlocals,*/
  2855. 0, /*int stacksize,*/
  2856. 0, /*int flags,*/
  2857. __pyx_empty_bytes, /*PyObject *code,*/
  2858. __pyx_empty_tuple, /*PyObject *consts,*/
  2859. __pyx_empty_tuple, /*PyObject *names,*/
  2860. __pyx_empty_tuple, /*PyObject *varnames,*/
  2861. __pyx_empty_tuple, /*PyObject *freevars,*/
  2862. __pyx_empty_tuple, /*PyObject *cellvars,*/
  2863. py_srcfile, /*PyObject *filename,*/
  2864. py_funcname, /*PyObject *name,*/
  2865. py_line, /*int firstlineno,*/
  2866. __pyx_empty_bytes /*PyObject *lnotab*/
  2867. );
  2868. Py_DECREF(py_srcfile);
  2869. Py_DECREF(py_funcname);
  2870. return py_code;
  2871. bad:
  2872. Py_XDECREF(py_srcfile);
  2873. Py_XDECREF(py_funcname);
  2874. return NULL;
  2875. }
  2876. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2877. int py_line, const char *filename) {
  2878. PyCodeObject *py_code = 0;
  2879. PyObject *py_globals = 0;
  2880. PyFrameObject *py_frame = 0;
  2881. py_code = __pyx_find_code_object(c_line ? c_line : py_line);
  2882. if (!py_code) {
  2883. py_code = __Pyx_CreateCodeObjectForTraceback(
  2884. funcname, c_line, py_line, filename);
  2885. if (!py_code) goto bad;
  2886. __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
  2887. }
  2888. py_globals = PyModule_GetDict(__pyx_m);
  2889. if (!py_globals) goto bad;
  2890. py_frame = PyFrame_New(
  2891. PyThreadState_GET(), /*PyThreadState *tstate,*/
  2892. py_code, /*PyCodeObject *code,*/
  2893. py_globals, /*PyObject *globals,*/
  2894. 0 /*PyObject *locals*/
  2895. );
  2896. if (!py_frame) goto bad;
  2897. py_frame->f_lineno = py_line;
  2898. PyTraceBack_Here(py_frame);
  2899. bad:
  2900. Py_XDECREF(py_code);
  2901. Py_XDECREF(py_frame);
  2902. }
  2903. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  2904. while (t->p) {
  2905. #if PY_MAJOR_VERSION < 3
  2906. if (t->is_unicode) {
  2907. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  2908. } else if (t->intern) {
  2909. *t->p = PyString_InternFromString(t->s);
  2910. } else {
  2911. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  2912. }
  2913. #else /* Python 3+ has unicode identifiers */
  2914. if (t->is_unicode | t->is_str) {
  2915. if (t->intern) {
  2916. *t->p = PyUnicode_InternFromString(t->s);
  2917. } else if (t->encoding) {
  2918. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  2919. } else {
  2920. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  2921. }
  2922. } else {
  2923. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  2924. }
  2925. #endif
  2926. if (!*t->p)
  2927. return -1;
  2928. ++t;
  2929. }
  2930. return 0;
  2931. }
  2932. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
  2933. return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
  2934. }
  2935. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
  2936. Py_ssize_t ignore;
  2937. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  2938. }
  2939. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  2940. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  2941. if (
  2942. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  2943. __Pyx_sys_getdefaultencoding_not_ascii &&
  2944. #endif
  2945. PyUnicode_Check(o)) {
  2946. #if PY_VERSION_HEX < 0x03030000
  2947. char* defenc_c;
  2948. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  2949. if (!defenc) return NULL;
  2950. defenc_c = PyBytes_AS_STRING(defenc);
  2951. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  2952. {
  2953. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  2954. char* c;
  2955. for (c = defenc_c; c < end; c++) {
  2956. if ((unsigned char) (*c) >= 128) {
  2957. PyUnicode_AsASCIIString(o);
  2958. return NULL;
  2959. }
  2960. }
  2961. }
  2962. #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
  2963. *length = PyBytes_GET_SIZE(defenc);
  2964. return defenc_c;
  2965. #else /* PY_VERSION_HEX < 0x03030000 */
  2966. if (PyUnicode_READY(o) == -1) return NULL;
  2967. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  2968. if (PyUnicode_IS_ASCII(o)) {
  2969. *length = PyUnicode_GET_DATA_SIZE(o);
  2970. return PyUnicode_AsUTF8(o);
  2971. } else {
  2972. PyUnicode_AsASCIIString(o);
  2973. return NULL;
  2974. }
  2975. #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
  2976. return PyUnicode_AsUTF8AndSize(o, length);
  2977. #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
  2978. #endif /* PY_VERSION_HEX < 0x03030000 */
  2979. } else
  2980. #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
  2981. #if !CYTHON_COMPILING_IN_PYPY
  2982. #if PY_VERSION_HEX >= 0x02060000
  2983. if (PyByteArray_Check(o)) {
  2984. *length = PyByteArray_GET_SIZE(o);
  2985. return PyByteArray_AS_STRING(o);
  2986. } else
  2987. #endif
  2988. #endif
  2989. {
  2990. char* result;
  2991. int r = PyBytes_AsStringAndSize(o, &result, length);
  2992. if (unlikely(r < 0)) {
  2993. return NULL;
  2994. } else {
  2995. return result;
  2996. }
  2997. }
  2998. }
  2999. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  3000. int is_true = x == Py_True;
  3001. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  3002. else return PyObject_IsTrue(x);
  3003. }
  3004. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  3005. PyNumberMethods *m;
  3006. const char *name = NULL;
  3007. PyObject *res = NULL;
  3008. #if PY_MAJOR_VERSION < 3
  3009. if (PyInt_Check(x) || PyLong_Check(x))
  3010. #else
  3011. if (PyLong_Check(x))
  3012. #endif
  3013. return Py_INCREF(x), x;
  3014. m = Py_TYPE(x)->tp_as_number;
  3015. #if PY_MAJOR_VERSION < 3
  3016. if (m && m->nb_int) {
  3017. name = "int";
  3018. res = PyNumber_Int(x);
  3019. }
  3020. else if (m && m->nb_long) {
  3021. name = "long";
  3022. res = PyNumber_Long(x);
  3023. }
  3024. #else
  3025. if (m && m->nb_int) {
  3026. name = "int";
  3027. res = PyNumber_Long(x);
  3028. }
  3029. #endif
  3030. if (res) {
  3031. #if PY_MAJOR_VERSION < 3
  3032. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  3033. #else
  3034. if (!PyLong_Check(res)) {
  3035. #endif
  3036. PyErr_Format(PyExc_TypeError,
  3037. "__%.4s__ returned non-%.4s (type %.200s)",
  3038. name, name, Py_TYPE(res)->tp_name);
  3039. Py_DECREF(res);
  3040. return NULL;
  3041. }
  3042. }
  3043. else if (!PyErr_Occurred()) {
  3044. PyErr_SetString(PyExc_TypeError,
  3045. "an integer is required");
  3046. }
  3047. return res;
  3048. }
  3049. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  3050. #if CYTHON_USE_PYLONG_INTERNALS
  3051. #include "longintrepr.h"
  3052. #endif
  3053. #endif
  3054. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  3055. Py_ssize_t ival;
  3056. PyObject *x;
  3057. #if PY_MAJOR_VERSION < 3
  3058. if (likely(PyInt_CheckExact(b)))
  3059. return PyInt_AS_LONG(b);
  3060. #endif
  3061. if (likely(PyLong_CheckExact(b))) {
  3062. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  3063. #if CYTHON_USE_PYLONG_INTERNALS
  3064. switch (Py_SIZE(b)) {
  3065. case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
  3066. case 0: return 0;
  3067. case 1: return ((PyLongObject*)b)->ob_digit[0];
  3068. }
  3069. #endif
  3070. #endif
  3071. #if PY_VERSION_HEX < 0x02060000
  3072. return PyInt_AsSsize_t(b);
  3073. #else
  3074. return PyLong_AsSsize_t(b);
  3075. #endif
  3076. }
  3077. x = PyNumber_Index(b);
  3078. if (!x) return -1;
  3079. ival = PyInt_AsSsize_t(x);
  3080. Py_DECREF(x);
  3081. return ival;
  3082. }
  3083. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  3084. #if PY_VERSION_HEX < 0x02050000
  3085. if (ival <= LONG_MAX)
  3086. return PyInt_FromLong((long)ival);
  3087. else {
  3088. unsigned char *bytes = (unsigned char *) &ival;
  3089. int one = 1; int little = (int)*(unsigned char*)&one;
  3090. return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
  3091. }
  3092. #else
  3093. return PyInt_FromSize_t(ival);
  3094. #endif
  3095. }
  3096. #endif /* Py_PYTHON_H */