qu2cu.c 645 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325
  1. /* Generated by Cython 3.0.6 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "define_macros": [
  6. [
  7. "CYTHON_TRACE_NOGIL",
  8. "1"
  9. ]
  10. ],
  11. "name": "fontTools.qu2cu.qu2cu",
  12. "sources": [
  13. "Lib/fontTools/qu2cu/qu2cu.py"
  14. ]
  15. },
  16. "module_name": "fontTools.qu2cu.qu2cu"
  17. }
  18. END: Cython Metadata */
  19. #ifndef PY_SSIZE_T_CLEAN
  20. #define PY_SSIZE_T_CLEAN
  21. #endif /* PY_SSIZE_T_CLEAN */
  22. #if defined(CYTHON_LIMITED_API) && 0
  23. #ifndef Py_LIMITED_API
  24. #if CYTHON_LIMITED_API+0 > 0x03030000
  25. #define Py_LIMITED_API CYTHON_LIMITED_API
  26. #else
  27. #define Py_LIMITED_API 0x03030000
  28. #endif
  29. #endif
  30. #endif
  31. #include "Python.h"
  32. #ifndef Py_PYTHON_H
  33. #error Python headers needed to compile C extensions, please install development version of Python.
  34. #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  35. #error Cython requires Python 2.7+ or Python 3.3+.
  36. #else
  37. #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
  38. #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
  39. #else
  40. #define __PYX_EXTRA_ABI_MODULE_NAME ""
  41. #endif
  42. #define CYTHON_ABI "3_0_6" __PYX_EXTRA_ABI_MODULE_NAME
  43. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  44. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  45. #define CYTHON_HEX_VERSION 0x030006F0
  46. #define CYTHON_FUTURE_DIVISION 1
  47. #include <stddef.h>
  48. #ifndef offsetof
  49. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  50. #endif
  51. #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  52. #ifndef __stdcall
  53. #define __stdcall
  54. #endif
  55. #ifndef __cdecl
  56. #define __cdecl
  57. #endif
  58. #ifndef __fastcall
  59. #define __fastcall
  60. #endif
  61. #endif
  62. #ifndef DL_IMPORT
  63. #define DL_IMPORT(t) t
  64. #endif
  65. #ifndef DL_EXPORT
  66. #define DL_EXPORT(t) t
  67. #endif
  68. #define __PYX_COMMA ,
  69. #ifndef HAVE_LONG_LONG
  70. #define HAVE_LONG_LONG
  71. #endif
  72. #ifndef PY_LONG_LONG
  73. #define PY_LONG_LONG LONG_LONG
  74. #endif
  75. #ifndef Py_HUGE_VAL
  76. #define Py_HUGE_VAL HUGE_VAL
  77. #endif
  78. #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
  79. #if defined(GRAALVM_PYTHON)
  80. /* For very preliminary testing purposes. Most variables are set the same as PyPy.
  81. The existence of this section does not imply that anything works or is even tested */
  82. #define CYTHON_COMPILING_IN_PYPY 0
  83. #define CYTHON_COMPILING_IN_CPYTHON 0
  84. #define CYTHON_COMPILING_IN_LIMITED_API 0
  85. #define CYTHON_COMPILING_IN_GRAAL 1
  86. #define CYTHON_COMPILING_IN_NOGIL 0
  87. #undef CYTHON_USE_TYPE_SLOTS
  88. #define CYTHON_USE_TYPE_SLOTS 0
  89. #undef CYTHON_USE_TYPE_SPECS
  90. #define CYTHON_USE_TYPE_SPECS 0
  91. #undef CYTHON_USE_PYTYPE_LOOKUP
  92. #define CYTHON_USE_PYTYPE_LOOKUP 0
  93. #if PY_VERSION_HEX < 0x03050000
  94. #undef CYTHON_USE_ASYNC_SLOTS
  95. #define CYTHON_USE_ASYNC_SLOTS 0
  96. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  97. #define CYTHON_USE_ASYNC_SLOTS 1
  98. #endif
  99. #undef CYTHON_USE_PYLIST_INTERNALS
  100. #define CYTHON_USE_PYLIST_INTERNALS 0
  101. #undef CYTHON_USE_UNICODE_INTERNALS
  102. #define CYTHON_USE_UNICODE_INTERNALS 0
  103. #undef CYTHON_USE_UNICODE_WRITER
  104. #define CYTHON_USE_UNICODE_WRITER 0
  105. #undef CYTHON_USE_PYLONG_INTERNALS
  106. #define CYTHON_USE_PYLONG_INTERNALS 0
  107. #undef CYTHON_AVOID_BORROWED_REFS
  108. #define CYTHON_AVOID_BORROWED_REFS 1
  109. #undef CYTHON_ASSUME_SAFE_MACROS
  110. #define CYTHON_ASSUME_SAFE_MACROS 0
  111. #undef CYTHON_UNPACK_METHODS
  112. #define CYTHON_UNPACK_METHODS 0
  113. #undef CYTHON_FAST_THREAD_STATE
  114. #define CYTHON_FAST_THREAD_STATE 0
  115. #undef CYTHON_FAST_GIL
  116. #define CYTHON_FAST_GIL 0
  117. #undef CYTHON_METH_FASTCALL
  118. #define CYTHON_METH_FASTCALL 0
  119. #undef CYTHON_FAST_PYCALL
  120. #define CYTHON_FAST_PYCALL 0
  121. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  122. #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  123. #endif
  124. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  125. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  126. #undef CYTHON_USE_MODULE_STATE
  127. #define CYTHON_USE_MODULE_STATE 0
  128. #undef CYTHON_USE_TP_FINALIZE
  129. #define CYTHON_USE_TP_FINALIZE 0
  130. #undef CYTHON_USE_DICT_VERSIONS
  131. #define CYTHON_USE_DICT_VERSIONS 0
  132. #undef CYTHON_USE_EXC_INFO_STACK
  133. #define CYTHON_USE_EXC_INFO_STACK 0
  134. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  135. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  136. #endif
  137. #elif defined(PYPY_VERSION)
  138. #define CYTHON_COMPILING_IN_PYPY 1
  139. #define CYTHON_COMPILING_IN_CPYTHON 0
  140. #define CYTHON_COMPILING_IN_LIMITED_API 0
  141. #define CYTHON_COMPILING_IN_GRAAL 0
  142. #define CYTHON_COMPILING_IN_NOGIL 0
  143. #undef CYTHON_USE_TYPE_SLOTS
  144. #define CYTHON_USE_TYPE_SLOTS 0
  145. #ifndef CYTHON_USE_TYPE_SPECS
  146. #define CYTHON_USE_TYPE_SPECS 0
  147. #endif
  148. #undef CYTHON_USE_PYTYPE_LOOKUP
  149. #define CYTHON_USE_PYTYPE_LOOKUP 0
  150. #if PY_VERSION_HEX < 0x03050000
  151. #undef CYTHON_USE_ASYNC_SLOTS
  152. #define CYTHON_USE_ASYNC_SLOTS 0
  153. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  154. #define CYTHON_USE_ASYNC_SLOTS 1
  155. #endif
  156. #undef CYTHON_USE_PYLIST_INTERNALS
  157. #define CYTHON_USE_PYLIST_INTERNALS 0
  158. #undef CYTHON_USE_UNICODE_INTERNALS
  159. #define CYTHON_USE_UNICODE_INTERNALS 0
  160. #undef CYTHON_USE_UNICODE_WRITER
  161. #define CYTHON_USE_UNICODE_WRITER 0
  162. #undef CYTHON_USE_PYLONG_INTERNALS
  163. #define CYTHON_USE_PYLONG_INTERNALS 0
  164. #undef CYTHON_AVOID_BORROWED_REFS
  165. #define CYTHON_AVOID_BORROWED_REFS 1
  166. #undef CYTHON_ASSUME_SAFE_MACROS
  167. #define CYTHON_ASSUME_SAFE_MACROS 0
  168. #undef CYTHON_UNPACK_METHODS
  169. #define CYTHON_UNPACK_METHODS 0
  170. #undef CYTHON_FAST_THREAD_STATE
  171. #define CYTHON_FAST_THREAD_STATE 0
  172. #undef CYTHON_FAST_GIL
  173. #define CYTHON_FAST_GIL 0
  174. #undef CYTHON_METH_FASTCALL
  175. #define CYTHON_METH_FASTCALL 0
  176. #undef CYTHON_FAST_PYCALL
  177. #define CYTHON_FAST_PYCALL 0
  178. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  179. #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  180. #endif
  181. #if PY_VERSION_HEX < 0x03090000
  182. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  183. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  184. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  185. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  186. #endif
  187. #undef CYTHON_USE_MODULE_STATE
  188. #define CYTHON_USE_MODULE_STATE 0
  189. #undef CYTHON_USE_TP_FINALIZE
  190. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
  191. #undef CYTHON_USE_DICT_VERSIONS
  192. #define CYTHON_USE_DICT_VERSIONS 0
  193. #undef CYTHON_USE_EXC_INFO_STACK
  194. #define CYTHON_USE_EXC_INFO_STACK 0
  195. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  196. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  197. #endif
  198. #elif defined(CYTHON_LIMITED_API)
  199. #ifdef Py_LIMITED_API
  200. #undef __PYX_LIMITED_VERSION_HEX
  201. #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  202. #endif
  203. #define CYTHON_COMPILING_IN_PYPY 0
  204. #define CYTHON_COMPILING_IN_CPYTHON 0
  205. #define CYTHON_COMPILING_IN_LIMITED_API 1
  206. #define CYTHON_COMPILING_IN_GRAAL 0
  207. #define CYTHON_COMPILING_IN_NOGIL 0
  208. #undef CYTHON_CLINE_IN_TRACEBACK
  209. #define CYTHON_CLINE_IN_TRACEBACK 0
  210. #undef CYTHON_USE_TYPE_SLOTS
  211. #define CYTHON_USE_TYPE_SLOTS 0
  212. #undef CYTHON_USE_TYPE_SPECS
  213. #define CYTHON_USE_TYPE_SPECS 1
  214. #undef CYTHON_USE_PYTYPE_LOOKUP
  215. #define CYTHON_USE_PYTYPE_LOOKUP 0
  216. #undef CYTHON_USE_ASYNC_SLOTS
  217. #define CYTHON_USE_ASYNC_SLOTS 0
  218. #undef CYTHON_USE_PYLIST_INTERNALS
  219. #define CYTHON_USE_PYLIST_INTERNALS 0
  220. #undef CYTHON_USE_UNICODE_INTERNALS
  221. #define CYTHON_USE_UNICODE_INTERNALS 0
  222. #ifndef CYTHON_USE_UNICODE_WRITER
  223. #define CYTHON_USE_UNICODE_WRITER 0
  224. #endif
  225. #undef CYTHON_USE_PYLONG_INTERNALS
  226. #define CYTHON_USE_PYLONG_INTERNALS 0
  227. #ifndef CYTHON_AVOID_BORROWED_REFS
  228. #define CYTHON_AVOID_BORROWED_REFS 0
  229. #endif
  230. #undef CYTHON_ASSUME_SAFE_MACROS
  231. #define CYTHON_ASSUME_SAFE_MACROS 0
  232. #undef CYTHON_UNPACK_METHODS
  233. #define CYTHON_UNPACK_METHODS 0
  234. #undef CYTHON_FAST_THREAD_STATE
  235. #define CYTHON_FAST_THREAD_STATE 0
  236. #undef CYTHON_FAST_GIL
  237. #define CYTHON_FAST_GIL 0
  238. #undef CYTHON_METH_FASTCALL
  239. #define CYTHON_METH_FASTCALL 0
  240. #undef CYTHON_FAST_PYCALL
  241. #define CYTHON_FAST_PYCALL 0
  242. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  243. #define CYTHON_PEP487_INIT_SUBCLASS 1
  244. #endif
  245. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  246. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  247. #undef CYTHON_USE_MODULE_STATE
  248. #define CYTHON_USE_MODULE_STATE 1
  249. #ifndef CYTHON_USE_TP_FINALIZE
  250. #define CYTHON_USE_TP_FINALIZE 0
  251. #endif
  252. #undef CYTHON_USE_DICT_VERSIONS
  253. #define CYTHON_USE_DICT_VERSIONS 0
  254. #undef CYTHON_USE_EXC_INFO_STACK
  255. #define CYTHON_USE_EXC_INFO_STACK 0
  256. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  257. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  258. #endif
  259. #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
  260. #define CYTHON_COMPILING_IN_PYPY 0
  261. #define CYTHON_COMPILING_IN_CPYTHON 0
  262. #define CYTHON_COMPILING_IN_LIMITED_API 0
  263. #define CYTHON_COMPILING_IN_GRAAL 0
  264. #define CYTHON_COMPILING_IN_NOGIL 1
  265. #ifndef CYTHON_USE_TYPE_SLOTS
  266. #define CYTHON_USE_TYPE_SLOTS 1
  267. #endif
  268. #undef CYTHON_USE_PYTYPE_LOOKUP
  269. #define CYTHON_USE_PYTYPE_LOOKUP 0
  270. #ifndef CYTHON_USE_ASYNC_SLOTS
  271. #define CYTHON_USE_ASYNC_SLOTS 1
  272. #endif
  273. #undef CYTHON_USE_PYLIST_INTERNALS
  274. #define CYTHON_USE_PYLIST_INTERNALS 0
  275. #ifndef CYTHON_USE_UNICODE_INTERNALS
  276. #define CYTHON_USE_UNICODE_INTERNALS 1
  277. #endif
  278. #undef CYTHON_USE_UNICODE_WRITER
  279. #define CYTHON_USE_UNICODE_WRITER 0
  280. #undef CYTHON_USE_PYLONG_INTERNALS
  281. #define CYTHON_USE_PYLONG_INTERNALS 0
  282. #ifndef CYTHON_AVOID_BORROWED_REFS
  283. #define CYTHON_AVOID_BORROWED_REFS 0
  284. #endif
  285. #ifndef CYTHON_ASSUME_SAFE_MACROS
  286. #define CYTHON_ASSUME_SAFE_MACROS 1
  287. #endif
  288. #ifndef CYTHON_UNPACK_METHODS
  289. #define CYTHON_UNPACK_METHODS 1
  290. #endif
  291. #undef CYTHON_FAST_THREAD_STATE
  292. #define CYTHON_FAST_THREAD_STATE 0
  293. #undef CYTHON_FAST_PYCALL
  294. #define CYTHON_FAST_PYCALL 0
  295. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  296. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  297. #endif
  298. #ifndef CYTHON_USE_TP_FINALIZE
  299. #define CYTHON_USE_TP_FINALIZE 1
  300. #endif
  301. #undef CYTHON_USE_DICT_VERSIONS
  302. #define CYTHON_USE_DICT_VERSIONS 0
  303. #undef CYTHON_USE_EXC_INFO_STACK
  304. #define CYTHON_USE_EXC_INFO_STACK 0
  305. #else
  306. #define CYTHON_COMPILING_IN_PYPY 0
  307. #define CYTHON_COMPILING_IN_CPYTHON 1
  308. #define CYTHON_COMPILING_IN_LIMITED_API 0
  309. #define CYTHON_COMPILING_IN_GRAAL 0
  310. #define CYTHON_COMPILING_IN_NOGIL 0
  311. #ifndef CYTHON_USE_TYPE_SLOTS
  312. #define CYTHON_USE_TYPE_SLOTS 1
  313. #endif
  314. #ifndef CYTHON_USE_TYPE_SPECS
  315. #define CYTHON_USE_TYPE_SPECS 0
  316. #endif
  317. #ifndef CYTHON_USE_PYTYPE_LOOKUP
  318. #define CYTHON_USE_PYTYPE_LOOKUP 1
  319. #endif
  320. #if PY_MAJOR_VERSION < 3
  321. #undef CYTHON_USE_ASYNC_SLOTS
  322. #define CYTHON_USE_ASYNC_SLOTS 0
  323. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  324. #define CYTHON_USE_ASYNC_SLOTS 1
  325. #endif
  326. #ifndef CYTHON_USE_PYLONG_INTERNALS
  327. #define CYTHON_USE_PYLONG_INTERNALS 1
  328. #endif
  329. #ifndef CYTHON_USE_PYLIST_INTERNALS
  330. #define CYTHON_USE_PYLIST_INTERNALS 1
  331. #endif
  332. #ifndef CYTHON_USE_UNICODE_INTERNALS
  333. #define CYTHON_USE_UNICODE_INTERNALS 1
  334. #endif
  335. #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
  336. #undef CYTHON_USE_UNICODE_WRITER
  337. #define CYTHON_USE_UNICODE_WRITER 0
  338. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  339. #define CYTHON_USE_UNICODE_WRITER 1
  340. #endif
  341. #ifndef CYTHON_AVOID_BORROWED_REFS
  342. #define CYTHON_AVOID_BORROWED_REFS 0
  343. #endif
  344. #ifndef CYTHON_ASSUME_SAFE_MACROS
  345. #define CYTHON_ASSUME_SAFE_MACROS 1
  346. #endif
  347. #ifndef CYTHON_UNPACK_METHODS
  348. #define CYTHON_UNPACK_METHODS 1
  349. #endif
  350. #ifndef CYTHON_FAST_THREAD_STATE
  351. #define CYTHON_FAST_THREAD_STATE 1
  352. #endif
  353. #ifndef CYTHON_FAST_GIL
  354. #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
  355. #endif
  356. #ifndef CYTHON_METH_FASTCALL
  357. #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
  358. #endif
  359. #ifndef CYTHON_FAST_PYCALL
  360. #define CYTHON_FAST_PYCALL 1
  361. #endif
  362. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  363. #define CYTHON_PEP487_INIT_SUBCLASS 1
  364. #endif
  365. #if PY_VERSION_HEX < 0x03050000
  366. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  367. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  368. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  369. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  370. #endif
  371. #ifndef CYTHON_USE_MODULE_STATE
  372. #define CYTHON_USE_MODULE_STATE 0
  373. #endif
  374. #if PY_VERSION_HEX < 0x030400a1
  375. #undef CYTHON_USE_TP_FINALIZE
  376. #define CYTHON_USE_TP_FINALIZE 0
  377. #elif !defined(CYTHON_USE_TP_FINALIZE)
  378. #define CYTHON_USE_TP_FINALIZE 1
  379. #endif
  380. #if PY_VERSION_HEX < 0x030600B1
  381. #undef CYTHON_USE_DICT_VERSIONS
  382. #define CYTHON_USE_DICT_VERSIONS 0
  383. #elif !defined(CYTHON_USE_DICT_VERSIONS)
  384. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
  385. #endif
  386. #if PY_VERSION_HEX < 0x030700A3
  387. #undef CYTHON_USE_EXC_INFO_STACK
  388. #define CYTHON_USE_EXC_INFO_STACK 0
  389. #elif !defined(CYTHON_USE_EXC_INFO_STACK)
  390. #define CYTHON_USE_EXC_INFO_STACK 1
  391. #endif
  392. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  393. #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  394. #endif
  395. #endif
  396. #if !defined(CYTHON_FAST_PYCCALL)
  397. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  398. #endif
  399. #if !defined(CYTHON_VECTORCALL)
  400. #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
  401. #endif
  402. #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
  403. #if CYTHON_USE_PYLONG_INTERNALS
  404. #if PY_MAJOR_VERSION < 3
  405. #include "longintrepr.h"
  406. #endif
  407. #undef SHIFT
  408. #undef BASE
  409. #undef MASK
  410. #ifdef SIZEOF_VOID_P
  411. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  412. #endif
  413. #endif
  414. #ifndef __has_attribute
  415. #define __has_attribute(x) 0
  416. #endif
  417. #ifndef __has_cpp_attribute
  418. #define __has_cpp_attribute(x) 0
  419. #endif
  420. #ifndef CYTHON_RESTRICT
  421. #if defined(__GNUC__)
  422. #define CYTHON_RESTRICT __restrict__
  423. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  424. #define CYTHON_RESTRICT __restrict
  425. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  426. #define CYTHON_RESTRICT restrict
  427. #else
  428. #define CYTHON_RESTRICT
  429. #endif
  430. #endif
  431. #ifndef CYTHON_UNUSED
  432. #if defined(__cplusplus)
  433. /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
  434. * but leads to warnings with -pedantic, since it is a C++17 feature */
  435. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  436. #if __has_cpp_attribute(maybe_unused)
  437. #define CYTHON_UNUSED [[maybe_unused]]
  438. #endif
  439. #endif
  440. #endif
  441. #endif
  442. #ifndef CYTHON_UNUSED
  443. # if defined(__GNUC__)
  444. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  445. # define CYTHON_UNUSED __attribute__ ((__unused__))
  446. # else
  447. # define CYTHON_UNUSED
  448. # endif
  449. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  450. # define CYTHON_UNUSED __attribute__ ((__unused__))
  451. # else
  452. # define CYTHON_UNUSED
  453. # endif
  454. #endif
  455. #ifndef CYTHON_UNUSED_VAR
  456. # if defined(__cplusplus)
  457. template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
  458. # else
  459. # define CYTHON_UNUSED_VAR(x) (void)(x)
  460. # endif
  461. #endif
  462. #ifndef CYTHON_MAYBE_UNUSED_VAR
  463. #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
  464. #endif
  465. #ifndef CYTHON_NCP_UNUSED
  466. # if CYTHON_COMPILING_IN_CPYTHON
  467. # define CYTHON_NCP_UNUSED
  468. # else
  469. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  470. # endif
  471. #endif
  472. #ifndef CYTHON_USE_CPP_STD_MOVE
  473. #if defined(__cplusplus) && (\
  474. __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
  475. #define CYTHON_USE_CPP_STD_MOVE 1
  476. #else
  477. #define CYTHON_USE_CPP_STD_MOVE 0
  478. #endif
  479. #endif
  480. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  481. #ifdef _MSC_VER
  482. #ifndef _MSC_STDINT_H_
  483. #if _MSC_VER < 1300
  484. typedef unsigned char uint8_t;
  485. typedef unsigned short uint16_t;
  486. typedef unsigned int uint32_t;
  487. #else
  488. typedef unsigned __int8 uint8_t;
  489. typedef unsigned __int16 uint16_t;
  490. typedef unsigned __int32 uint32_t;
  491. #endif
  492. #endif
  493. #if _MSC_VER < 1300
  494. #ifdef _WIN64
  495. typedef unsigned long long __pyx_uintptr_t;
  496. #else
  497. typedef unsigned int __pyx_uintptr_t;
  498. #endif
  499. #else
  500. #ifdef _WIN64
  501. typedef unsigned __int64 __pyx_uintptr_t;
  502. #else
  503. typedef unsigned __int32 __pyx_uintptr_t;
  504. #endif
  505. #endif
  506. #else
  507. #include <stdint.h>
  508. typedef uintptr_t __pyx_uintptr_t;
  509. #endif
  510. #ifndef CYTHON_FALLTHROUGH
  511. #if defined(__cplusplus)
  512. /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
  513. * but leads to warnings with -pedantic, since it is a C++17 feature */
  514. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  515. #if __has_cpp_attribute(fallthrough)
  516. #define CYTHON_FALLTHROUGH [[fallthrough]]
  517. #endif
  518. #endif
  519. #ifndef CYTHON_FALLTHROUGH
  520. #if __has_cpp_attribute(clang::fallthrough)
  521. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  522. #elif __has_cpp_attribute(gnu::fallthrough)
  523. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  524. #endif
  525. #endif
  526. #endif
  527. #ifndef CYTHON_FALLTHROUGH
  528. #if __has_attribute(fallthrough)
  529. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  530. #else
  531. #define CYTHON_FALLTHROUGH
  532. #endif
  533. #endif
  534. #if defined(__clang__) && defined(__apple_build_version__)
  535. #if __apple_build_version__ < 7000000
  536. #undef CYTHON_FALLTHROUGH
  537. #define CYTHON_FALLTHROUGH
  538. #endif
  539. #endif
  540. #endif
  541. #ifdef __cplusplus
  542. template <typename T>
  543. struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  544. #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
  545. #else
  546. #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
  547. #endif
  548. #if CYTHON_COMPILING_IN_PYPY == 1
  549. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
  550. #else
  551. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
  552. #endif
  553. #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
  554. #ifndef CYTHON_INLINE
  555. #if defined(__clang__)
  556. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  557. #elif defined(__GNUC__)
  558. #define CYTHON_INLINE __inline__
  559. #elif defined(_MSC_VER)
  560. #define CYTHON_INLINE __inline
  561. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  562. #define CYTHON_INLINE inline
  563. #else
  564. #define CYTHON_INLINE
  565. #endif
  566. #endif
  567. #define __PYX_BUILD_PY_SSIZE_T "n"
  568. #define CYTHON_FORMAT_SSIZE_T "z"
  569. #if PY_MAJOR_VERSION < 3
  570. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  571. #define __Pyx_DefaultClassType PyClass_Type
  572. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  573. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  574. #else
  575. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  576. #define __Pyx_DefaultClassType PyType_Type
  577. #if CYTHON_COMPILING_IN_LIMITED_API
  578. static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
  579. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  580. PyObject *fv, PyObject *cell, PyObject* fn,
  581. PyObject *name, int fline, PyObject *lnos) {
  582. PyObject *exception_table = NULL;
  583. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  584. #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
  585. PyObject *version_info; // borrowed
  586. PyObject *py_minor_version = NULL;
  587. #endif
  588. long minor_version = 0;
  589. PyObject *type, *value, *traceback;
  590. PyErr_Fetch(&type, &value, &traceback);
  591. #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
  592. minor_version = 11; // we don't yet need to distinguish between versions > 11
  593. #else
  594. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  595. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  596. minor_version = PyLong_AsLong(py_minor_version);
  597. Py_DECREF(py_minor_version);
  598. if (minor_version == -1 && PyErr_Occurred()) goto end;
  599. #endif
  600. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  601. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  602. if (minor_version <= 7) {
  603. (void)p;
  604. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
  605. c, n, v, fn, name, fline, lnos, fv, cell);
  606. } else if (minor_version <= 10) {
  607. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
  608. c, n, v, fn, name, fline, lnos, fv, cell);
  609. } else {
  610. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  611. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
  612. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  613. }
  614. end:
  615. Py_XDECREF(code_type);
  616. Py_XDECREF(exception_table);
  617. Py_XDECREF(types_module);
  618. if (type) {
  619. PyErr_Restore(type, value, traceback);
  620. }
  621. return result;
  622. }
  623. #ifndef CO_OPTIMIZED
  624. #define CO_OPTIMIZED 0x0001
  625. #endif
  626. #ifndef CO_NEWLOCALS
  627. #define CO_NEWLOCALS 0x0002
  628. #endif
  629. #ifndef CO_VARARGS
  630. #define CO_VARARGS 0x0004
  631. #endif
  632. #ifndef CO_VARKEYWORDS
  633. #define CO_VARKEYWORDS 0x0008
  634. #endif
  635. #ifndef CO_ASYNC_GENERATOR
  636. #define CO_ASYNC_GENERATOR 0x0200
  637. #endif
  638. #ifndef CO_GENERATOR
  639. #define CO_GENERATOR 0x0020
  640. #endif
  641. #ifndef CO_COROUTINE
  642. #define CO_COROUTINE 0x0080
  643. #endif
  644. #elif PY_VERSION_HEX >= 0x030B0000
  645. static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
  646. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  647. PyObject *fv, PyObject *cell, PyObject* fn,
  648. PyObject *name, int fline, PyObject *lnos) {
  649. PyCodeObject *result;
  650. PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here
  651. if (!empty_bytes) return NULL;
  652. result =
  653. #if PY_VERSION_HEX >= 0x030C0000
  654. PyUnstable_Code_NewWithPosOnlyArgs
  655. #else
  656. PyCode_NewWithPosOnlyArgs
  657. #endif
  658. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
  659. Py_DECREF(empty_bytes);
  660. return result;
  661. }
  662. #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
  663. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  664. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  665. #else
  666. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  667. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  668. #endif
  669. #endif
  670. #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  671. #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
  672. #else
  673. #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
  674. #endif
  675. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  676. #define __Pyx_Py_Is(x, y) Py_Is(x, y)
  677. #else
  678. #define __Pyx_Py_Is(x, y) ((x) == (y))
  679. #endif
  680. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  681. #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
  682. #else
  683. #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
  684. #endif
  685. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  686. #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
  687. #else
  688. #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
  689. #endif
  690. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  691. #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
  692. #else
  693. #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
  694. #endif
  695. #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
  696. #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  697. #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
  698. #else
  699. #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
  700. #endif
  701. #ifndef CO_COROUTINE
  702. #define CO_COROUTINE 0x80
  703. #endif
  704. #ifndef CO_ASYNC_GENERATOR
  705. #define CO_ASYNC_GENERATOR 0x200
  706. #endif
  707. #ifndef Py_TPFLAGS_CHECKTYPES
  708. #define Py_TPFLAGS_CHECKTYPES 0
  709. #endif
  710. #ifndef Py_TPFLAGS_HAVE_INDEX
  711. #define Py_TPFLAGS_HAVE_INDEX 0
  712. #endif
  713. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  714. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  715. #endif
  716. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  717. #define Py_TPFLAGS_HAVE_FINALIZE 0
  718. #endif
  719. #ifndef Py_TPFLAGS_SEQUENCE
  720. #define Py_TPFLAGS_SEQUENCE 0
  721. #endif
  722. #ifndef Py_TPFLAGS_MAPPING
  723. #define Py_TPFLAGS_MAPPING 0
  724. #endif
  725. #ifndef METH_STACKLESS
  726. #define METH_STACKLESS 0
  727. #endif
  728. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  729. #ifndef METH_FASTCALL
  730. #define METH_FASTCALL 0x80
  731. #endif
  732. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  733. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  734. Py_ssize_t nargs, PyObject *kwnames);
  735. #else
  736. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  737. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  738. #endif
  739. #if CYTHON_METH_FASTCALL
  740. #define __Pyx_METH_FASTCALL METH_FASTCALL
  741. #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  742. #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
  743. #else
  744. #define __Pyx_METH_FASTCALL METH_VARARGS
  745. #define __Pyx_PyCFunction_FastCall PyCFunction
  746. #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
  747. #endif
  748. #if CYTHON_VECTORCALL
  749. #define __pyx_vectorcallfunc vectorcallfunc
  750. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
  751. #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
  752. #elif CYTHON_BACKPORT_VECTORCALL
  753. typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
  754. size_t nargsf, PyObject *kwnames);
  755. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
  756. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
  757. #else
  758. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
  759. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
  760. #endif
  761. #if PY_MAJOR_VERSION >= 0x030900B1
  762. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
  763. #else
  764. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
  765. #endif
  766. #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
  767. #if CYTHON_COMPILING_IN_CPYTHON
  768. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
  769. #elif !CYTHON_COMPILING_IN_LIMITED_API
  770. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
  771. #endif
  772. #if CYTHON_COMPILING_IN_CPYTHON
  773. #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
  774. static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
  775. return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
  776. }
  777. #endif
  778. static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
  779. #if CYTHON_COMPILING_IN_LIMITED_API
  780. return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  781. #else
  782. return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  783. #endif
  784. }
  785. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
  786. #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
  787. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
  788. typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
  789. #else
  790. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
  791. #define __Pyx_PyCMethod PyCMethod
  792. #endif
  793. #ifndef METH_METHOD
  794. #define METH_METHOD 0x200
  795. #endif
  796. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  797. #define PyObject_Malloc(s) PyMem_Malloc(s)
  798. #define PyObject_Free(p) PyMem_Free(p)
  799. #define PyObject_Realloc(p) PyMem_Realloc(p)
  800. #endif
  801. #if CYTHON_COMPILING_IN_LIMITED_API
  802. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  803. #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
  804. #else
  805. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  806. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  807. #endif
  808. #if CYTHON_COMPILING_IN_LIMITED_API
  809. #define __Pyx_PyThreadState_Current PyThreadState_Get()
  810. #elif !CYTHON_FAST_THREAD_STATE
  811. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  812. #elif PY_VERSION_HEX >= 0x030d00A1
  813. #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
  814. #elif PY_VERSION_HEX >= 0x03060000
  815. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  816. #elif PY_VERSION_HEX >= 0x03000000
  817. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  818. #else
  819. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  820. #endif
  821. #if CYTHON_COMPILING_IN_LIMITED_API
  822. static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
  823. {
  824. void *result;
  825. result = PyModule_GetState(op);
  826. if (!result)
  827. Py_FatalError("Couldn't find the module state");
  828. return result;
  829. }
  830. #endif
  831. #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
  832. #if CYTHON_COMPILING_IN_LIMITED_API
  833. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
  834. #else
  835. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
  836. #endif
  837. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  838. #include "pythread.h"
  839. #define Py_tss_NEEDS_INIT 0
  840. typedef int Py_tss_t;
  841. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  842. *key = PyThread_create_key();
  843. return 0;
  844. }
  845. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  846. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  847. *key = Py_tss_NEEDS_INIT;
  848. return key;
  849. }
  850. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  851. PyObject_Free(key);
  852. }
  853. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  854. return *key != Py_tss_NEEDS_INIT;
  855. }
  856. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  857. PyThread_delete_key(*key);
  858. *key = Py_tss_NEEDS_INIT;
  859. }
  860. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  861. return PyThread_set_key_value(*key, value);
  862. }
  863. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  864. return PyThread_get_key_value(*key);
  865. }
  866. #endif
  867. #if PY_MAJOR_VERSION < 3
  868. #if CYTHON_COMPILING_IN_PYPY
  869. #if PYPY_VERSION_NUM < 0x07030600
  870. #if defined(__cplusplus) && __cplusplus >= 201402L
  871. [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
  872. #elif defined(__GNUC__) || defined(__clang__)
  873. __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
  874. #elif defined(_MSC_VER)
  875. __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
  876. #endif
  877. static CYTHON_INLINE int PyGILState_Check(void) {
  878. return 0;
  879. }
  880. #else // PYPY_VERSION_NUM < 0x07030600
  881. #endif // PYPY_VERSION_NUM < 0x07030600
  882. #else
  883. static CYTHON_INLINE int PyGILState_Check(void) {
  884. PyThreadState * tstate = _PyThreadState_Current;
  885. return tstate && (tstate == PyGILState_GetThisThreadState());
  886. }
  887. #endif
  888. #endif
  889. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
  890. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  891. #else
  892. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  893. #endif
  894. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  895. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  896. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  897. #else
  898. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  899. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  900. #endif
  901. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
  902. #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  903. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
  904. PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
  905. if (res == NULL) PyErr_Clear();
  906. return res;
  907. }
  908. #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
  909. #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
  910. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  911. #else
  912. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
  913. #if CYTHON_COMPILING_IN_PYPY
  914. return PyDict_GetItem(dict, name);
  915. #else
  916. PyDictEntry *ep;
  917. PyDictObject *mp = (PyDictObject*) dict;
  918. long hash = ((PyStringObject *) name)->ob_shash;
  919. assert(hash != -1);
  920. ep = (mp->ma_lookup)(mp, name, hash);
  921. if (ep == NULL) {
  922. return NULL;
  923. }
  924. return ep->me_value;
  925. #endif
  926. }
  927. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  928. #endif
  929. #if CYTHON_USE_TYPE_SLOTS
  930. #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
  931. #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
  932. #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
  933. #else
  934. #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
  935. #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
  936. #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
  937. #endif
  938. #if CYTHON_COMPILING_IN_LIMITED_API
  939. #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
  940. #else
  941. #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
  942. #endif
  943. #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
  944. #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
  945. PyTypeObject *type = Py_TYPE((PyObject*)obj);\
  946. assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
  947. PyObject_GC_Del(obj);\
  948. Py_DECREF(type);\
  949. }
  950. #else
  951. #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
  952. #endif
  953. #if CYTHON_COMPILING_IN_LIMITED_API
  954. #define CYTHON_PEP393_ENABLED 1
  955. #define __Pyx_PyUnicode_READY(op) (0)
  956. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
  957. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  958. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
  959. #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
  960. #define __Pyx_PyUnicode_DATA(u) ((void*)u)
  961. #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  962. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
  963. #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  964. #define CYTHON_PEP393_ENABLED 1
  965. #if PY_VERSION_HEX >= 0x030C0000
  966. #define __Pyx_PyUnicode_READY(op) (0)
  967. #else
  968. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  969. 0 : _PyUnicode_Ready((PyObject *)(op)))
  970. #endif
  971. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  972. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  973. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  974. #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
  975. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  976. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  977. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  978. #if PY_VERSION_HEX >= 0x030C0000
  979. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
  980. #else
  981. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  982. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  983. #else
  984. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  985. #endif
  986. #endif
  987. #else
  988. #define CYTHON_PEP393_ENABLED 0
  989. #define PyUnicode_1BYTE_KIND 1
  990. #define PyUnicode_2BYTE_KIND 2
  991. #define PyUnicode_4BYTE_KIND 4
  992. #define __Pyx_PyUnicode_READY(op) (0)
  993. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  994. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  995. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
  996. #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
  997. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  998. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  999. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
  1000. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  1001. #endif
  1002. #if CYTHON_COMPILING_IN_PYPY
  1003. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  1004. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  1005. #else
  1006. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  1007. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  1008. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  1009. #endif
  1010. #if CYTHON_COMPILING_IN_PYPY
  1011. #if !defined(PyUnicode_DecodeUnicodeEscape)
  1012. #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
  1013. #endif
  1014. #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
  1015. #undef PyUnicode_Contains
  1016. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  1017. #endif
  1018. #if !defined(PyByteArray_Check)
  1019. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  1020. #endif
  1021. #if !defined(PyObject_Format)
  1022. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  1023. #endif
  1024. #endif
  1025. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  1026. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  1027. #if PY_MAJOR_VERSION >= 3
  1028. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  1029. #else
  1030. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  1031. #endif
  1032. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  1033. #define PyObject_ASCII(o) PyObject_Repr(o)
  1034. #endif
  1035. #if PY_MAJOR_VERSION >= 3
  1036. #define PyBaseString_Type PyUnicode_Type
  1037. #define PyStringObject PyUnicodeObject
  1038. #define PyString_Type PyUnicode_Type
  1039. #define PyString_Check PyUnicode_Check
  1040. #define PyString_CheckExact PyUnicode_CheckExact
  1041. #ifndef PyObject_Unicode
  1042. #define PyObject_Unicode PyObject_Str
  1043. #endif
  1044. #endif
  1045. #if PY_MAJOR_VERSION >= 3
  1046. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  1047. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  1048. #else
  1049. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  1050. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  1051. #endif
  1052. #if CYTHON_COMPILING_IN_CPYTHON
  1053. #define __Pyx_PySequence_ListKeepNew(obj)\
  1054. (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  1055. #else
  1056. #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
  1057. #endif
  1058. #ifndef PySet_CheckExact
  1059. #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
  1060. #endif
  1061. #if PY_VERSION_HEX >= 0x030900A4
  1062. #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  1063. #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  1064. #else
  1065. #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  1066. #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  1067. #endif
  1068. #if CYTHON_ASSUME_SAFE_MACROS
  1069. #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  1070. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  1071. #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  1072. #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  1073. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  1074. #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  1075. #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  1076. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  1077. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  1078. #else
  1079. #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  1080. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  1081. #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  1082. #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  1083. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  1084. #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  1085. #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  1086. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  1087. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  1088. #endif
  1089. #if PY_VERSION_HEX >= 0x030d00A1
  1090. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  1091. #else
  1092. static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  1093. PyObject *module = PyImport_AddModule(name);
  1094. Py_XINCREF(module);
  1095. return module;
  1096. }
  1097. #endif
  1098. #if PY_MAJOR_VERSION >= 3
  1099. #define PyIntObject PyLongObject
  1100. #define PyInt_Type PyLong_Type
  1101. #define PyInt_Check(op) PyLong_Check(op)
  1102. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  1103. #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
  1104. #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
  1105. #define PyInt_FromString PyLong_FromString
  1106. #define PyInt_FromUnicode PyLong_FromUnicode
  1107. #define PyInt_FromLong PyLong_FromLong
  1108. #define PyInt_FromSize_t PyLong_FromSize_t
  1109. #define PyInt_FromSsize_t PyLong_FromSsize_t
  1110. #define PyInt_AsLong PyLong_AsLong
  1111. #define PyInt_AS_LONG PyLong_AS_LONG
  1112. #define PyInt_AsSsize_t PyLong_AsSsize_t
  1113. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  1114. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  1115. #define PyNumber_Int PyNumber_Long
  1116. #else
  1117. #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
  1118. #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
  1119. #endif
  1120. #if PY_MAJOR_VERSION >= 3
  1121. #define PyBoolObject PyLongObject
  1122. #endif
  1123. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  1124. #ifndef PyUnicode_InternFromString
  1125. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  1126. #endif
  1127. #endif
  1128. #if PY_VERSION_HEX < 0x030200A4
  1129. typedef long Py_hash_t;
  1130. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  1131. #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
  1132. #else
  1133. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  1134. #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
  1135. #endif
  1136. #if CYTHON_USE_ASYNC_SLOTS
  1137. #if PY_VERSION_HEX >= 0x030500B1
  1138. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  1139. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  1140. #else
  1141. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  1142. #endif
  1143. #else
  1144. #define __Pyx_PyType_AsAsync(obj) NULL
  1145. #endif
  1146. #ifndef __Pyx_PyAsyncMethodsStruct
  1147. typedef struct {
  1148. unaryfunc am_await;
  1149. unaryfunc am_aiter;
  1150. unaryfunc am_anext;
  1151. } __Pyx_PyAsyncMethodsStruct;
  1152. #endif
  1153. #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  1154. #if !defined(_USE_MATH_DEFINES)
  1155. #define _USE_MATH_DEFINES
  1156. #endif
  1157. #endif
  1158. #include <math.h>
  1159. #ifdef NAN
  1160. #define __PYX_NAN() ((float) NAN)
  1161. #else
  1162. static CYTHON_INLINE float __PYX_NAN() {
  1163. float value;
  1164. memset(&value, 0xFF, sizeof(value));
  1165. return value;
  1166. }
  1167. #endif
  1168. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  1169. #define __Pyx_truncl trunc
  1170. #else
  1171. #define __Pyx_truncl truncl
  1172. #endif
  1173. #define __PYX_MARK_ERR_POS(f_index, lineno) \
  1174. { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
  1175. #define __PYX_ERR(f_index, lineno, Ln_error) \
  1176. { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  1177. #ifdef CYTHON_EXTERN_C
  1178. #undef __PYX_EXTERN_C
  1179. #define __PYX_EXTERN_C CYTHON_EXTERN_C
  1180. #elif defined(__PYX_EXTERN_C)
  1181. #ifdef _MSC_VER
  1182. #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
  1183. #else
  1184. #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
  1185. #endif
  1186. #else
  1187. #ifdef __cplusplus
  1188. #define __PYX_EXTERN_C extern "C"
  1189. #else
  1190. #define __PYX_EXTERN_C extern
  1191. #endif
  1192. #endif
  1193. #define __PYX_HAVE__fontTools__qu2cu__qu2cu
  1194. #define __PYX_HAVE_API__fontTools__qu2cu__qu2cu
  1195. /* Early includes */
  1196. #ifdef _OPENMP
  1197. #include <omp.h>
  1198. #endif /* _OPENMP */
  1199. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  1200. #define CYTHON_WITHOUT_ASSERTIONS
  1201. #endif
  1202. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  1203. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  1204. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1205. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1206. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  1207. #define __PYX_DEFAULT_STRING_ENCODING ""
  1208. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1209. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1210. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1211. #define __Pyx_long_cast(x) ((long)x)
  1212. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1213. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1214. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1215. likely(v < (type)PY_SSIZE_T_MAX ||\
  1216. v == (type)PY_SSIZE_T_MAX) &&\
  1217. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1218. v == (type)PY_SSIZE_T_MIN))) ||\
  1219. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1220. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1221. v == (type)PY_SSIZE_T_MAX))) )
  1222. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1223. return (size_t) i < (size_t) limit;
  1224. }
  1225. #if defined (__cplusplus) && __cplusplus >= 201103L
  1226. #include <cstdlib>
  1227. #define __Pyx_sst_abs(value) std::abs(value)
  1228. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1229. #define __Pyx_sst_abs(value) abs(value)
  1230. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1231. #define __Pyx_sst_abs(value) labs(value)
  1232. #elif defined (_MSC_VER)
  1233. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1234. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1235. #define __Pyx_sst_abs(value) llabs(value)
  1236. #elif defined (__GNUC__)
  1237. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1238. #else
  1239. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1240. #endif
  1241. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1242. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1243. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1244. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1245. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1246. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1247. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1248. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1249. #if PY_MAJOR_VERSION < 3
  1250. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  1251. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1252. #else
  1253. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  1254. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  1255. #endif
  1256. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1257. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1258. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1259. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1260. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1261. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1262. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1263. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1264. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1265. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1266. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1267. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1268. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1269. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1270. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  1271. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1272. #if CYTHON_COMPILING_IN_LIMITED_API
  1273. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u)
  1274. {
  1275. const wchar_t *u_end = u;
  1276. while (*u_end++) ;
  1277. return (size_t)(u_end - u - 1);
  1278. }
  1279. #else
  1280. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  1281. {
  1282. const Py_UNICODE *u_end = u;
  1283. while (*u_end++) ;
  1284. return (size_t)(u_end - u - 1);
  1285. }
  1286. #endif
  1287. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1288. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  1289. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  1290. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1291. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  1292. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  1293. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1294. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1295. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1296. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  1297. #define __Pyx_PySequence_Tuple(obj)\
  1298. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1299. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1300. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  1301. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1302. #if CYTHON_ASSUME_SAFE_MACROS
  1303. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1304. #else
  1305. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1306. #endif
  1307. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  1308. #if PY_MAJOR_VERSION >= 3
  1309. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1310. #else
  1311. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  1312. #endif
  1313. #if CYTHON_USE_PYLONG_INTERNALS
  1314. #if PY_VERSION_HEX >= 0x030C00A7
  1315. #ifndef _PyLong_SIGN_MASK
  1316. #define _PyLong_SIGN_MASK 3
  1317. #endif
  1318. #ifndef _PyLong_NON_SIZE_BITS
  1319. #define _PyLong_NON_SIZE_BITS 3
  1320. #endif
  1321. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1322. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1323. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1324. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1325. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1326. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1327. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1328. #define __Pyx_PyLong_SignedDigitCount(x)\
  1329. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1330. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1331. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1332. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1333. #else
  1334. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1335. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1336. #endif
  1337. typedef Py_ssize_t __Pyx_compact_pylong;
  1338. typedef size_t __Pyx_compact_upylong;
  1339. #else // Py < 3.12
  1340. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1341. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1342. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1343. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1344. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1345. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1346. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1347. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1348. #define __Pyx_PyLong_CompactValue(x)\
  1349. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1350. typedef sdigit __Pyx_compact_pylong;
  1351. typedef digit __Pyx_compact_upylong;
  1352. #endif
  1353. #if PY_VERSION_HEX >= 0x030C00A5
  1354. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1355. #else
  1356. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1357. #endif
  1358. #endif
  1359. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1360. #include <string.h>
  1361. static int __Pyx_sys_getdefaultencoding_not_ascii;
  1362. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  1363. PyObject* sys;
  1364. PyObject* default_encoding = NULL;
  1365. PyObject* ascii_chars_u = NULL;
  1366. PyObject* ascii_chars_b = NULL;
  1367. const char* default_encoding_c;
  1368. sys = PyImport_ImportModule("sys");
  1369. if (!sys) goto bad;
  1370. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  1371. Py_DECREF(sys);
  1372. if (!default_encoding) goto bad;
  1373. default_encoding_c = PyBytes_AsString(default_encoding);
  1374. if (!default_encoding_c) goto bad;
  1375. if (strcmp(default_encoding_c, "ascii") == 0) {
  1376. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  1377. } else {
  1378. char ascii_chars[128];
  1379. int c;
  1380. for (c = 0; c < 128; c++) {
  1381. ascii_chars[c] = (char) c;
  1382. }
  1383. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  1384. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  1385. if (!ascii_chars_u) goto bad;
  1386. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  1387. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  1388. PyErr_Format(
  1389. PyExc_ValueError,
  1390. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  1391. default_encoding_c);
  1392. goto bad;
  1393. }
  1394. Py_DECREF(ascii_chars_u);
  1395. Py_DECREF(ascii_chars_b);
  1396. }
  1397. Py_DECREF(default_encoding);
  1398. return 0;
  1399. bad:
  1400. Py_XDECREF(default_encoding);
  1401. Py_XDECREF(ascii_chars_u);
  1402. Py_XDECREF(ascii_chars_b);
  1403. return -1;
  1404. }
  1405. #endif
  1406. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  1407. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1408. #else
  1409. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1410. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  1411. #include <string.h>
  1412. static char* __PYX_DEFAULT_STRING_ENCODING;
  1413. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  1414. PyObject* sys;
  1415. PyObject* default_encoding = NULL;
  1416. char* default_encoding_c;
  1417. sys = PyImport_ImportModule("sys");
  1418. if (!sys) goto bad;
  1419. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  1420. Py_DECREF(sys);
  1421. if (!default_encoding) goto bad;
  1422. default_encoding_c = PyBytes_AsString(default_encoding);
  1423. if (!default_encoding_c) goto bad;
  1424. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  1425. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  1426. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  1427. Py_DECREF(default_encoding);
  1428. return 0;
  1429. bad:
  1430. Py_XDECREF(default_encoding);
  1431. return -1;
  1432. }
  1433. #endif
  1434. #endif
  1435. /* Test for GCC > 2.95 */
  1436. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1437. #define likely(x) __builtin_expect(!!(x), 1)
  1438. #define unlikely(x) __builtin_expect(!!(x), 0)
  1439. #else /* !__GNUC__ or GCC < 2.95 */
  1440. #define likely(x) (x)
  1441. #define unlikely(x) (x)
  1442. #endif /* __GNUC__ */
  1443. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1444. #if !CYTHON_USE_MODULE_STATE
  1445. static PyObject *__pyx_m = NULL;
  1446. #endif
  1447. static int __pyx_lineno;
  1448. static int __pyx_clineno = 0;
  1449. static const char * __pyx_cfilenm = __FILE__;
  1450. static const char *__pyx_filename;
  1451. /* Header.proto */
  1452. #if !defined(CYTHON_CCOMPLEX)
  1453. #if defined(__cplusplus)
  1454. #define CYTHON_CCOMPLEX 1
  1455. #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
  1456. #define CYTHON_CCOMPLEX 1
  1457. #else
  1458. #define CYTHON_CCOMPLEX 0
  1459. #endif
  1460. #endif
  1461. #if CYTHON_CCOMPLEX
  1462. #ifdef __cplusplus
  1463. #include <complex>
  1464. #else
  1465. #include <complex.h>
  1466. #endif
  1467. #endif
  1468. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  1469. #undef _Complex_I
  1470. #define _Complex_I 1.0fj
  1471. #endif
  1472. /* #### Code section: filename_table ### */
  1473. static const char *__pyx_f[] = {
  1474. "Lib/fontTools/qu2cu/qu2cu.py",
  1475. };
  1476. /* #### Code section: utility_code_proto_before_types ### */
  1477. /* ForceInitThreads.proto */
  1478. #ifndef __PYX_FORCE_INIT_THREADS
  1479. #define __PYX_FORCE_INIT_THREADS 0
  1480. #endif
  1481. /* #### Code section: numeric_typedefs ### */
  1482. /* #### Code section: complex_type_declarations ### */
  1483. /* Declarations.proto */
  1484. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  1485. #ifdef __cplusplus
  1486. typedef ::std::complex< double > __pyx_t_double_complex;
  1487. #else
  1488. typedef double _Complex __pyx_t_double_complex;
  1489. #endif
  1490. #else
  1491. typedef struct { double real, imag; } __pyx_t_double_complex;
  1492. #endif
  1493. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1494. /* #### Code section: type_declarations ### */
  1495. /*--- Type declarations ---*/
  1496. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr;
  1497. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr;
  1498. /* "fontTools/qu2cu/qu2cu.py":238
  1499. *
  1500. * if not is_complex:
  1501. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves] # <<<<<<<<<<<<<<
  1502. * return curves
  1503. *
  1504. */
  1505. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr {
  1506. PyObject_HEAD
  1507. PyObject *__pyx_genexpr_arg_0;
  1508. PyObject *__pyx_v_c;
  1509. int __pyx_v_cost;
  1510. int __pyx_v_is_complex;
  1511. PyObject *__pyx_t_0;
  1512. Py_ssize_t __pyx_t_1;
  1513. PyObject *(*__pyx_t_2)(PyObject *);
  1514. };
  1515. /* "fontTools/qu2cu/qu2cu.py":343
  1516. * for k, reconst in enumerate(reconstructed):
  1517. * orig = elevated_quadratics[j + k]
  1518. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig)) # <<<<<<<<<<<<<<
  1519. *
  1520. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance):
  1521. */
  1522. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr {
  1523. PyObject_HEAD
  1524. PyObject *__pyx_genexpr_arg_0;
  1525. int __pyx_v_all_cubic;
  1526. int __pyx_v_count;
  1527. double __pyx_v_err;
  1528. double __pyx_v_error;
  1529. int __pyx_v_i;
  1530. int __pyx_v_i_sol_count;
  1531. double __pyx_v_i_sol_error;
  1532. int __pyx_v_is_cubic;
  1533. int __pyx_v_j;
  1534. int __pyx_v_j_sol_count;
  1535. double __pyx_v_j_sol_error;
  1536. int __pyx_v_k;
  1537. __pyx_t_double_complex __pyx_v_p0;
  1538. __pyx_t_double_complex __pyx_v_p1;
  1539. __pyx_t_double_complex __pyx_v_p2;
  1540. __pyx_t_double_complex __pyx_v_p3;
  1541. int __pyx_v_start;
  1542. int __pyx_v_this_sol_count;
  1543. double __pyx_v_tolerance;
  1544. __pyx_t_double_complex __pyx_v_u;
  1545. __pyx_t_double_complex __pyx_v_v;
  1546. PyObject *__pyx_t_0;
  1547. Py_ssize_t __pyx_t_1;
  1548. PyObject *(*__pyx_t_2)(PyObject *);
  1549. };
  1550. /* #### Code section: utility_code_proto ### */
  1551. /* --- Runtime support code (head) --- */
  1552. /* Refnanny.proto */
  1553. #ifndef CYTHON_REFNANNY
  1554. #define CYTHON_REFNANNY 0
  1555. #endif
  1556. #if CYTHON_REFNANNY
  1557. typedef struct {
  1558. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1559. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1560. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1561. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1562. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1563. void (*FinishContext)(void**);
  1564. } __Pyx_RefNannyAPIStruct;
  1565. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1566. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1567. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1568. #ifdef WITH_THREAD
  1569. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1570. if (acquire_gil) {\
  1571. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1572. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1573. PyGILState_Release(__pyx_gilstate_save);\
  1574. } else {\
  1575. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1576. }
  1577. #define __Pyx_RefNannyFinishContextNogil() {\
  1578. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1579. __Pyx_RefNannyFinishContext();\
  1580. PyGILState_Release(__pyx_gilstate_save);\
  1581. }
  1582. #else
  1583. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1584. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
  1585. #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
  1586. #endif
  1587. #define __Pyx_RefNannyFinishContextNogil() {\
  1588. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1589. __Pyx_RefNannyFinishContext();\
  1590. PyGILState_Release(__pyx_gilstate_save);\
  1591. }
  1592. #define __Pyx_RefNannyFinishContext()\
  1593. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1594. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1595. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1596. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1597. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1598. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1599. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1600. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1601. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1602. #else
  1603. #define __Pyx_RefNannyDeclarations
  1604. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1605. #define __Pyx_RefNannyFinishContextNogil()
  1606. #define __Pyx_RefNannyFinishContext()
  1607. #define __Pyx_INCREF(r) Py_INCREF(r)
  1608. #define __Pyx_DECREF(r) Py_DECREF(r)
  1609. #define __Pyx_GOTREF(r)
  1610. #define __Pyx_GIVEREF(r)
  1611. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1612. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1613. #define __Pyx_XGOTREF(r)
  1614. #define __Pyx_XGIVEREF(r)
  1615. #endif
  1616. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1617. PyObject *tmp = (PyObject *) r;\
  1618. r = v; Py_XDECREF(tmp);\
  1619. } while (0)
  1620. #define __Pyx_XDECREF_SET(r, v) do {\
  1621. PyObject *tmp = (PyObject *) r;\
  1622. r = v; __Pyx_XDECREF(tmp);\
  1623. } while (0)
  1624. #define __Pyx_DECREF_SET(r, v) do {\
  1625. PyObject *tmp = (PyObject *) r;\
  1626. r = v; __Pyx_DECREF(tmp);\
  1627. } while (0)
  1628. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1629. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1630. /* PyErrExceptionMatches.proto */
  1631. #if CYTHON_FAST_THREAD_STATE
  1632. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1633. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1634. #else
  1635. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1636. #endif
  1637. /* PyThreadStateGet.proto */
  1638. #if CYTHON_FAST_THREAD_STATE
  1639. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1640. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1641. #if PY_VERSION_HEX >= 0x030C00A6
  1642. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1643. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1644. #else
  1645. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1646. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1647. #endif
  1648. #else
  1649. #define __Pyx_PyThreadState_declare
  1650. #define __Pyx_PyThreadState_assign
  1651. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1652. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1653. #endif
  1654. /* PyErrFetchRestore.proto */
  1655. #if CYTHON_FAST_THREAD_STATE
  1656. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1657. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1658. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1659. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1660. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1661. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1662. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1663. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1664. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1665. #else
  1666. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1667. #endif
  1668. #else
  1669. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1670. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1671. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1672. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1673. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1674. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1675. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1676. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1677. #endif
  1678. /* PyObjectGetAttrStr.proto */
  1679. #if CYTHON_USE_TYPE_SLOTS
  1680. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1681. #else
  1682. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1683. #endif
  1684. /* PyObjectGetAttrStrNoError.proto */
  1685. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1686. /* GetBuiltinName.proto */
  1687. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1688. /* TupleAndListFromArray.proto */
  1689. #if CYTHON_COMPILING_IN_CPYTHON
  1690. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1691. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1692. #endif
  1693. /* IncludeStringH.proto */
  1694. #include <string.h>
  1695. /* BytesEquals.proto */
  1696. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1697. /* UnicodeEquals.proto */
  1698. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1699. /* fastcall.proto */
  1700. #if CYTHON_AVOID_BORROWED_REFS
  1701. #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
  1702. #elif CYTHON_ASSUME_SAFE_MACROS
  1703. #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
  1704. #else
  1705. #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
  1706. #endif
  1707. #if CYTHON_AVOID_BORROWED_REFS
  1708. #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
  1709. #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
  1710. #else
  1711. #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op
  1712. #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed
  1713. #endif
  1714. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1715. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1716. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1717. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1718. #if CYTHON_METH_FASTCALL
  1719. #define __Pyx_Arg_FASTCALL(args, i) args[i]
  1720. #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
  1721. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1722. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1723. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1724. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1725. #else
  1726. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1727. #endif
  1728. #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs
  1729. #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array
  1730. #else
  1731. #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
  1732. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1733. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1734. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1735. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1736. #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
  1737. #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
  1738. #endif
  1739. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  1740. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
  1741. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
  1742. #else
  1743. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1744. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1745. #endif
  1746. /* RaiseArgTupleInvalid.proto */
  1747. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1748. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1749. /* RaiseDoubleKeywords.proto */
  1750. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1751. /* ParseKeywords.proto */
  1752. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
  1753. PyObject **argnames[],
  1754. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
  1755. const char* function_name);
  1756. /* GetItemInt.proto */
  1757. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1758. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1759. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1760. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1761. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1762. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1763. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1764. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1765. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1766. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1767. int wraparound, int boundscheck);
  1768. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1769. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1770. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1771. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1772. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1773. int wraparound, int boundscheck);
  1774. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1775. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1776. int is_list, int wraparound, int boundscheck);
  1777. /* AssertionsEnabled.proto */
  1778. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  1779. #define __Pyx_init_assertions_enabled() (0)
  1780. #define __pyx_assertions_enabled() (1)
  1781. #elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000)
  1782. static int __pyx_assertions_enabled_flag;
  1783. #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  1784. static int __Pyx_init_assertions_enabled(void) {
  1785. PyObject *builtins, *debug, *debug_str;
  1786. int flag;
  1787. builtins = PyEval_GetBuiltins();
  1788. if (!builtins) goto bad;
  1789. debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
  1790. if (!debug_str) goto bad;
  1791. debug = PyObject_GetItem(builtins, debug_str);
  1792. Py_DECREF(debug_str);
  1793. if (!debug) goto bad;
  1794. flag = PyObject_IsTrue(debug);
  1795. Py_DECREF(debug);
  1796. if (flag == -1) goto bad;
  1797. __pyx_assertions_enabled_flag = flag;
  1798. return 0;
  1799. bad:
  1800. __pyx_assertions_enabled_flag = 1;
  1801. return -1;
  1802. }
  1803. #else
  1804. #define __Pyx_init_assertions_enabled() (0)
  1805. #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
  1806. #endif
  1807. /* RaiseException.proto */
  1808. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1809. /* py_abs.proto */
  1810. #if CYTHON_USE_PYLONG_INTERNALS
  1811. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  1812. #define __Pyx_PyNumber_Absolute(x)\
  1813. ((likely(PyLong_CheckExact(x))) ?\
  1814. (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
  1815. PyNumber_Absolute(x))
  1816. #else
  1817. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  1818. #endif
  1819. /* ListAppend.proto */
  1820. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1821. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1822. PyListObject* L = (PyListObject*) list;
  1823. Py_ssize_t len = Py_SIZE(list);
  1824. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1825. Py_INCREF(x);
  1826. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1827. L->ob_item[len] = x;
  1828. #else
  1829. PyList_SET_ITEM(list, len, x);
  1830. #endif
  1831. __Pyx_SET_SIZE(list, len + 1);
  1832. return 0;
  1833. }
  1834. return PyList_Append(list, x);
  1835. }
  1836. #else
  1837. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1838. #endif
  1839. /* SliceTupleAndList.proto */
  1840. #if CYTHON_COMPILING_IN_CPYTHON
  1841. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  1842. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  1843. #else
  1844. #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  1845. #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  1846. #endif
  1847. /* ListCompAppend.proto */
  1848. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1849. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1850. PyListObject* L = (PyListObject*) list;
  1851. Py_ssize_t len = Py_SIZE(list);
  1852. if (likely(L->allocated > len)) {
  1853. Py_INCREF(x);
  1854. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1855. L->ob_item[len] = x;
  1856. #else
  1857. PyList_SET_ITEM(list, len, x);
  1858. #endif
  1859. __Pyx_SET_SIZE(list, len + 1);
  1860. return 0;
  1861. }
  1862. return PyList_Append(list, x);
  1863. }
  1864. #else
  1865. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  1866. #endif
  1867. /* PyIntBinop.proto */
  1868. #if !CYTHON_COMPILING_IN_PYPY
  1869. static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1870. #else
  1871. #define __Pyx_PyInt_SubtractCObj(op1, op2, intval, inplace, zerodivision_check)\
  1872. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  1873. #endif
  1874. /* ArgTypeTest.proto */
  1875. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1876. ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1877. __Pyx__ArgTypeTest(obj, type, name, exact))
  1878. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1879. /* RaiseUnboundLocalError.proto */
  1880. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1881. /* GetException.proto */
  1882. #if CYTHON_FAST_THREAD_STATE
  1883. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1884. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1885. #else
  1886. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1887. #endif
  1888. /* pep479.proto */
  1889. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  1890. /* RaiseTooManyValuesToUnpack.proto */
  1891. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1892. /* RaiseNeedMoreValuesToUnpack.proto */
  1893. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1894. /* IterFinish.proto */
  1895. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1896. /* UnpackItemEndCheck.proto */
  1897. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1898. /* PyObjectCall.proto */
  1899. #if CYTHON_COMPILING_IN_CPYTHON
  1900. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1901. #else
  1902. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1903. #endif
  1904. /* PyDictVersioning.proto */
  1905. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1906. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1907. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1908. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1909. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1910. (cache_var) = (value);
  1911. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1912. static PY_UINT64_T __pyx_dict_version = 0;\
  1913. static PyObject *__pyx_dict_cached_value = NULL;\
  1914. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1915. (VAR) = __pyx_dict_cached_value;\
  1916. } else {\
  1917. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1918. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1919. }\
  1920. }
  1921. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1922. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1923. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1924. #else
  1925. #define __PYX_GET_DICT_VERSION(dict) (0)
  1926. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1927. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1928. #endif
  1929. /* GetModuleGlobalName.proto */
  1930. #if CYTHON_USE_DICT_VERSIONS
  1931. #define __Pyx_GetModuleGlobalName(var, name) do {\
  1932. static PY_UINT64_T __pyx_dict_version = 0;\
  1933. static PyObject *__pyx_dict_cached_value = NULL;\
  1934. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1935. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1936. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1937. } while(0)
  1938. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  1939. PY_UINT64_T __pyx_dict_version;\
  1940. PyObject *__pyx_dict_cached_value;\
  1941. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1942. } while(0)
  1943. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1944. #else
  1945. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1946. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1947. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1948. #endif
  1949. /* PyFunctionFastCall.proto */
  1950. #if CYTHON_FAST_PYCALL
  1951. #if !CYTHON_VECTORCALL
  1952. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1953. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1954. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
  1955. #endif
  1956. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1957. (sizeof(char [1 - 2*!(cond)]) - 1)
  1958. #ifndef Py_MEMBER_SIZE
  1959. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1960. #endif
  1961. #if !CYTHON_VECTORCALL
  1962. #if PY_VERSION_HEX >= 0x03080000
  1963. #include "frameobject.h"
  1964. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  1965. #ifndef Py_BUILD_CORE
  1966. #define Py_BUILD_CORE 1
  1967. #endif
  1968. #include "internal/pycore_frame.h"
  1969. #endif
  1970. #define __Pxy_PyFrame_Initialize_Offsets()
  1971. #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
  1972. #else
  1973. static size_t __pyx_pyframe_localsplus_offset = 0;
  1974. #include "frameobject.h"
  1975. #define __Pxy_PyFrame_Initialize_Offsets()\
  1976. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1977. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1978. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1979. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1980. #endif
  1981. #endif
  1982. #endif
  1983. /* PyObjectCallMethO.proto */
  1984. #if CYTHON_COMPILING_IN_CPYTHON
  1985. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1986. #endif
  1987. /* PyObjectFastCall.proto */
  1988. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1989. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
  1990. /* SliceObject.proto */
  1991. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  1992. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  1993. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  1994. int has_cstart, int has_cstop, int wraparound);
  1995. /* PyObjectCallNoArg.proto */
  1996. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  1997. /* PyObjectCallOneArg.proto */
  1998. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1999. /* PyObjectGetMethod.proto */
  2000. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2001. /* PyObjectCallMethod0.proto */
  2002. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2003. /* pop.proto */
  2004. static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
  2005. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2006. static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
  2007. #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
  2008. __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
  2009. #else
  2010. #define __Pyx_PyList_Pop(L) __Pyx__PyObject_Pop(L)
  2011. #define __Pyx_PyObject_Pop(L) __Pyx__PyObject_Pop(L)
  2012. #endif
  2013. /* UnpackUnboundCMethod.proto */
  2014. typedef struct {
  2015. PyObject *type;
  2016. PyObject **method_name;
  2017. PyCFunction func;
  2018. PyObject *method;
  2019. int flag;
  2020. } __Pyx_CachedCFunction;
  2021. /* CallUnboundCMethod0.proto */
  2022. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  2023. #if CYTHON_COMPILING_IN_CPYTHON
  2024. #define __Pyx_CallUnboundCMethod0(cfunc, self)\
  2025. (likely((cfunc)->func) ?\
  2026. (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
  2027. (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
  2028. (PY_VERSION_HEX >= 0x030700A0 ?\
  2029. (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
  2030. (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
  2031. (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
  2032. (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
  2033. (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
  2034. ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\
  2035. __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
  2036. __Pyx__CallUnboundCMethod0(cfunc, self))
  2037. #else
  2038. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  2039. #endif
  2040. /* ListExtend.proto */
  2041. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  2042. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  2043. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  2044. if (unlikely(!none))
  2045. return -1;
  2046. Py_DECREF(none);
  2047. return 0;
  2048. #else
  2049. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  2050. #endif
  2051. }
  2052. /* RaiseUnexpectedTypeError.proto */
  2053. static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
  2054. /* PyIntBinop.proto */
  2055. #if !CYTHON_COMPILING_IN_PYPY
  2056. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2057. #else
  2058. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  2059. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  2060. #endif
  2061. /* GetTopmostException.proto */
  2062. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2063. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2064. #endif
  2065. /* SaveResetException.proto */
  2066. #if CYTHON_FAST_THREAD_STATE
  2067. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2068. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2069. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2070. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2071. #else
  2072. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2073. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2074. #endif
  2075. /* pyfrozenset_new.proto */
  2076. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2077. /* PySetContains.proto */
  2078. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2079. /* Import.proto */
  2080. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  2081. /* ImportFrom.proto */
  2082. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2083. /* IncludeStructmemberH.proto */
  2084. #include <structmember.h>
  2085. /* FixUpExtensionType.proto */
  2086. #if CYTHON_USE_TYPE_SPECS
  2087. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2088. #endif
  2089. /* ValidateBasesTuple.proto */
  2090. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2091. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2092. #endif
  2093. /* PyType_Ready.proto */
  2094. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2095. /* PyObject_GenericGetAttrNoDict.proto */
  2096. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  2097. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  2098. #else
  2099. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  2100. #endif
  2101. /* FastTypeChecks.proto */
  2102. #if CYTHON_COMPILING_IN_CPYTHON
  2103. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2104. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2105. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2106. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2107. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2108. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2109. #else
  2110. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2111. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2112. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2113. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  2114. #endif
  2115. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2116. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2117. /* ImportDottedModule.proto */
  2118. static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
  2119. #if PY_MAJOR_VERSION >= 3
  2120. static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
  2121. #endif
  2122. /* FetchSharedCythonModule.proto */
  2123. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2124. /* FetchCommonType.proto */
  2125. #if !CYTHON_USE_TYPE_SPECS
  2126. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  2127. #else
  2128. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
  2129. #endif
  2130. /* PyMethodNew.proto */
  2131. #if CYTHON_COMPILING_IN_LIMITED_API
  2132. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  2133. PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
  2134. CYTHON_UNUSED_VAR(typ);
  2135. if (!self)
  2136. return __Pyx_NewRef(func);
  2137. typesModule = PyImport_ImportModule("types");
  2138. if (!typesModule) return NULL;
  2139. methodType = PyObject_GetAttrString(typesModule, "MethodType");
  2140. Py_DECREF(typesModule);
  2141. if (!methodType) return NULL;
  2142. result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
  2143. Py_DECREF(methodType);
  2144. return result;
  2145. }
  2146. #elif PY_MAJOR_VERSION >= 3
  2147. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  2148. CYTHON_UNUSED_VAR(typ);
  2149. if (!self)
  2150. return __Pyx_NewRef(func);
  2151. return PyMethod_New(func, self);
  2152. }
  2153. #else
  2154. #define __Pyx_PyMethod_New PyMethod_New
  2155. #endif
  2156. /* PyVectorcallFastCallDict.proto */
  2157. #if CYTHON_METH_FASTCALL
  2158. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2159. #endif
  2160. /* CythonFunctionShared.proto */
  2161. #define __Pyx_CyFunction_USED
  2162. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2163. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2164. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2165. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2166. #define __Pyx_CyFunction_GetClosure(f)\
  2167. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2168. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2169. #define __Pyx_CyFunction_GetClassObj(f)\
  2170. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2171. #else
  2172. #define __Pyx_CyFunction_GetClassObj(f)\
  2173. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2174. #endif
  2175. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2176. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2177. #define __Pyx_CyFunction_Defaults(type, f)\
  2178. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2179. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2180. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2181. typedef struct {
  2182. #if CYTHON_COMPILING_IN_LIMITED_API
  2183. PyObject_HEAD
  2184. PyObject *func;
  2185. #elif PY_VERSION_HEX < 0x030900B1
  2186. PyCFunctionObject func;
  2187. #else
  2188. PyCMethodObject func;
  2189. #endif
  2190. #if CYTHON_BACKPORT_VECTORCALL
  2191. __pyx_vectorcallfunc func_vectorcall;
  2192. #endif
  2193. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  2194. PyObject *func_weakreflist;
  2195. #endif
  2196. PyObject *func_dict;
  2197. PyObject *func_name;
  2198. PyObject *func_qualname;
  2199. PyObject *func_doc;
  2200. PyObject *func_globals;
  2201. PyObject *func_code;
  2202. PyObject *func_closure;
  2203. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2204. PyObject *func_classobj;
  2205. #endif
  2206. void *defaults;
  2207. int defaults_pyobjects;
  2208. size_t defaults_size; // used by FusedFunction for copying defaults
  2209. int flags;
  2210. PyObject *defaults_tuple;
  2211. PyObject *defaults_kwdict;
  2212. PyObject *(*defaults_getter)(PyObject *);
  2213. PyObject *func_annotations;
  2214. PyObject *func_is_coroutine;
  2215. } __pyx_CyFunctionObject;
  2216. #undef __Pyx_CyOrPyCFunction_Check
  2217. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
  2218. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
  2219. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
  2220. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
  2221. #undef __Pyx_IsSameCFunction
  2222. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2223. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2224. int flags, PyObject* qualname,
  2225. PyObject *closure,
  2226. PyObject *module, PyObject *globals,
  2227. PyObject* code);
  2228. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2229. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  2230. size_t size,
  2231. int pyobjects);
  2232. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2233. PyObject *tuple);
  2234. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2235. PyObject *dict);
  2236. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2237. PyObject *dict);
  2238. static int __pyx_CyFunction_init(PyObject *module);
  2239. #if CYTHON_METH_FASTCALL
  2240. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2241. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2242. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2243. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2244. #if CYTHON_BACKPORT_VECTORCALL
  2245. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2246. #else
  2247. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2248. #endif
  2249. #endif
  2250. /* CythonFunction.proto */
  2251. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2252. int flags, PyObject* qualname,
  2253. PyObject *closure,
  2254. PyObject *module, PyObject *globals,
  2255. PyObject* code);
  2256. /* ObjectGetItem.proto */
  2257. #if CYTHON_USE_TYPE_SLOTS
  2258. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  2259. #else
  2260. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  2261. #endif
  2262. /* CLineInTraceback.proto */
  2263. #ifdef CYTHON_CLINE_IN_TRACEBACK
  2264. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2265. #else
  2266. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2267. #endif
  2268. /* CodeObjectCache.proto */
  2269. #if !CYTHON_COMPILING_IN_LIMITED_API
  2270. typedef struct {
  2271. PyCodeObject* code_object;
  2272. int code_line;
  2273. } __Pyx_CodeObjectCacheEntry;
  2274. struct __Pyx_CodeObjectCache {
  2275. int count;
  2276. int max_count;
  2277. __Pyx_CodeObjectCacheEntry* entries;
  2278. };
  2279. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  2280. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2281. static PyCodeObject *__pyx_find_code_object(int code_line);
  2282. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  2283. #endif
  2284. /* AddTraceback.proto */
  2285. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2286. int py_line, const char *filename);
  2287. /* RealImag.proto */
  2288. #if CYTHON_CCOMPLEX
  2289. #ifdef __cplusplus
  2290. #define __Pyx_CREAL(z) ((z).real())
  2291. #define __Pyx_CIMAG(z) ((z).imag())
  2292. #else
  2293. #define __Pyx_CREAL(z) (__real__(z))
  2294. #define __Pyx_CIMAG(z) (__imag__(z))
  2295. #endif
  2296. #else
  2297. #define __Pyx_CREAL(z) ((z).real)
  2298. #define __Pyx_CIMAG(z) ((z).imag)
  2299. #endif
  2300. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  2301. && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  2302. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  2303. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  2304. #else
  2305. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  2306. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  2307. #endif
  2308. /* Arithmetic.proto */
  2309. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  2310. #define __Pyx_c_eq_double(a, b) ((a)==(b))
  2311. #define __Pyx_c_sum_double(a, b) ((a)+(b))
  2312. #define __Pyx_c_diff_double(a, b) ((a)-(b))
  2313. #define __Pyx_c_prod_double(a, b) ((a)*(b))
  2314. #define __Pyx_c_quot_double(a, b) ((a)/(b))
  2315. #define __Pyx_c_neg_double(a) (-(a))
  2316. #ifdef __cplusplus
  2317. #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  2318. #define __Pyx_c_conj_double(z) (::std::conj(z))
  2319. #if 1
  2320. #define __Pyx_c_abs_double(z) (::std::abs(z))
  2321. #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
  2322. #endif
  2323. #else
  2324. #define __Pyx_c_is_zero_double(z) ((z)==0)
  2325. #define __Pyx_c_conj_double(z) (conj(z))
  2326. #if 1
  2327. #define __Pyx_c_abs_double(z) (cabs(z))
  2328. #define __Pyx_c_pow_double(a, b) (cpow(a, b))
  2329. #endif
  2330. #endif
  2331. #else
  2332. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2333. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2334. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2335. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2336. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2337. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  2338. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  2339. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  2340. #if 1
  2341. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  2342. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2343. #endif
  2344. #endif
  2345. /* FromPy.proto */
  2346. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
  2347. /* GCCDiagnostics.proto */
  2348. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2349. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2350. #endif
  2351. /* ToPy.proto */
  2352. #define __pyx_PyComplex_FromComplex(z)\
  2353. PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
  2354. (double)__Pyx_CIMAG(z))
  2355. /* CIntFromPy.proto */
  2356. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  2357. /* CIntToPy.proto */
  2358. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  2359. /* CIntToPy.proto */
  2360. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  2361. /* FormatTypeName.proto */
  2362. #if CYTHON_COMPILING_IN_LIMITED_API
  2363. typedef PyObject *__Pyx_TypeName;
  2364. #define __Pyx_FMT_TYPENAME "%U"
  2365. static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
  2366. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2367. #else
  2368. typedef const char *__Pyx_TypeName;
  2369. #define __Pyx_FMT_TYPENAME "%.200s"
  2370. #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
  2371. #define __Pyx_DECREF_TypeName(obj)
  2372. #endif
  2373. /* CIntFromPy.proto */
  2374. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  2375. /* SwapException.proto */
  2376. #if CYTHON_FAST_THREAD_STATE
  2377. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2378. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2379. #else
  2380. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2381. #endif
  2382. /* PyObjectCall2Args.proto */
  2383. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2384. /* PyObjectCallMethod1.proto */
  2385. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2386. /* CoroutineBase.proto */
  2387. struct __pyx_CoroutineObject;
  2388. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2389. #if CYTHON_USE_EXC_INFO_STACK
  2390. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2391. #else
  2392. typedef struct {
  2393. PyObject *exc_type;
  2394. PyObject *exc_value;
  2395. PyObject *exc_traceback;
  2396. } __Pyx_ExcInfoStruct;
  2397. #endif
  2398. typedef struct __pyx_CoroutineObject {
  2399. PyObject_HEAD
  2400. __pyx_coroutine_body_t body;
  2401. PyObject *closure;
  2402. __Pyx_ExcInfoStruct gi_exc_state;
  2403. PyObject *gi_weakreflist;
  2404. PyObject *classobj;
  2405. PyObject *yieldfrom;
  2406. PyObject *gi_name;
  2407. PyObject *gi_qualname;
  2408. PyObject *gi_modulename;
  2409. PyObject *gi_code;
  2410. PyObject *gi_frame;
  2411. int resume_label;
  2412. char is_running;
  2413. } __pyx_CoroutineObject;
  2414. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2415. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2416. PyObject *name, PyObject *qualname, PyObject *module_name);
  2417. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2418. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2419. PyObject *name, PyObject *qualname, PyObject *module_name);
  2420. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2421. static int __Pyx_Coroutine_clear(PyObject *self);
  2422. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2423. static PyObject *__Pyx_Coroutine_Close(PyObject *self);
  2424. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2425. #if CYTHON_USE_EXC_INFO_STACK
  2426. #define __Pyx_Coroutine_SwapException(self)
  2427. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2428. #else
  2429. #define __Pyx_Coroutine_SwapException(self) {\
  2430. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2431. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2432. }
  2433. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2434. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2435. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2436. }
  2437. #endif
  2438. #if CYTHON_FAST_THREAD_STATE
  2439. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2440. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2441. #else
  2442. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2443. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2444. #endif
  2445. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2446. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2447. /* PatchModuleWithCoroutine.proto */
  2448. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
  2449. /* PatchGeneratorABC.proto */
  2450. static int __Pyx_patch_abc(void);
  2451. /* Generator.proto */
  2452. #define __Pyx_Generator_USED
  2453. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_GeneratorType)
  2454. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2455. __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2456. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2457. static int __pyx_Generator_init(PyObject *module);
  2458. /* CheckBinaryVersion.proto */
  2459. static unsigned long __Pyx_get_runtime_version(void);
  2460. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2461. /* InitStrings.proto */
  2462. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  2463. /* #### Code section: module_declarations ### */
  2464. /* Module declarations from "cython" */
  2465. /* Module declarations from "fontTools.qu2cu.qu2cu" */
  2466. static int __pyx_f_9fontTools_5qu2cu_5qu2cu_cubic_farthest_fit_inside(__pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex, double); /*proto*/
  2467. static PyObject *__pyx_f_9fontTools_5qu2cu_5qu2cu_merge_curves(PyObject *, int, int); /*proto*/
  2468. /* #### Code section: typeinfo ### */
  2469. /* #### Code section: before_global_var ### */
  2470. #define __Pyx_MODULE_NAME "fontTools.qu2cu.qu2cu"
  2471. extern int __pyx_module_is_main_fontTools__qu2cu__qu2cu;
  2472. int __pyx_module_is_main_fontTools__qu2cu__qu2cu = 0;
  2473. /* Implementation of "fontTools.qu2cu.qu2cu" */
  2474. /* #### Code section: global_var ### */
  2475. static PyObject *__pyx_builtin_AttributeError;
  2476. static PyObject *__pyx_builtin_ImportError;
  2477. static PyObject *__pyx_builtin_range;
  2478. static PyObject *__pyx_builtin_AssertionError;
  2479. static PyObject *__pyx_builtin_ZeroDivisionError;
  2480. static PyObject *__pyx_builtin_enumerate;
  2481. static PyObject *__pyx_builtin_reversed;
  2482. static PyObject *__pyx_builtin_zip;
  2483. static PyObject *__pyx_builtin_print;
  2484. /* #### Code section: string_decls ### */
  2485. static const char __pyx_k_i[] = "i";
  2486. static const char __pyx_k_j[] = "j";
  2487. static const char __pyx_k_k[] = "k";
  2488. static const char __pyx_k_p[] = "p";
  2489. static const char __pyx_k_q[] = "q";
  2490. static const char __pyx_k_u[] = "u";
  2491. static const char __pyx_k_v[] = "v";
  2492. static const char __pyx_k_x[] = "x";
  2493. static const char __pyx_k_y[] = "y";
  2494. static const char __pyx_k__3[] = ".";
  2495. static const char __pyx_k__4[] = "*";
  2496. static const char __pyx_k_gc[] = "gc";
  2497. static const char __pyx_k_on[] = "on";
  2498. static const char __pyx_k_p0[] = "p0";
  2499. static const char __pyx_k_p1[] = "p1";
  2500. static const char __pyx_k_p2[] = "p2";
  2501. static const char __pyx_k_p3[] = "p3";
  2502. static const char __pyx_k_qq[] = "qq";
  2503. static const char __pyx_k_ts[] = "ts";
  2504. static const char __pyx_k__15[] = "?";
  2505. static const char __pyx_k_all[] = "__all__";
  2506. static const char __pyx_k_err[] = "err";
  2507. static const char __pyx_k_pop[] = "pop";
  2508. static const char __pyx_k_zip[] = "zip";
  2509. static const char __pyx_k_List[] = "List";
  2510. static const char __pyx_k_args[] = "args";
  2511. static const char __pyx_k_bool[] = "bool";
  2512. static const char __pyx_k_cost[] = "cost";
  2513. static const char __pyx_k_imag[] = "imag";
  2514. static const char __pyx_k_main[] = "__main__";
  2515. static const char __pyx_k_math[] = "math";
  2516. static const char __pyx_k_name[] = "__name__";
  2517. static const char __pyx_k_off1[] = "off1";
  2518. static const char __pyx_k_off2[] = "off2";
  2519. static const char __pyx_k_orig[] = "orig";
  2520. static const char __pyx_k_real[] = "real";
  2521. static const char __pyx_k_send[] = "send";
  2522. static const char __pyx_k_sols[] = "sols";
  2523. static const char __pyx_k_spec[] = "__spec__";
  2524. static const char __pyx_k_test[] = "__test__";
  2525. static const char __pyx_k_Point[] = "Point";
  2526. static const char __pyx_k_Tuple[] = "Tuple";
  2527. static const char __pyx_k_Union[] = "Union";
  2528. static const char __pyx_k_close[] = "close";
  2529. static const char __pyx_k_costs[] = "costs";
  2530. static const char __pyx_k_count[] = "count";
  2531. static const char __pyx_k_cubic[] = "cubic";
  2532. static const char __pyx_k_curve[] = "curve";
  2533. static const char __pyx_k_error[] = "error";
  2534. static const char __pyx_k_float[] = "float";
  2535. static const char __pyx_k_i_sol[] = "i_sol";
  2536. static const char __pyx_k_print[] = "print";
  2537. static const char __pyx_k_quads[] = "quads";
  2538. static const char __pyx_k_range[] = "range";
  2539. static const char __pyx_k_start[] = "start";
  2540. static const char __pyx_k_throw[] = "throw";
  2541. static const char __pyx_k_curves[] = "curves";
  2542. static const char __pyx_k_cython[] = "cython";
  2543. static const char __pyx_k_enable[] = "enable";
  2544. static const char __pyx_k_forced[] = "forced";
  2545. static const char __pyx_k_import[] = "__import__";
  2546. static const char __pyx_k_main_2[] = "main";
  2547. static const char __pyx_k_p1_2_3[] = "p1_2_3";
  2548. static const char __pyx_k_return[] = "return";
  2549. static const char __pyx_k_splits[] = "splits";
  2550. static const char __pyx_k_typing[] = "typing";
  2551. static const char __pyx_k_disable[] = "disable";
  2552. static const char __pyx_k_genexpr[] = "genexpr";
  2553. static const char __pyx_k_max_err[] = "max_err";
  2554. static const char __pyx_k_reconst[] = "reconst";
  2555. static const char __pyx_k_COMPILED[] = "COMPILED";
  2556. static const char __pyx_k_Solution[] = "Solution";
  2557. static const char __pyx_k_best_sol[] = "best_sol";
  2558. static const char __pyx_k_is_cubic[] = "is_cubic";
  2559. static const char __pyx_k_reversed[] = "reversed";
  2560. static const char __pyx_k_all_cubic[] = "all_cubic";
  2561. static const char __pyx_k_enumerate[] = "enumerate";
  2562. static const char __pyx_k_isenabled[] = "isenabled";
  2563. static const char __pyx_k_tolerance[] = "tolerance";
  2564. static const char __pyx_k_impossible[] = "impossible";
  2565. static const char __pyx_k_is_complex[] = "is_complex";
  2566. static const char __pyx_k_namedtuple[] = "namedtuple";
  2567. static const char __pyx_k_num_points[] = "num_points";
  2568. static const char __pyx_k_quadratics[] = "quadratics";
  2569. static const char __pyx_k_this_count[] = "this_count";
  2570. static const char __pyx_k_ImportError[] = "ImportError";
  2571. static const char __pyx_k_collections[] = "collections";
  2572. static const char __pyx_k_i_sol_count[] = "i_sol_count";
  2573. static const char __pyx_k_i_sol_error[] = "i_sol_error";
  2574. static const char __pyx_k_j_sol_count[] = "j_sol_count";
  2575. static const char __pyx_k_j_sol_error[] = "j_sol_error";
  2576. static const char __pyx_k_start_index[] = "start_index";
  2577. static const char __pyx_k_initializing[] = "_initializing";
  2578. static const char __pyx_k_is_coroutine[] = "_is_coroutine";
  2579. static const char __pyx_k_class_getitem[] = "__class_getitem__";
  2580. static const char __pyx_k_num_offcurves[] = "num_offcurves";
  2581. static const char __pyx_k_reconstructed[] = "reconstructed";
  2582. static const char __pyx_k_AssertionError[] = "AssertionError";
  2583. static const char __pyx_k_AttributeError[] = "AttributeError";
  2584. static const char __pyx_k_Original_curve[] = "Original curve:";
  2585. static const char __pyx_k_fontTools_misc[] = "fontTools.misc";
  2586. static const char __pyx_k_generate_curve[] = "generate_curve";
  2587. static const char __pyx_k_splitCubicAtTC[] = "splitCubicAtTC";
  2588. static const char __pyx_k_this_sol_count[] = "this_sol_count";
  2589. static const char __pyx_k_List_List_Point[] = "List[List[Point]]";
  2590. static const char __pyx_k_fontTools_cu2qu[] = "fontTools.cu2qu";
  2591. static const char __pyx_k_List_Tuple_Point[] = "List[Tuple[Point, ...]]";
  2592. static const char __pyx_k_spline_to_curves[] = "spline_to_curves";
  2593. static const char __pyx_k_ZeroDivisionError[] = "ZeroDivisionError";
  2594. static const char __pyx_k_elevate_quadratic[] = "elevate_quadratic";
  2595. static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
  2596. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  2597. static const char __pyx_k_curve_to_quadratic[] = "curve_to_quadratic";
  2598. static const char __pyx_k_reconstructed_iter[] = "reconstructed_iter";
  2599. static const char __pyx_k_elevated_quadratics[] = "elevated_quadratics";
  2600. static const char __pyx_k_quadratic_to_curves[] = "quadratic_to_curves";
  2601. static const char __pyx_k_Reconstructed_curve_s[] = "Reconstructed curve(s):";
  2602. static const char __pyx_k_fontTools_qu2cu_qu2cu[] = "fontTools.qu2cu.qu2cu";
  2603. static const char __pyx_k_reconstruct_tolerance[] = "reconstruct_tolerance";
  2604. static const char __pyx_k_add_implicit_on_curves[] = "add_implicit_on_curves";
  2605. static const char __pyx_k_fontTools_cu2qu_benchmark[] = "fontTools.cu2qu.benchmark";
  2606. static const char __pyx_k_fontTools_misc_bezierTools[] = "fontTools.misc.bezierTools";
  2607. static const char __pyx_k_Lib_fontTools_qu2cu_qu2cu_py[] = "Lib/fontTools/qu2cu/qu2cu.py";
  2608. static const char __pyx_k_spline_to_curves_locals_genexpr[] = "spline_to_curves.<locals>.genexpr";
  2609. static const char __pyx_k_One_random_cubic_turned_into_d_q[] = "One random cubic turned into %d quadratics.";
  2610. static const char __pyx_k_Those_quadratics_turned_back_int[] = "Those quadratics turned back into %d cubics. ";
  2611. static const char __pyx_k_cu2qu_tolerance_g_qu2cu_toleranc[] = "cu2qu tolerance %g. qu2cu tolerance %g.";
  2612. static const char __pyx_k_quadratic_spline_requires_at_lea[] = "quadratic spline requires at least 3 points";
  2613. static const char __pyx_k_quadratic_to_curves_locals_genex[] = "quadratic_to_curves.<locals>.genexpr";
  2614. /* #### Code section: decls ### */
  2615. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_elevate_quadratic(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_p0, __pyx_t_double_complex __pyx_v_p1, __pyx_t_double_complex __pyx_v_p2); /* proto */
  2616. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_2add_implicit_on_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */
  2617. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2618. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_4quadratic_to_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quads, double __pyx_v_max_err, PyObject *__pyx_v_all_cubic); /* proto */
  2619. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2620. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_6spline_to_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_q, PyObject *__pyx_v_costs, double __pyx_v_tolerance, int __pyx_v_all_cubic); /* proto */
  2621. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_8main(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2622. static PyObject *__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2623. static PyObject *__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2624. static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, 0, 0, 0, 0};
  2625. /* #### Code section: late_includes ### */
  2626. /* #### Code section: module_state ### */
  2627. typedef struct {
  2628. PyObject *__pyx_d;
  2629. PyObject *__pyx_b;
  2630. PyObject *__pyx_cython_runtime;
  2631. PyObject *__pyx_empty_tuple;
  2632. PyObject *__pyx_empty_bytes;
  2633. PyObject *__pyx_empty_unicode;
  2634. #ifdef __Pyx_CyFunction_USED
  2635. PyTypeObject *__pyx_CyFunctionType;
  2636. #endif
  2637. #ifdef __Pyx_FusedFunction_USED
  2638. PyTypeObject *__pyx_FusedFunctionType;
  2639. #endif
  2640. #ifdef __Pyx_Generator_USED
  2641. PyTypeObject *__pyx_GeneratorType;
  2642. #endif
  2643. #ifdef __Pyx_IterableCoroutine_USED
  2644. PyTypeObject *__pyx_IterableCoroutineType;
  2645. #endif
  2646. #ifdef __Pyx_Coroutine_USED
  2647. PyTypeObject *__pyx_CoroutineAwaitType;
  2648. #endif
  2649. #ifdef __Pyx_Coroutine_USED
  2650. PyTypeObject *__pyx_CoroutineType;
  2651. #endif
  2652. #if CYTHON_USE_MODULE_STATE
  2653. #endif
  2654. #if CYTHON_USE_MODULE_STATE
  2655. PyObject *__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr;
  2656. PyObject *__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr;
  2657. #endif
  2658. PyTypeObject *__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr;
  2659. PyTypeObject *__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr;
  2660. PyObject *__pyx_n_s_AssertionError;
  2661. PyObject *__pyx_n_s_AttributeError;
  2662. PyObject *__pyx_n_s_COMPILED;
  2663. PyObject *__pyx_n_s_ImportError;
  2664. PyObject *__pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py;
  2665. PyObject *__pyx_n_s_List;
  2666. PyObject *__pyx_kp_s_List_List_Point;
  2667. PyObject *__pyx_kp_s_List_Tuple_Point;
  2668. PyObject *__pyx_kp_u_One_random_cubic_turned_into_d_q;
  2669. PyObject *__pyx_kp_u_Original_curve;
  2670. PyObject *__pyx_n_s_Point;
  2671. PyObject *__pyx_kp_u_Reconstructed_curve_s;
  2672. PyObject *__pyx_n_s_Solution;
  2673. PyObject *__pyx_n_u_Solution;
  2674. PyObject *__pyx_kp_u_Those_quadratics_turned_back_int;
  2675. PyObject *__pyx_n_s_Tuple;
  2676. PyObject *__pyx_n_s_Union;
  2677. PyObject *__pyx_n_s_ZeroDivisionError;
  2678. PyObject *__pyx_n_s__15;
  2679. PyObject *__pyx_kp_u__3;
  2680. PyObject *__pyx_n_s__4;
  2681. PyObject *__pyx_n_s_add_implicit_on_curves;
  2682. PyObject *__pyx_n_s_all;
  2683. PyObject *__pyx_n_s_all_cubic;
  2684. PyObject *__pyx_n_s_args;
  2685. PyObject *__pyx_n_s_asyncio_coroutines;
  2686. PyObject *__pyx_n_s_best_sol;
  2687. PyObject *__pyx_n_s_bool;
  2688. PyObject *__pyx_n_s_class_getitem;
  2689. PyObject *__pyx_n_s_cline_in_traceback;
  2690. PyObject *__pyx_n_s_close;
  2691. PyObject *__pyx_n_s_collections;
  2692. PyObject *__pyx_n_s_cost;
  2693. PyObject *__pyx_n_s_costs;
  2694. PyObject *__pyx_n_s_count;
  2695. PyObject *__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc;
  2696. PyObject *__pyx_n_s_cubic;
  2697. PyObject *__pyx_n_s_curve;
  2698. PyObject *__pyx_n_s_curve_to_quadratic;
  2699. PyObject *__pyx_n_s_curves;
  2700. PyObject *__pyx_n_s_cython;
  2701. PyObject *__pyx_kp_u_disable;
  2702. PyObject *__pyx_n_s_elevate_quadratic;
  2703. PyObject *__pyx_n_s_elevated_quadratics;
  2704. PyObject *__pyx_kp_u_enable;
  2705. PyObject *__pyx_n_s_enumerate;
  2706. PyObject *__pyx_n_s_err;
  2707. PyObject *__pyx_n_s_error;
  2708. PyObject *__pyx_n_u_error;
  2709. PyObject *__pyx_n_s_float;
  2710. PyObject *__pyx_n_s_fontTools_cu2qu;
  2711. PyObject *__pyx_n_s_fontTools_cu2qu_benchmark;
  2712. PyObject *__pyx_n_s_fontTools_misc;
  2713. PyObject *__pyx_n_s_fontTools_misc_bezierTools;
  2714. PyObject *__pyx_n_s_fontTools_qu2cu_qu2cu;
  2715. PyObject *__pyx_n_s_forced;
  2716. PyObject *__pyx_kp_u_gc;
  2717. PyObject *__pyx_n_s_generate_curve;
  2718. PyObject *__pyx_n_s_genexpr;
  2719. PyObject *__pyx_n_s_i;
  2720. PyObject *__pyx_n_s_i_sol;
  2721. PyObject *__pyx_n_s_i_sol_count;
  2722. PyObject *__pyx_n_s_i_sol_error;
  2723. PyObject *__pyx_n_s_imag;
  2724. PyObject *__pyx_n_s_import;
  2725. PyObject *__pyx_n_s_impossible;
  2726. PyObject *__pyx_n_s_initializing;
  2727. PyObject *__pyx_n_s_is_complex;
  2728. PyObject *__pyx_n_s_is_coroutine;
  2729. PyObject *__pyx_n_s_is_cubic;
  2730. PyObject *__pyx_n_u_is_cubic;
  2731. PyObject *__pyx_kp_u_isenabled;
  2732. PyObject *__pyx_n_s_j;
  2733. PyObject *__pyx_n_s_j_sol_count;
  2734. PyObject *__pyx_n_s_j_sol_error;
  2735. PyObject *__pyx_n_s_k;
  2736. PyObject *__pyx_n_s_main;
  2737. PyObject *__pyx_n_u_main;
  2738. PyObject *__pyx_n_s_main_2;
  2739. PyObject *__pyx_n_s_math;
  2740. PyObject *__pyx_n_s_max_err;
  2741. PyObject *__pyx_n_s_name;
  2742. PyObject *__pyx_n_s_namedtuple;
  2743. PyObject *__pyx_n_s_num_offcurves;
  2744. PyObject *__pyx_n_s_num_points;
  2745. PyObject *__pyx_n_u_num_points;
  2746. PyObject *__pyx_n_s_off1;
  2747. PyObject *__pyx_n_s_off2;
  2748. PyObject *__pyx_n_s_on;
  2749. PyObject *__pyx_n_s_orig;
  2750. PyObject *__pyx_n_s_p;
  2751. PyObject *__pyx_n_s_p0;
  2752. PyObject *__pyx_n_s_p1;
  2753. PyObject *__pyx_n_s_p1_2_3;
  2754. PyObject *__pyx_n_s_p2;
  2755. PyObject *__pyx_n_s_p3;
  2756. PyObject *__pyx_n_s_pop;
  2757. PyObject *__pyx_n_s_print;
  2758. PyObject *__pyx_n_s_q;
  2759. PyObject *__pyx_n_s_qq;
  2760. PyObject *__pyx_kp_u_quadratic_spline_requires_at_lea;
  2761. PyObject *__pyx_n_s_quadratic_to_curves;
  2762. PyObject *__pyx_n_u_quadratic_to_curves;
  2763. PyObject *__pyx_n_s_quadratic_to_curves_locals_genex;
  2764. PyObject *__pyx_n_s_quadratics;
  2765. PyObject *__pyx_n_s_quads;
  2766. PyObject *__pyx_n_s_range;
  2767. PyObject *__pyx_n_s_real;
  2768. PyObject *__pyx_n_s_reconst;
  2769. PyObject *__pyx_n_s_reconstruct_tolerance;
  2770. PyObject *__pyx_n_s_reconstructed;
  2771. PyObject *__pyx_n_s_reconstructed_iter;
  2772. PyObject *__pyx_n_s_return;
  2773. PyObject *__pyx_n_s_reversed;
  2774. PyObject *__pyx_n_s_send;
  2775. PyObject *__pyx_n_s_sols;
  2776. PyObject *__pyx_n_s_spec;
  2777. PyObject *__pyx_n_s_spline_to_curves;
  2778. PyObject *__pyx_n_s_spline_to_curves_locals_genexpr;
  2779. PyObject *__pyx_n_s_splitCubicAtTC;
  2780. PyObject *__pyx_n_s_splits;
  2781. PyObject *__pyx_n_s_start;
  2782. PyObject *__pyx_n_s_start_index;
  2783. PyObject *__pyx_n_u_start_index;
  2784. PyObject *__pyx_n_s_test;
  2785. PyObject *__pyx_n_s_this_count;
  2786. PyObject *__pyx_n_s_this_sol_count;
  2787. PyObject *__pyx_n_s_throw;
  2788. PyObject *__pyx_n_s_tolerance;
  2789. PyObject *__pyx_n_s_ts;
  2790. PyObject *__pyx_n_s_typing;
  2791. PyObject *__pyx_n_s_u;
  2792. PyObject *__pyx_n_s_v;
  2793. PyObject *__pyx_n_s_x;
  2794. PyObject *__pyx_n_s_y;
  2795. PyObject *__pyx_n_s_zip;
  2796. PyObject *__pyx_int_0;
  2797. PyObject *__pyx_int_1;
  2798. PyObject *__pyx_int_3;
  2799. PyObject *__pyx_slice_;
  2800. PyObject *__pyx_tuple__2;
  2801. PyObject *__pyx_tuple__5;
  2802. PyObject *__pyx_tuple__7;
  2803. PyObject *__pyx_tuple__9;
  2804. PyObject *__pyx_tuple__11;
  2805. PyObject *__pyx_tuple__13;
  2806. PyObject *__pyx_codeobj__6;
  2807. PyObject *__pyx_codeobj__8;
  2808. PyObject *__pyx_codeobj__10;
  2809. PyObject *__pyx_codeobj__12;
  2810. PyObject *__pyx_codeobj__14;
  2811. } __pyx_mstate;
  2812. #if CYTHON_USE_MODULE_STATE
  2813. #ifdef __cplusplus
  2814. namespace {
  2815. extern struct PyModuleDef __pyx_moduledef;
  2816. } /* anonymous namespace */
  2817. #else
  2818. static struct PyModuleDef __pyx_moduledef;
  2819. #endif
  2820. #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
  2821. #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
  2822. #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
  2823. #else
  2824. static __pyx_mstate __pyx_mstate_global_static =
  2825. #ifdef __cplusplus
  2826. {};
  2827. #else
  2828. {0};
  2829. #endif
  2830. static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
  2831. #endif
  2832. /* #### Code section: module_state_clear ### */
  2833. #if CYTHON_USE_MODULE_STATE
  2834. static int __pyx_m_clear(PyObject *m) {
  2835. __pyx_mstate *clear_module_state = __pyx_mstate(m);
  2836. if (!clear_module_state) return 0;
  2837. Py_CLEAR(clear_module_state->__pyx_d);
  2838. Py_CLEAR(clear_module_state->__pyx_b);
  2839. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  2840. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  2841. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  2842. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  2843. #ifdef __Pyx_CyFunction_USED
  2844. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  2845. #endif
  2846. #ifdef __Pyx_FusedFunction_USED
  2847. Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
  2848. #endif
  2849. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr);
  2850. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr);
  2851. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr);
  2852. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr);
  2853. Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError);
  2854. Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError);
  2855. Py_CLEAR(clear_module_state->__pyx_n_s_COMPILED);
  2856. Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
  2857. Py_CLEAR(clear_module_state->__pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py);
  2858. Py_CLEAR(clear_module_state->__pyx_n_s_List);
  2859. Py_CLEAR(clear_module_state->__pyx_kp_s_List_List_Point);
  2860. Py_CLEAR(clear_module_state->__pyx_kp_s_List_Tuple_Point);
  2861. Py_CLEAR(clear_module_state->__pyx_kp_u_One_random_cubic_turned_into_d_q);
  2862. Py_CLEAR(clear_module_state->__pyx_kp_u_Original_curve);
  2863. Py_CLEAR(clear_module_state->__pyx_n_s_Point);
  2864. Py_CLEAR(clear_module_state->__pyx_kp_u_Reconstructed_curve_s);
  2865. Py_CLEAR(clear_module_state->__pyx_n_s_Solution);
  2866. Py_CLEAR(clear_module_state->__pyx_n_u_Solution);
  2867. Py_CLEAR(clear_module_state->__pyx_kp_u_Those_quadratics_turned_back_int);
  2868. Py_CLEAR(clear_module_state->__pyx_n_s_Tuple);
  2869. Py_CLEAR(clear_module_state->__pyx_n_s_Union);
  2870. Py_CLEAR(clear_module_state->__pyx_n_s_ZeroDivisionError);
  2871. Py_CLEAR(clear_module_state->__pyx_n_s__15);
  2872. Py_CLEAR(clear_module_state->__pyx_kp_u__3);
  2873. Py_CLEAR(clear_module_state->__pyx_n_s__4);
  2874. Py_CLEAR(clear_module_state->__pyx_n_s_add_implicit_on_curves);
  2875. Py_CLEAR(clear_module_state->__pyx_n_s_all);
  2876. Py_CLEAR(clear_module_state->__pyx_n_s_all_cubic);
  2877. Py_CLEAR(clear_module_state->__pyx_n_s_args);
  2878. Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
  2879. Py_CLEAR(clear_module_state->__pyx_n_s_best_sol);
  2880. Py_CLEAR(clear_module_state->__pyx_n_s_bool);
  2881. Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
  2882. Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
  2883. Py_CLEAR(clear_module_state->__pyx_n_s_close);
  2884. Py_CLEAR(clear_module_state->__pyx_n_s_collections);
  2885. Py_CLEAR(clear_module_state->__pyx_n_s_cost);
  2886. Py_CLEAR(clear_module_state->__pyx_n_s_costs);
  2887. Py_CLEAR(clear_module_state->__pyx_n_s_count);
  2888. Py_CLEAR(clear_module_state->__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc);
  2889. Py_CLEAR(clear_module_state->__pyx_n_s_cubic);
  2890. Py_CLEAR(clear_module_state->__pyx_n_s_curve);
  2891. Py_CLEAR(clear_module_state->__pyx_n_s_curve_to_quadratic);
  2892. Py_CLEAR(clear_module_state->__pyx_n_s_curves);
  2893. Py_CLEAR(clear_module_state->__pyx_n_s_cython);
  2894. Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
  2895. Py_CLEAR(clear_module_state->__pyx_n_s_elevate_quadratic);
  2896. Py_CLEAR(clear_module_state->__pyx_n_s_elevated_quadratics);
  2897. Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
  2898. Py_CLEAR(clear_module_state->__pyx_n_s_enumerate);
  2899. Py_CLEAR(clear_module_state->__pyx_n_s_err);
  2900. Py_CLEAR(clear_module_state->__pyx_n_s_error);
  2901. Py_CLEAR(clear_module_state->__pyx_n_u_error);
  2902. Py_CLEAR(clear_module_state->__pyx_n_s_float);
  2903. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_cu2qu);
  2904. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_cu2qu_benchmark);
  2905. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_misc);
  2906. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_misc_bezierTools);
  2907. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_qu2cu_qu2cu);
  2908. Py_CLEAR(clear_module_state->__pyx_n_s_forced);
  2909. Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
  2910. Py_CLEAR(clear_module_state->__pyx_n_s_generate_curve);
  2911. Py_CLEAR(clear_module_state->__pyx_n_s_genexpr);
  2912. Py_CLEAR(clear_module_state->__pyx_n_s_i);
  2913. Py_CLEAR(clear_module_state->__pyx_n_s_i_sol);
  2914. Py_CLEAR(clear_module_state->__pyx_n_s_i_sol_count);
  2915. Py_CLEAR(clear_module_state->__pyx_n_s_i_sol_error);
  2916. Py_CLEAR(clear_module_state->__pyx_n_s_imag);
  2917. Py_CLEAR(clear_module_state->__pyx_n_s_import);
  2918. Py_CLEAR(clear_module_state->__pyx_n_s_impossible);
  2919. Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
  2920. Py_CLEAR(clear_module_state->__pyx_n_s_is_complex);
  2921. Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
  2922. Py_CLEAR(clear_module_state->__pyx_n_s_is_cubic);
  2923. Py_CLEAR(clear_module_state->__pyx_n_u_is_cubic);
  2924. Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
  2925. Py_CLEAR(clear_module_state->__pyx_n_s_j);
  2926. Py_CLEAR(clear_module_state->__pyx_n_s_j_sol_count);
  2927. Py_CLEAR(clear_module_state->__pyx_n_s_j_sol_error);
  2928. Py_CLEAR(clear_module_state->__pyx_n_s_k);
  2929. Py_CLEAR(clear_module_state->__pyx_n_s_main);
  2930. Py_CLEAR(clear_module_state->__pyx_n_u_main);
  2931. Py_CLEAR(clear_module_state->__pyx_n_s_main_2);
  2932. Py_CLEAR(clear_module_state->__pyx_n_s_math);
  2933. Py_CLEAR(clear_module_state->__pyx_n_s_max_err);
  2934. Py_CLEAR(clear_module_state->__pyx_n_s_name);
  2935. Py_CLEAR(clear_module_state->__pyx_n_s_namedtuple);
  2936. Py_CLEAR(clear_module_state->__pyx_n_s_num_offcurves);
  2937. Py_CLEAR(clear_module_state->__pyx_n_s_num_points);
  2938. Py_CLEAR(clear_module_state->__pyx_n_u_num_points);
  2939. Py_CLEAR(clear_module_state->__pyx_n_s_off1);
  2940. Py_CLEAR(clear_module_state->__pyx_n_s_off2);
  2941. Py_CLEAR(clear_module_state->__pyx_n_s_on);
  2942. Py_CLEAR(clear_module_state->__pyx_n_s_orig);
  2943. Py_CLEAR(clear_module_state->__pyx_n_s_p);
  2944. Py_CLEAR(clear_module_state->__pyx_n_s_p0);
  2945. Py_CLEAR(clear_module_state->__pyx_n_s_p1);
  2946. Py_CLEAR(clear_module_state->__pyx_n_s_p1_2_3);
  2947. Py_CLEAR(clear_module_state->__pyx_n_s_p2);
  2948. Py_CLEAR(clear_module_state->__pyx_n_s_p3);
  2949. Py_CLEAR(clear_module_state->__pyx_n_s_pop);
  2950. Py_CLEAR(clear_module_state->__pyx_n_s_print);
  2951. Py_CLEAR(clear_module_state->__pyx_n_s_q);
  2952. Py_CLEAR(clear_module_state->__pyx_n_s_qq);
  2953. Py_CLEAR(clear_module_state->__pyx_kp_u_quadratic_spline_requires_at_lea);
  2954. Py_CLEAR(clear_module_state->__pyx_n_s_quadratic_to_curves);
  2955. Py_CLEAR(clear_module_state->__pyx_n_u_quadratic_to_curves);
  2956. Py_CLEAR(clear_module_state->__pyx_n_s_quadratic_to_curves_locals_genex);
  2957. Py_CLEAR(clear_module_state->__pyx_n_s_quadratics);
  2958. Py_CLEAR(clear_module_state->__pyx_n_s_quads);
  2959. Py_CLEAR(clear_module_state->__pyx_n_s_range);
  2960. Py_CLEAR(clear_module_state->__pyx_n_s_real);
  2961. Py_CLEAR(clear_module_state->__pyx_n_s_reconst);
  2962. Py_CLEAR(clear_module_state->__pyx_n_s_reconstruct_tolerance);
  2963. Py_CLEAR(clear_module_state->__pyx_n_s_reconstructed);
  2964. Py_CLEAR(clear_module_state->__pyx_n_s_reconstructed_iter);
  2965. Py_CLEAR(clear_module_state->__pyx_n_s_return);
  2966. Py_CLEAR(clear_module_state->__pyx_n_s_reversed);
  2967. Py_CLEAR(clear_module_state->__pyx_n_s_send);
  2968. Py_CLEAR(clear_module_state->__pyx_n_s_sols);
  2969. Py_CLEAR(clear_module_state->__pyx_n_s_spec);
  2970. Py_CLEAR(clear_module_state->__pyx_n_s_spline_to_curves);
  2971. Py_CLEAR(clear_module_state->__pyx_n_s_spline_to_curves_locals_genexpr);
  2972. Py_CLEAR(clear_module_state->__pyx_n_s_splitCubicAtTC);
  2973. Py_CLEAR(clear_module_state->__pyx_n_s_splits);
  2974. Py_CLEAR(clear_module_state->__pyx_n_s_start);
  2975. Py_CLEAR(clear_module_state->__pyx_n_s_start_index);
  2976. Py_CLEAR(clear_module_state->__pyx_n_u_start_index);
  2977. Py_CLEAR(clear_module_state->__pyx_n_s_test);
  2978. Py_CLEAR(clear_module_state->__pyx_n_s_this_count);
  2979. Py_CLEAR(clear_module_state->__pyx_n_s_this_sol_count);
  2980. Py_CLEAR(clear_module_state->__pyx_n_s_throw);
  2981. Py_CLEAR(clear_module_state->__pyx_n_s_tolerance);
  2982. Py_CLEAR(clear_module_state->__pyx_n_s_ts);
  2983. Py_CLEAR(clear_module_state->__pyx_n_s_typing);
  2984. Py_CLEAR(clear_module_state->__pyx_n_s_u);
  2985. Py_CLEAR(clear_module_state->__pyx_n_s_v);
  2986. Py_CLEAR(clear_module_state->__pyx_n_s_x);
  2987. Py_CLEAR(clear_module_state->__pyx_n_s_y);
  2988. Py_CLEAR(clear_module_state->__pyx_n_s_zip);
  2989. Py_CLEAR(clear_module_state->__pyx_int_0);
  2990. Py_CLEAR(clear_module_state->__pyx_int_1);
  2991. Py_CLEAR(clear_module_state->__pyx_int_3);
  2992. Py_CLEAR(clear_module_state->__pyx_slice_);
  2993. Py_CLEAR(clear_module_state->__pyx_tuple__2);
  2994. Py_CLEAR(clear_module_state->__pyx_tuple__5);
  2995. Py_CLEAR(clear_module_state->__pyx_tuple__7);
  2996. Py_CLEAR(clear_module_state->__pyx_tuple__9);
  2997. Py_CLEAR(clear_module_state->__pyx_tuple__11);
  2998. Py_CLEAR(clear_module_state->__pyx_tuple__13);
  2999. Py_CLEAR(clear_module_state->__pyx_codeobj__6);
  3000. Py_CLEAR(clear_module_state->__pyx_codeobj__8);
  3001. Py_CLEAR(clear_module_state->__pyx_codeobj__10);
  3002. Py_CLEAR(clear_module_state->__pyx_codeobj__12);
  3003. Py_CLEAR(clear_module_state->__pyx_codeobj__14);
  3004. return 0;
  3005. }
  3006. #endif
  3007. /* #### Code section: module_state_traverse ### */
  3008. #if CYTHON_USE_MODULE_STATE
  3009. static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  3010. __pyx_mstate *traverse_module_state = __pyx_mstate(m);
  3011. if (!traverse_module_state) return 0;
  3012. Py_VISIT(traverse_module_state->__pyx_d);
  3013. Py_VISIT(traverse_module_state->__pyx_b);
  3014. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  3015. Py_VISIT(traverse_module_state->__pyx_empty_tuple);
  3016. Py_VISIT(traverse_module_state->__pyx_empty_bytes);
  3017. Py_VISIT(traverse_module_state->__pyx_empty_unicode);
  3018. #ifdef __Pyx_CyFunction_USED
  3019. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  3020. #endif
  3021. #ifdef __Pyx_FusedFunction_USED
  3022. Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
  3023. #endif
  3024. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr);
  3025. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr);
  3026. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr);
  3027. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr);
  3028. Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError);
  3029. Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError);
  3030. Py_VISIT(traverse_module_state->__pyx_n_s_COMPILED);
  3031. Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
  3032. Py_VISIT(traverse_module_state->__pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py);
  3033. Py_VISIT(traverse_module_state->__pyx_n_s_List);
  3034. Py_VISIT(traverse_module_state->__pyx_kp_s_List_List_Point);
  3035. Py_VISIT(traverse_module_state->__pyx_kp_s_List_Tuple_Point);
  3036. Py_VISIT(traverse_module_state->__pyx_kp_u_One_random_cubic_turned_into_d_q);
  3037. Py_VISIT(traverse_module_state->__pyx_kp_u_Original_curve);
  3038. Py_VISIT(traverse_module_state->__pyx_n_s_Point);
  3039. Py_VISIT(traverse_module_state->__pyx_kp_u_Reconstructed_curve_s);
  3040. Py_VISIT(traverse_module_state->__pyx_n_s_Solution);
  3041. Py_VISIT(traverse_module_state->__pyx_n_u_Solution);
  3042. Py_VISIT(traverse_module_state->__pyx_kp_u_Those_quadratics_turned_back_int);
  3043. Py_VISIT(traverse_module_state->__pyx_n_s_Tuple);
  3044. Py_VISIT(traverse_module_state->__pyx_n_s_Union);
  3045. Py_VISIT(traverse_module_state->__pyx_n_s_ZeroDivisionError);
  3046. Py_VISIT(traverse_module_state->__pyx_n_s__15);
  3047. Py_VISIT(traverse_module_state->__pyx_kp_u__3);
  3048. Py_VISIT(traverse_module_state->__pyx_n_s__4);
  3049. Py_VISIT(traverse_module_state->__pyx_n_s_add_implicit_on_curves);
  3050. Py_VISIT(traverse_module_state->__pyx_n_s_all);
  3051. Py_VISIT(traverse_module_state->__pyx_n_s_all_cubic);
  3052. Py_VISIT(traverse_module_state->__pyx_n_s_args);
  3053. Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
  3054. Py_VISIT(traverse_module_state->__pyx_n_s_best_sol);
  3055. Py_VISIT(traverse_module_state->__pyx_n_s_bool);
  3056. Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
  3057. Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
  3058. Py_VISIT(traverse_module_state->__pyx_n_s_close);
  3059. Py_VISIT(traverse_module_state->__pyx_n_s_collections);
  3060. Py_VISIT(traverse_module_state->__pyx_n_s_cost);
  3061. Py_VISIT(traverse_module_state->__pyx_n_s_costs);
  3062. Py_VISIT(traverse_module_state->__pyx_n_s_count);
  3063. Py_VISIT(traverse_module_state->__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc);
  3064. Py_VISIT(traverse_module_state->__pyx_n_s_cubic);
  3065. Py_VISIT(traverse_module_state->__pyx_n_s_curve);
  3066. Py_VISIT(traverse_module_state->__pyx_n_s_curve_to_quadratic);
  3067. Py_VISIT(traverse_module_state->__pyx_n_s_curves);
  3068. Py_VISIT(traverse_module_state->__pyx_n_s_cython);
  3069. Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
  3070. Py_VISIT(traverse_module_state->__pyx_n_s_elevate_quadratic);
  3071. Py_VISIT(traverse_module_state->__pyx_n_s_elevated_quadratics);
  3072. Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
  3073. Py_VISIT(traverse_module_state->__pyx_n_s_enumerate);
  3074. Py_VISIT(traverse_module_state->__pyx_n_s_err);
  3075. Py_VISIT(traverse_module_state->__pyx_n_s_error);
  3076. Py_VISIT(traverse_module_state->__pyx_n_u_error);
  3077. Py_VISIT(traverse_module_state->__pyx_n_s_float);
  3078. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_cu2qu);
  3079. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_cu2qu_benchmark);
  3080. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_misc);
  3081. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_misc_bezierTools);
  3082. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_qu2cu_qu2cu);
  3083. Py_VISIT(traverse_module_state->__pyx_n_s_forced);
  3084. Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
  3085. Py_VISIT(traverse_module_state->__pyx_n_s_generate_curve);
  3086. Py_VISIT(traverse_module_state->__pyx_n_s_genexpr);
  3087. Py_VISIT(traverse_module_state->__pyx_n_s_i);
  3088. Py_VISIT(traverse_module_state->__pyx_n_s_i_sol);
  3089. Py_VISIT(traverse_module_state->__pyx_n_s_i_sol_count);
  3090. Py_VISIT(traverse_module_state->__pyx_n_s_i_sol_error);
  3091. Py_VISIT(traverse_module_state->__pyx_n_s_imag);
  3092. Py_VISIT(traverse_module_state->__pyx_n_s_import);
  3093. Py_VISIT(traverse_module_state->__pyx_n_s_impossible);
  3094. Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
  3095. Py_VISIT(traverse_module_state->__pyx_n_s_is_complex);
  3096. Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
  3097. Py_VISIT(traverse_module_state->__pyx_n_s_is_cubic);
  3098. Py_VISIT(traverse_module_state->__pyx_n_u_is_cubic);
  3099. Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
  3100. Py_VISIT(traverse_module_state->__pyx_n_s_j);
  3101. Py_VISIT(traverse_module_state->__pyx_n_s_j_sol_count);
  3102. Py_VISIT(traverse_module_state->__pyx_n_s_j_sol_error);
  3103. Py_VISIT(traverse_module_state->__pyx_n_s_k);
  3104. Py_VISIT(traverse_module_state->__pyx_n_s_main);
  3105. Py_VISIT(traverse_module_state->__pyx_n_u_main);
  3106. Py_VISIT(traverse_module_state->__pyx_n_s_main_2);
  3107. Py_VISIT(traverse_module_state->__pyx_n_s_math);
  3108. Py_VISIT(traverse_module_state->__pyx_n_s_max_err);
  3109. Py_VISIT(traverse_module_state->__pyx_n_s_name);
  3110. Py_VISIT(traverse_module_state->__pyx_n_s_namedtuple);
  3111. Py_VISIT(traverse_module_state->__pyx_n_s_num_offcurves);
  3112. Py_VISIT(traverse_module_state->__pyx_n_s_num_points);
  3113. Py_VISIT(traverse_module_state->__pyx_n_u_num_points);
  3114. Py_VISIT(traverse_module_state->__pyx_n_s_off1);
  3115. Py_VISIT(traverse_module_state->__pyx_n_s_off2);
  3116. Py_VISIT(traverse_module_state->__pyx_n_s_on);
  3117. Py_VISIT(traverse_module_state->__pyx_n_s_orig);
  3118. Py_VISIT(traverse_module_state->__pyx_n_s_p);
  3119. Py_VISIT(traverse_module_state->__pyx_n_s_p0);
  3120. Py_VISIT(traverse_module_state->__pyx_n_s_p1);
  3121. Py_VISIT(traverse_module_state->__pyx_n_s_p1_2_3);
  3122. Py_VISIT(traverse_module_state->__pyx_n_s_p2);
  3123. Py_VISIT(traverse_module_state->__pyx_n_s_p3);
  3124. Py_VISIT(traverse_module_state->__pyx_n_s_pop);
  3125. Py_VISIT(traverse_module_state->__pyx_n_s_print);
  3126. Py_VISIT(traverse_module_state->__pyx_n_s_q);
  3127. Py_VISIT(traverse_module_state->__pyx_n_s_qq);
  3128. Py_VISIT(traverse_module_state->__pyx_kp_u_quadratic_spline_requires_at_lea);
  3129. Py_VISIT(traverse_module_state->__pyx_n_s_quadratic_to_curves);
  3130. Py_VISIT(traverse_module_state->__pyx_n_u_quadratic_to_curves);
  3131. Py_VISIT(traverse_module_state->__pyx_n_s_quadratic_to_curves_locals_genex);
  3132. Py_VISIT(traverse_module_state->__pyx_n_s_quadratics);
  3133. Py_VISIT(traverse_module_state->__pyx_n_s_quads);
  3134. Py_VISIT(traverse_module_state->__pyx_n_s_range);
  3135. Py_VISIT(traverse_module_state->__pyx_n_s_real);
  3136. Py_VISIT(traverse_module_state->__pyx_n_s_reconst);
  3137. Py_VISIT(traverse_module_state->__pyx_n_s_reconstruct_tolerance);
  3138. Py_VISIT(traverse_module_state->__pyx_n_s_reconstructed);
  3139. Py_VISIT(traverse_module_state->__pyx_n_s_reconstructed_iter);
  3140. Py_VISIT(traverse_module_state->__pyx_n_s_return);
  3141. Py_VISIT(traverse_module_state->__pyx_n_s_reversed);
  3142. Py_VISIT(traverse_module_state->__pyx_n_s_send);
  3143. Py_VISIT(traverse_module_state->__pyx_n_s_sols);
  3144. Py_VISIT(traverse_module_state->__pyx_n_s_spec);
  3145. Py_VISIT(traverse_module_state->__pyx_n_s_spline_to_curves);
  3146. Py_VISIT(traverse_module_state->__pyx_n_s_spline_to_curves_locals_genexpr);
  3147. Py_VISIT(traverse_module_state->__pyx_n_s_splitCubicAtTC);
  3148. Py_VISIT(traverse_module_state->__pyx_n_s_splits);
  3149. Py_VISIT(traverse_module_state->__pyx_n_s_start);
  3150. Py_VISIT(traverse_module_state->__pyx_n_s_start_index);
  3151. Py_VISIT(traverse_module_state->__pyx_n_u_start_index);
  3152. Py_VISIT(traverse_module_state->__pyx_n_s_test);
  3153. Py_VISIT(traverse_module_state->__pyx_n_s_this_count);
  3154. Py_VISIT(traverse_module_state->__pyx_n_s_this_sol_count);
  3155. Py_VISIT(traverse_module_state->__pyx_n_s_throw);
  3156. Py_VISIT(traverse_module_state->__pyx_n_s_tolerance);
  3157. Py_VISIT(traverse_module_state->__pyx_n_s_ts);
  3158. Py_VISIT(traverse_module_state->__pyx_n_s_typing);
  3159. Py_VISIT(traverse_module_state->__pyx_n_s_u);
  3160. Py_VISIT(traverse_module_state->__pyx_n_s_v);
  3161. Py_VISIT(traverse_module_state->__pyx_n_s_x);
  3162. Py_VISIT(traverse_module_state->__pyx_n_s_y);
  3163. Py_VISIT(traverse_module_state->__pyx_n_s_zip);
  3164. Py_VISIT(traverse_module_state->__pyx_int_0);
  3165. Py_VISIT(traverse_module_state->__pyx_int_1);
  3166. Py_VISIT(traverse_module_state->__pyx_int_3);
  3167. Py_VISIT(traverse_module_state->__pyx_slice_);
  3168. Py_VISIT(traverse_module_state->__pyx_tuple__2);
  3169. Py_VISIT(traverse_module_state->__pyx_tuple__5);
  3170. Py_VISIT(traverse_module_state->__pyx_tuple__7);
  3171. Py_VISIT(traverse_module_state->__pyx_tuple__9);
  3172. Py_VISIT(traverse_module_state->__pyx_tuple__11);
  3173. Py_VISIT(traverse_module_state->__pyx_tuple__13);
  3174. Py_VISIT(traverse_module_state->__pyx_codeobj__6);
  3175. Py_VISIT(traverse_module_state->__pyx_codeobj__8);
  3176. Py_VISIT(traverse_module_state->__pyx_codeobj__10);
  3177. Py_VISIT(traverse_module_state->__pyx_codeobj__12);
  3178. Py_VISIT(traverse_module_state->__pyx_codeobj__14);
  3179. return 0;
  3180. }
  3181. #endif
  3182. /* #### Code section: module_state_defines ### */
  3183. #define __pyx_d __pyx_mstate_global->__pyx_d
  3184. #define __pyx_b __pyx_mstate_global->__pyx_b
  3185. #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
  3186. #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
  3187. #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
  3188. #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
  3189. #ifdef __Pyx_CyFunction_USED
  3190. #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
  3191. #endif
  3192. #ifdef __Pyx_FusedFunction_USED
  3193. #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
  3194. #endif
  3195. #ifdef __Pyx_Generator_USED
  3196. #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
  3197. #endif
  3198. #ifdef __Pyx_IterableCoroutine_USED
  3199. #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
  3200. #endif
  3201. #ifdef __Pyx_Coroutine_USED
  3202. #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
  3203. #endif
  3204. #ifdef __Pyx_Coroutine_USED
  3205. #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
  3206. #endif
  3207. #if CYTHON_USE_MODULE_STATE
  3208. #endif
  3209. #if CYTHON_USE_MODULE_STATE
  3210. #define __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr __pyx_mstate_global->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr
  3211. #define __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr
  3212. #endif
  3213. #define __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr __pyx_mstate_global->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr
  3214. #define __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr
  3215. #define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError
  3216. #define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError
  3217. #define __pyx_n_s_COMPILED __pyx_mstate_global->__pyx_n_s_COMPILED
  3218. #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
  3219. #define __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py __pyx_mstate_global->__pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py
  3220. #define __pyx_n_s_List __pyx_mstate_global->__pyx_n_s_List
  3221. #define __pyx_kp_s_List_List_Point __pyx_mstate_global->__pyx_kp_s_List_List_Point
  3222. #define __pyx_kp_s_List_Tuple_Point __pyx_mstate_global->__pyx_kp_s_List_Tuple_Point
  3223. #define __pyx_kp_u_One_random_cubic_turned_into_d_q __pyx_mstate_global->__pyx_kp_u_One_random_cubic_turned_into_d_q
  3224. #define __pyx_kp_u_Original_curve __pyx_mstate_global->__pyx_kp_u_Original_curve
  3225. #define __pyx_n_s_Point __pyx_mstate_global->__pyx_n_s_Point
  3226. #define __pyx_kp_u_Reconstructed_curve_s __pyx_mstate_global->__pyx_kp_u_Reconstructed_curve_s
  3227. #define __pyx_n_s_Solution __pyx_mstate_global->__pyx_n_s_Solution
  3228. #define __pyx_n_u_Solution __pyx_mstate_global->__pyx_n_u_Solution
  3229. #define __pyx_kp_u_Those_quadratics_turned_back_int __pyx_mstate_global->__pyx_kp_u_Those_quadratics_turned_back_int
  3230. #define __pyx_n_s_Tuple __pyx_mstate_global->__pyx_n_s_Tuple
  3231. #define __pyx_n_s_Union __pyx_mstate_global->__pyx_n_s_Union
  3232. #define __pyx_n_s_ZeroDivisionError __pyx_mstate_global->__pyx_n_s_ZeroDivisionError
  3233. #define __pyx_n_s__15 __pyx_mstate_global->__pyx_n_s__15
  3234. #define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3
  3235. #define __pyx_n_s__4 __pyx_mstate_global->__pyx_n_s__4
  3236. #define __pyx_n_s_add_implicit_on_curves __pyx_mstate_global->__pyx_n_s_add_implicit_on_curves
  3237. #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
  3238. #define __pyx_n_s_all_cubic __pyx_mstate_global->__pyx_n_s_all_cubic
  3239. #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
  3240. #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
  3241. #define __pyx_n_s_best_sol __pyx_mstate_global->__pyx_n_s_best_sol
  3242. #define __pyx_n_s_bool __pyx_mstate_global->__pyx_n_s_bool
  3243. #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
  3244. #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
  3245. #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
  3246. #define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections
  3247. #define __pyx_n_s_cost __pyx_mstate_global->__pyx_n_s_cost
  3248. #define __pyx_n_s_costs __pyx_mstate_global->__pyx_n_s_costs
  3249. #define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count
  3250. #define __pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc __pyx_mstate_global->__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc
  3251. #define __pyx_n_s_cubic __pyx_mstate_global->__pyx_n_s_cubic
  3252. #define __pyx_n_s_curve __pyx_mstate_global->__pyx_n_s_curve
  3253. #define __pyx_n_s_curve_to_quadratic __pyx_mstate_global->__pyx_n_s_curve_to_quadratic
  3254. #define __pyx_n_s_curves __pyx_mstate_global->__pyx_n_s_curves
  3255. #define __pyx_n_s_cython __pyx_mstate_global->__pyx_n_s_cython
  3256. #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
  3257. #define __pyx_n_s_elevate_quadratic __pyx_mstate_global->__pyx_n_s_elevate_quadratic
  3258. #define __pyx_n_s_elevated_quadratics __pyx_mstate_global->__pyx_n_s_elevated_quadratics
  3259. #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
  3260. #define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate
  3261. #define __pyx_n_s_err __pyx_mstate_global->__pyx_n_s_err
  3262. #define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error
  3263. #define __pyx_n_u_error __pyx_mstate_global->__pyx_n_u_error
  3264. #define __pyx_n_s_float __pyx_mstate_global->__pyx_n_s_float
  3265. #define __pyx_n_s_fontTools_cu2qu __pyx_mstate_global->__pyx_n_s_fontTools_cu2qu
  3266. #define __pyx_n_s_fontTools_cu2qu_benchmark __pyx_mstate_global->__pyx_n_s_fontTools_cu2qu_benchmark
  3267. #define __pyx_n_s_fontTools_misc __pyx_mstate_global->__pyx_n_s_fontTools_misc
  3268. #define __pyx_n_s_fontTools_misc_bezierTools __pyx_mstate_global->__pyx_n_s_fontTools_misc_bezierTools
  3269. #define __pyx_n_s_fontTools_qu2cu_qu2cu __pyx_mstate_global->__pyx_n_s_fontTools_qu2cu_qu2cu
  3270. #define __pyx_n_s_forced __pyx_mstate_global->__pyx_n_s_forced
  3271. #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
  3272. #define __pyx_n_s_generate_curve __pyx_mstate_global->__pyx_n_s_generate_curve
  3273. #define __pyx_n_s_genexpr __pyx_mstate_global->__pyx_n_s_genexpr
  3274. #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
  3275. #define __pyx_n_s_i_sol __pyx_mstate_global->__pyx_n_s_i_sol
  3276. #define __pyx_n_s_i_sol_count __pyx_mstate_global->__pyx_n_s_i_sol_count
  3277. #define __pyx_n_s_i_sol_error __pyx_mstate_global->__pyx_n_s_i_sol_error
  3278. #define __pyx_n_s_imag __pyx_mstate_global->__pyx_n_s_imag
  3279. #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
  3280. #define __pyx_n_s_impossible __pyx_mstate_global->__pyx_n_s_impossible
  3281. #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
  3282. #define __pyx_n_s_is_complex __pyx_mstate_global->__pyx_n_s_is_complex
  3283. #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
  3284. #define __pyx_n_s_is_cubic __pyx_mstate_global->__pyx_n_s_is_cubic
  3285. #define __pyx_n_u_is_cubic __pyx_mstate_global->__pyx_n_u_is_cubic
  3286. #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
  3287. #define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j
  3288. #define __pyx_n_s_j_sol_count __pyx_mstate_global->__pyx_n_s_j_sol_count
  3289. #define __pyx_n_s_j_sol_error __pyx_mstate_global->__pyx_n_s_j_sol_error
  3290. #define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k
  3291. #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
  3292. #define __pyx_n_u_main __pyx_mstate_global->__pyx_n_u_main
  3293. #define __pyx_n_s_main_2 __pyx_mstate_global->__pyx_n_s_main_2
  3294. #define __pyx_n_s_math __pyx_mstate_global->__pyx_n_s_math
  3295. #define __pyx_n_s_max_err __pyx_mstate_global->__pyx_n_s_max_err
  3296. #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
  3297. #define __pyx_n_s_namedtuple __pyx_mstate_global->__pyx_n_s_namedtuple
  3298. #define __pyx_n_s_num_offcurves __pyx_mstate_global->__pyx_n_s_num_offcurves
  3299. #define __pyx_n_s_num_points __pyx_mstate_global->__pyx_n_s_num_points
  3300. #define __pyx_n_u_num_points __pyx_mstate_global->__pyx_n_u_num_points
  3301. #define __pyx_n_s_off1 __pyx_mstate_global->__pyx_n_s_off1
  3302. #define __pyx_n_s_off2 __pyx_mstate_global->__pyx_n_s_off2
  3303. #define __pyx_n_s_on __pyx_mstate_global->__pyx_n_s_on
  3304. #define __pyx_n_s_orig __pyx_mstate_global->__pyx_n_s_orig
  3305. #define __pyx_n_s_p __pyx_mstate_global->__pyx_n_s_p
  3306. #define __pyx_n_s_p0 __pyx_mstate_global->__pyx_n_s_p0
  3307. #define __pyx_n_s_p1 __pyx_mstate_global->__pyx_n_s_p1
  3308. #define __pyx_n_s_p1_2_3 __pyx_mstate_global->__pyx_n_s_p1_2_3
  3309. #define __pyx_n_s_p2 __pyx_mstate_global->__pyx_n_s_p2
  3310. #define __pyx_n_s_p3 __pyx_mstate_global->__pyx_n_s_p3
  3311. #define __pyx_n_s_pop __pyx_mstate_global->__pyx_n_s_pop
  3312. #define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print
  3313. #define __pyx_n_s_q __pyx_mstate_global->__pyx_n_s_q
  3314. #define __pyx_n_s_qq __pyx_mstate_global->__pyx_n_s_qq
  3315. #define __pyx_kp_u_quadratic_spline_requires_at_lea __pyx_mstate_global->__pyx_kp_u_quadratic_spline_requires_at_lea
  3316. #define __pyx_n_s_quadratic_to_curves __pyx_mstate_global->__pyx_n_s_quadratic_to_curves
  3317. #define __pyx_n_u_quadratic_to_curves __pyx_mstate_global->__pyx_n_u_quadratic_to_curves
  3318. #define __pyx_n_s_quadratic_to_curves_locals_genex __pyx_mstate_global->__pyx_n_s_quadratic_to_curves_locals_genex
  3319. #define __pyx_n_s_quadratics __pyx_mstate_global->__pyx_n_s_quadratics
  3320. #define __pyx_n_s_quads __pyx_mstate_global->__pyx_n_s_quads
  3321. #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
  3322. #define __pyx_n_s_real __pyx_mstate_global->__pyx_n_s_real
  3323. #define __pyx_n_s_reconst __pyx_mstate_global->__pyx_n_s_reconst
  3324. #define __pyx_n_s_reconstruct_tolerance __pyx_mstate_global->__pyx_n_s_reconstruct_tolerance
  3325. #define __pyx_n_s_reconstructed __pyx_mstate_global->__pyx_n_s_reconstructed
  3326. #define __pyx_n_s_reconstructed_iter __pyx_mstate_global->__pyx_n_s_reconstructed_iter
  3327. #define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return
  3328. #define __pyx_n_s_reversed __pyx_mstate_global->__pyx_n_s_reversed
  3329. #define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send
  3330. #define __pyx_n_s_sols __pyx_mstate_global->__pyx_n_s_sols
  3331. #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
  3332. #define __pyx_n_s_spline_to_curves __pyx_mstate_global->__pyx_n_s_spline_to_curves
  3333. #define __pyx_n_s_spline_to_curves_locals_genexpr __pyx_mstate_global->__pyx_n_s_spline_to_curves_locals_genexpr
  3334. #define __pyx_n_s_splitCubicAtTC __pyx_mstate_global->__pyx_n_s_splitCubicAtTC
  3335. #define __pyx_n_s_splits __pyx_mstate_global->__pyx_n_s_splits
  3336. #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
  3337. #define __pyx_n_s_start_index __pyx_mstate_global->__pyx_n_s_start_index
  3338. #define __pyx_n_u_start_index __pyx_mstate_global->__pyx_n_u_start_index
  3339. #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
  3340. #define __pyx_n_s_this_count __pyx_mstate_global->__pyx_n_s_this_count
  3341. #define __pyx_n_s_this_sol_count __pyx_mstate_global->__pyx_n_s_this_sol_count
  3342. #define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw
  3343. #define __pyx_n_s_tolerance __pyx_mstate_global->__pyx_n_s_tolerance
  3344. #define __pyx_n_s_ts __pyx_mstate_global->__pyx_n_s_ts
  3345. #define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing
  3346. #define __pyx_n_s_u __pyx_mstate_global->__pyx_n_s_u
  3347. #define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v
  3348. #define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x
  3349. #define __pyx_n_s_y __pyx_mstate_global->__pyx_n_s_y
  3350. #define __pyx_n_s_zip __pyx_mstate_global->__pyx_n_s_zip
  3351. #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
  3352. #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
  3353. #define __pyx_int_3 __pyx_mstate_global->__pyx_int_3
  3354. #define __pyx_slice_ __pyx_mstate_global->__pyx_slice_
  3355. #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
  3356. #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
  3357. #define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7
  3358. #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
  3359. #define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11
  3360. #define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
  3361. #define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6
  3362. #define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8
  3363. #define __pyx_codeobj__10 __pyx_mstate_global->__pyx_codeobj__10
  3364. #define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12
  3365. #define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14
  3366. /* #### Code section: module_code ### */
  3367. /* "fontTools/qu2cu/qu2cu.py":43
  3368. *
  3369. * # Copied from cu2qu
  3370. * @cython.cfunc # <<<<<<<<<<<<<<
  3371. * @cython.returns(cython.int)
  3372. * @cython.locals(
  3373. */
  3374. static int __pyx_f_9fontTools_5qu2cu_5qu2cu_cubic_farthest_fit_inside(__pyx_t_double_complex __pyx_v_p0, __pyx_t_double_complex __pyx_v_p1, __pyx_t_double_complex __pyx_v_p2, __pyx_t_double_complex __pyx_v_p3, double __pyx_v_tolerance) {
  3375. __pyx_t_double_complex __pyx_v_mid;
  3376. __pyx_t_double_complex __pyx_v_deriv3;
  3377. int __pyx_r;
  3378. int __pyx_t_1;
  3379. int __pyx_t_2;
  3380. int __pyx_t_3;
  3381. int __pyx_t_4;
  3382. int __pyx_lineno = 0;
  3383. const char *__pyx_filename = NULL;
  3384. int __pyx_clineno = 0;
  3385. /* "fontTools/qu2cu/qu2cu.py":72
  3386. * """
  3387. * # First check p2 then p1, as p2 has higher error early on.
  3388. * if abs(p2) <= tolerance and abs(p1) <= tolerance: # <<<<<<<<<<<<<<
  3389. * return True
  3390. *
  3391. */
  3392. __pyx_t_2 = (__Pyx_c_abs_double(__pyx_v_p2) <= __pyx_v_tolerance);
  3393. if (__pyx_t_2) {
  3394. } else {
  3395. __pyx_t_1 = __pyx_t_2;
  3396. goto __pyx_L4_bool_binop_done;
  3397. }
  3398. __pyx_t_2 = (__Pyx_c_abs_double(__pyx_v_p1) <= __pyx_v_tolerance);
  3399. __pyx_t_1 = __pyx_t_2;
  3400. __pyx_L4_bool_binop_done:;
  3401. if (__pyx_t_1) {
  3402. /* "fontTools/qu2cu/qu2cu.py":73
  3403. * # First check p2 then p1, as p2 has higher error early on.
  3404. * if abs(p2) <= tolerance and abs(p1) <= tolerance:
  3405. * return True # <<<<<<<<<<<<<<
  3406. *
  3407. * # Split.
  3408. */
  3409. __pyx_r = 1;
  3410. goto __pyx_L0;
  3411. /* "fontTools/qu2cu/qu2cu.py":72
  3412. * """
  3413. * # First check p2 then p1, as p2 has higher error early on.
  3414. * if abs(p2) <= tolerance and abs(p1) <= tolerance: # <<<<<<<<<<<<<<
  3415. * return True
  3416. *
  3417. */
  3418. }
  3419. /* "fontTools/qu2cu/qu2cu.py":76
  3420. *
  3421. * # Split.
  3422. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125 # <<<<<<<<<<<<<<
  3423. * if abs(mid) > tolerance:
  3424. * return False
  3425. */
  3426. __pyx_v_mid = __Pyx_c_prod_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__pyx_v_p0, __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(3, 0), __Pyx_c_sum_double(__pyx_v_p1, __pyx_v_p2))), __pyx_v_p3), __pyx_t_double_complex_from_parts(0.125, 0));
  3427. /* "fontTools/qu2cu/qu2cu.py":77
  3428. * # Split.
  3429. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3430. * if abs(mid) > tolerance: # <<<<<<<<<<<<<<
  3431. * return False
  3432. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3433. */
  3434. __pyx_t_1 = (__Pyx_c_abs_double(__pyx_v_mid) > __pyx_v_tolerance);
  3435. if (__pyx_t_1) {
  3436. /* "fontTools/qu2cu/qu2cu.py":78
  3437. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3438. * if abs(mid) > tolerance:
  3439. * return False # <<<<<<<<<<<<<<
  3440. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3441. * return cubic_farthest_fit_inside(
  3442. */
  3443. __pyx_r = 0;
  3444. goto __pyx_L0;
  3445. /* "fontTools/qu2cu/qu2cu.py":77
  3446. * # Split.
  3447. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3448. * if abs(mid) > tolerance: # <<<<<<<<<<<<<<
  3449. * return False
  3450. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3451. */
  3452. }
  3453. /* "fontTools/qu2cu/qu2cu.py":79
  3454. * if abs(mid) > tolerance:
  3455. * return False
  3456. * deriv3 = (p3 + p2 - p1 - p0) * 0.125 # <<<<<<<<<<<<<<
  3457. * return cubic_farthest_fit_inside(
  3458. * p0, (p0 + p1) * 0.5, mid - deriv3, mid, tolerance
  3459. */
  3460. __pyx_v_deriv3 = __Pyx_c_prod_double(__Pyx_c_diff_double(__Pyx_c_diff_double(__Pyx_c_sum_double(__pyx_v_p3, __pyx_v_p2), __pyx_v_p1), __pyx_v_p0), __pyx_t_double_complex_from_parts(0.125, 0));
  3461. /* "fontTools/qu2cu/qu2cu.py":80
  3462. * return False
  3463. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3464. * return cubic_farthest_fit_inside( # <<<<<<<<<<<<<<
  3465. * p0, (p0 + p1) * 0.5, mid - deriv3, mid, tolerance
  3466. * ) and cubic_farthest_fit_inside(mid, mid + deriv3, (p2 + p3) * 0.5, p3, tolerance)
  3467. */
  3468. __pyx_t_4 = __pyx_f_9fontTools_5qu2cu_5qu2cu_cubic_farthest_fit_inside(__pyx_v_p0, __Pyx_c_prod_double(__Pyx_c_sum_double(__pyx_v_p0, __pyx_v_p1), __pyx_t_double_complex_from_parts(0.5, 0)), __Pyx_c_diff_double(__pyx_v_mid, __pyx_v_deriv3), __pyx_v_mid, __pyx_v_tolerance); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error)
  3469. if (__pyx_t_4) {
  3470. } else {
  3471. __pyx_t_3 = __pyx_t_4;
  3472. goto __pyx_L7_bool_binop_done;
  3473. }
  3474. /* "fontTools/qu2cu/qu2cu.py":82
  3475. * return cubic_farthest_fit_inside(
  3476. * p0, (p0 + p1) * 0.5, mid - deriv3, mid, tolerance
  3477. * ) and cubic_farthest_fit_inside(mid, mid + deriv3, (p2 + p3) * 0.5, p3, tolerance) # <<<<<<<<<<<<<<
  3478. *
  3479. *
  3480. */
  3481. __pyx_t_4 = __pyx_f_9fontTools_5qu2cu_5qu2cu_cubic_farthest_fit_inside(__pyx_v_mid, __Pyx_c_sum_double(__pyx_v_mid, __pyx_v_deriv3), __Pyx_c_prod_double(__Pyx_c_sum_double(__pyx_v_p2, __pyx_v_p3), __pyx_t_double_complex_from_parts(0.5, 0)), __pyx_v_p3, __pyx_v_tolerance); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
  3482. __pyx_t_3 = __pyx_t_4;
  3483. __pyx_L7_bool_binop_done:;
  3484. __pyx_r = __pyx_t_3;
  3485. goto __pyx_L0;
  3486. /* "fontTools/qu2cu/qu2cu.py":43
  3487. *
  3488. * # Copied from cu2qu
  3489. * @cython.cfunc # <<<<<<<<<<<<<<
  3490. * @cython.returns(cython.int)
  3491. * @cython.locals(
  3492. */
  3493. /* function exit code */
  3494. __pyx_L1_error:;
  3495. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.cubic_farthest_fit_inside", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3496. __pyx_r = -1;
  3497. __pyx_L0:;
  3498. return __pyx_r;
  3499. }
  3500. /* "fontTools/qu2cu/qu2cu.py":85
  3501. *
  3502. *
  3503. * @cython.locals( # <<<<<<<<<<<<<<
  3504. * p0=cython.complex,
  3505. * p1=cython.complex,
  3506. */
  3507. /* Python wrapper */
  3508. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_1elevate_quadratic(PyObject *__pyx_self,
  3509. #if CYTHON_METH_FASTCALL
  3510. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3511. #else
  3512. PyObject *__pyx_args, PyObject *__pyx_kwds
  3513. #endif
  3514. ); /*proto*/
  3515. PyDoc_STRVAR(__pyx_doc_9fontTools_5qu2cu_5qu2cu_elevate_quadratic, "elevate_quadratic(double complex p0, double complex p1, double complex p2)\nGiven a quadratic bezier curve, return its degree-elevated cubic.");
  3516. static PyMethodDef __pyx_mdef_9fontTools_5qu2cu_5qu2cu_1elevate_quadratic = {"elevate_quadratic", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_5qu2cu_5qu2cu_1elevate_quadratic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_5qu2cu_5qu2cu_elevate_quadratic};
  3517. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_1elevate_quadratic(PyObject *__pyx_self,
  3518. #if CYTHON_METH_FASTCALL
  3519. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3520. #else
  3521. PyObject *__pyx_args, PyObject *__pyx_kwds
  3522. #endif
  3523. ) {
  3524. __pyx_t_double_complex __pyx_v_p0;
  3525. __pyx_t_double_complex __pyx_v_p1;
  3526. __pyx_t_double_complex __pyx_v_p2;
  3527. #if !CYTHON_METH_FASTCALL
  3528. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3529. #endif
  3530. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3531. PyObject* values[3] = {0,0,0};
  3532. int __pyx_lineno = 0;
  3533. const char *__pyx_filename = NULL;
  3534. int __pyx_clineno = 0;
  3535. PyObject *__pyx_r = 0;
  3536. __Pyx_RefNannyDeclarations
  3537. __Pyx_RefNannySetupContext("elevate_quadratic (wrapper)", 0);
  3538. #if !CYTHON_METH_FASTCALL
  3539. #if CYTHON_ASSUME_SAFE_MACROS
  3540. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3541. #else
  3542. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3543. #endif
  3544. #endif
  3545. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3546. {
  3547. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p0,&__pyx_n_s_p1,&__pyx_n_s_p2,0};
  3548. if (__pyx_kwds) {
  3549. Py_ssize_t kw_args;
  3550. switch (__pyx_nargs) {
  3551. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  3552. CYTHON_FALLTHROUGH;
  3553. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  3554. CYTHON_FALLTHROUGH;
  3555. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  3556. CYTHON_FALLTHROUGH;
  3557. case 0: break;
  3558. default: goto __pyx_L5_argtuple_error;
  3559. }
  3560. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  3561. switch (__pyx_nargs) {
  3562. case 0:
  3563. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p0)) != 0)) {
  3564. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  3565. kw_args--;
  3566. }
  3567. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L3_error)
  3568. else goto __pyx_L5_argtuple_error;
  3569. CYTHON_FALLTHROUGH;
  3570. case 1:
  3571. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p1)) != 0)) {
  3572. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  3573. kw_args--;
  3574. }
  3575. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L3_error)
  3576. else {
  3577. __Pyx_RaiseArgtupleInvalid("elevate_quadratic", 1, 3, 3, 1); __PYX_ERR(0, 85, __pyx_L3_error)
  3578. }
  3579. CYTHON_FALLTHROUGH;
  3580. case 2:
  3581. if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p2)) != 0)) {
  3582. (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
  3583. kw_args--;
  3584. }
  3585. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L3_error)
  3586. else {
  3587. __Pyx_RaiseArgtupleInvalid("elevate_quadratic", 1, 3, 3, 2); __PYX_ERR(0, 85, __pyx_L3_error)
  3588. }
  3589. }
  3590. if (unlikely(kw_args > 0)) {
  3591. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3592. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "elevate_quadratic") < 0)) __PYX_ERR(0, 85, __pyx_L3_error)
  3593. }
  3594. } else if (unlikely(__pyx_nargs != 3)) {
  3595. goto __pyx_L5_argtuple_error;
  3596. } else {
  3597. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  3598. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  3599. values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  3600. }
  3601. __pyx_v_p0 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
  3602. __pyx_v_p1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
  3603. __pyx_v_p2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
  3604. }
  3605. goto __pyx_L6_skip;
  3606. __pyx_L5_argtuple_error:;
  3607. __Pyx_RaiseArgtupleInvalid("elevate_quadratic", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 85, __pyx_L3_error)
  3608. __pyx_L6_skip:;
  3609. goto __pyx_L4_argument_unpacking_done;
  3610. __pyx_L3_error:;
  3611. {
  3612. Py_ssize_t __pyx_temp;
  3613. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3614. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  3615. }
  3616. }
  3617. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.elevate_quadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3618. __Pyx_RefNannyFinishContext();
  3619. return NULL;
  3620. __pyx_L4_argument_unpacking_done:;
  3621. __pyx_r = __pyx_pf_9fontTools_5qu2cu_5qu2cu_elevate_quadratic(__pyx_self, __pyx_v_p0, __pyx_v_p1, __pyx_v_p2);
  3622. /* function exit code */
  3623. {
  3624. Py_ssize_t __pyx_temp;
  3625. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3626. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  3627. }
  3628. }
  3629. __Pyx_RefNannyFinishContext();
  3630. return __pyx_r;
  3631. }
  3632. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_elevate_quadratic(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_p0, __pyx_t_double_complex __pyx_v_p1, __pyx_t_double_complex __pyx_v_p2) {
  3633. __pyx_t_double_complex __pyx_v_p1_2_3;
  3634. PyObject *__pyx_r = NULL;
  3635. __Pyx_RefNannyDeclarations
  3636. PyObject *__pyx_t_1 = NULL;
  3637. __pyx_t_double_complex __pyx_t_2;
  3638. PyObject *__pyx_t_3 = NULL;
  3639. PyObject *__pyx_t_4 = NULL;
  3640. PyObject *__pyx_t_5 = NULL;
  3641. PyObject *__pyx_t_6 = NULL;
  3642. int __pyx_lineno = 0;
  3643. const char *__pyx_filename = NULL;
  3644. int __pyx_clineno = 0;
  3645. __Pyx_RefNannySetupContext("elevate_quadratic", 1);
  3646. /* "fontTools/qu2cu/qu2cu.py":95
  3647. *
  3648. * # https://pomax.github.io/bezierinfo/#reordering
  3649. * p1_2_3 = p1 * (2 / 3) # <<<<<<<<<<<<<<
  3650. * return (
  3651. * p0,
  3652. */
  3653. __pyx_v_p1_2_3 = __Pyx_c_prod_double(__pyx_v_p1, __pyx_t_double_complex_from_parts((2.0 / 3.0), 0));
  3654. /* "fontTools/qu2cu/qu2cu.py":96
  3655. * # https://pomax.github.io/bezierinfo/#reordering
  3656. * p1_2_3 = p1 * (2 / 3)
  3657. * return ( # <<<<<<<<<<<<<<
  3658. * p0,
  3659. * (p0 * (1 / 3) + p1_2_3),
  3660. */
  3661. __Pyx_XDECREF(__pyx_r);
  3662. /* "fontTools/qu2cu/qu2cu.py":97
  3663. * p1_2_3 = p1 * (2 / 3)
  3664. * return (
  3665. * p0, # <<<<<<<<<<<<<<
  3666. * (p0 * (1 / 3) + p1_2_3),
  3667. * (p2 * (1 / 3) + p1_2_3),
  3668. */
  3669. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_p0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  3670. __Pyx_GOTREF(__pyx_t_1);
  3671. /* "fontTools/qu2cu/qu2cu.py":98
  3672. * return (
  3673. * p0,
  3674. * (p0 * (1 / 3) + p1_2_3), # <<<<<<<<<<<<<<
  3675. * (p2 * (1 / 3) + p1_2_3),
  3676. * p2,
  3677. */
  3678. __pyx_t_2 = __Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_v_p0, __pyx_t_double_complex_from_parts((1.0 / 3.0), 0)), __pyx_v_p1_2_3);
  3679. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  3680. __Pyx_GOTREF(__pyx_t_3);
  3681. /* "fontTools/qu2cu/qu2cu.py":99
  3682. * p0,
  3683. * (p0 * (1 / 3) + p1_2_3),
  3684. * (p2 * (1 / 3) + p1_2_3), # <<<<<<<<<<<<<<
  3685. * p2,
  3686. * )
  3687. */
  3688. __pyx_t_2 = __Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_v_p2, __pyx_t_double_complex_from_parts((1.0 / 3.0), 0)), __pyx_v_p1_2_3);
  3689. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
  3690. __Pyx_GOTREF(__pyx_t_4);
  3691. /* "fontTools/qu2cu/qu2cu.py":100
  3692. * (p0 * (1 / 3) + p1_2_3),
  3693. * (p2 * (1 / 3) + p1_2_3),
  3694. * p2, # <<<<<<<<<<<<<<
  3695. * )
  3696. *
  3697. */
  3698. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error)
  3699. __Pyx_GOTREF(__pyx_t_5);
  3700. /* "fontTools/qu2cu/qu2cu.py":97
  3701. * p1_2_3 = p1 * (2 / 3)
  3702. * return (
  3703. * p0, # <<<<<<<<<<<<<<
  3704. * (p0 * (1 / 3) + p1_2_3),
  3705. * (p2 * (1 / 3) + p1_2_3),
  3706. */
  3707. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
  3708. __Pyx_GOTREF(__pyx_t_6);
  3709. __Pyx_GIVEREF(__pyx_t_1);
  3710. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error);
  3711. __Pyx_GIVEREF(__pyx_t_3);
  3712. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error);
  3713. __Pyx_GIVEREF(__pyx_t_4);
  3714. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error);
  3715. __Pyx_GIVEREF(__pyx_t_5);
  3716. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error);
  3717. __pyx_t_1 = 0;
  3718. __pyx_t_3 = 0;
  3719. __pyx_t_4 = 0;
  3720. __pyx_t_5 = 0;
  3721. __pyx_r = __pyx_t_6;
  3722. __pyx_t_6 = 0;
  3723. goto __pyx_L0;
  3724. /* "fontTools/qu2cu/qu2cu.py":85
  3725. *
  3726. *
  3727. * @cython.locals( # <<<<<<<<<<<<<<
  3728. * p0=cython.complex,
  3729. * p1=cython.complex,
  3730. */
  3731. /* function exit code */
  3732. __pyx_L1_error:;
  3733. __Pyx_XDECREF(__pyx_t_1);
  3734. __Pyx_XDECREF(__pyx_t_3);
  3735. __Pyx_XDECREF(__pyx_t_4);
  3736. __Pyx_XDECREF(__pyx_t_5);
  3737. __Pyx_XDECREF(__pyx_t_6);
  3738. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.elevate_quadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3739. __pyx_r = NULL;
  3740. __pyx_L0:;
  3741. __Pyx_XGIVEREF(__pyx_r);
  3742. __Pyx_RefNannyFinishContext();
  3743. return __pyx_r;
  3744. }
  3745. /* "fontTools/qu2cu/qu2cu.py":104
  3746. *
  3747. *
  3748. * @cython.cfunc # <<<<<<<<<<<<<<
  3749. * @cython.locals(
  3750. * start=cython.int,
  3751. */
  3752. static PyObject *__pyx_f_9fontTools_5qu2cu_5qu2cu_merge_curves(PyObject *__pyx_v_curves, int __pyx_v_start, int __pyx_v_n) {
  3753. int __pyx_v_k;
  3754. double __pyx_v_prod_ratio;
  3755. double __pyx_v_sum_ratio;
  3756. double __pyx_v_ratio;
  3757. __pyx_t_double_complex __pyx_v_p0;
  3758. __pyx_t_double_complex __pyx_v_p1;
  3759. __pyx_t_double_complex __pyx_v_p2;
  3760. __pyx_t_double_complex __pyx_v_p3;
  3761. PyObject *__pyx_v_ts = NULL;
  3762. PyObject *__pyx_v_ck = NULL;
  3763. PyObject *__pyx_v_c_before = NULL;
  3764. PyObject *__pyx_v_curve = NULL;
  3765. double __pyx_7genexpr__pyx_v_t;
  3766. PyObject *__pyx_r = NULL;
  3767. __Pyx_RefNannyDeclarations
  3768. PyObject *__pyx_t_1 = NULL;
  3769. int __pyx_t_2;
  3770. int __pyx_t_3;
  3771. int __pyx_t_4;
  3772. int __pyx_t_5;
  3773. long __pyx_t_6;
  3774. PyObject *__pyx_t_7 = NULL;
  3775. PyObject *__pyx_t_8 = NULL;
  3776. int __pyx_t_9;
  3777. PyObject *__pyx_t_10 = NULL;
  3778. double __pyx_t_11;
  3779. int __pyx_t_12;
  3780. Py_ssize_t __pyx_t_13;
  3781. __pyx_t_double_complex __pyx_t_14;
  3782. PyObject *__pyx_t_15 = NULL;
  3783. int __pyx_lineno = 0;
  3784. const char *__pyx_filename = NULL;
  3785. int __pyx_clineno = 0;
  3786. __Pyx_RefNannySetupContext("merge_curves", 1);
  3787. /* "fontTools/qu2cu/qu2cu.py":124
  3788. *
  3789. * # Reconstruct the t values of the cut segments
  3790. * prod_ratio = 1.0 # <<<<<<<<<<<<<<
  3791. * sum_ratio = 1.0
  3792. * ts = [1]
  3793. */
  3794. __pyx_v_prod_ratio = 1.0;
  3795. /* "fontTools/qu2cu/qu2cu.py":125
  3796. * # Reconstruct the t values of the cut segments
  3797. * prod_ratio = 1.0
  3798. * sum_ratio = 1.0 # <<<<<<<<<<<<<<
  3799. * ts = [1]
  3800. * for k in range(1, n):
  3801. */
  3802. __pyx_v_sum_ratio = 1.0;
  3803. /* "fontTools/qu2cu/qu2cu.py":126
  3804. * prod_ratio = 1.0
  3805. * sum_ratio = 1.0
  3806. * ts = [1] # <<<<<<<<<<<<<<
  3807. * for k in range(1, n):
  3808. * ck = curves[start + k]
  3809. */
  3810. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  3811. __Pyx_GOTREF(__pyx_t_1);
  3812. __Pyx_INCREF(__pyx_int_1);
  3813. __Pyx_GIVEREF(__pyx_int_1);
  3814. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1)) __PYX_ERR(0, 126, __pyx_L1_error);
  3815. __pyx_v_ts = ((PyObject*)__pyx_t_1);
  3816. __pyx_t_1 = 0;
  3817. /* "fontTools/qu2cu/qu2cu.py":127
  3818. * sum_ratio = 1.0
  3819. * ts = [1]
  3820. * for k in range(1, n): # <<<<<<<<<<<<<<
  3821. * ck = curves[start + k]
  3822. * c_before = curves[start + k - 1]
  3823. */
  3824. __pyx_t_2 = __pyx_v_n;
  3825. __pyx_t_3 = __pyx_t_2;
  3826. for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  3827. __pyx_v_k = __pyx_t_4;
  3828. /* "fontTools/qu2cu/qu2cu.py":128
  3829. * ts = [1]
  3830. * for k in range(1, n):
  3831. * ck = curves[start + k] # <<<<<<<<<<<<<<
  3832. * c_before = curves[start + k - 1]
  3833. *
  3834. */
  3835. __pyx_t_5 = (__pyx_v_start + __pyx_v_k);
  3836. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  3837. __Pyx_GOTREF(__pyx_t_1);
  3838. __Pyx_XDECREF_SET(__pyx_v_ck, __pyx_t_1);
  3839. __pyx_t_1 = 0;
  3840. /* "fontTools/qu2cu/qu2cu.py":129
  3841. * for k in range(1, n):
  3842. * ck = curves[start + k]
  3843. * c_before = curves[start + k - 1] # <<<<<<<<<<<<<<
  3844. *
  3845. * # |t_(k+1) - t_k| / |t_k - t_(k - 1)| = ratio
  3846. */
  3847. __pyx_t_6 = ((__pyx_v_start + __pyx_v_k) - 1);
  3848. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
  3849. __Pyx_GOTREF(__pyx_t_1);
  3850. __Pyx_XDECREF_SET(__pyx_v_c_before, __pyx_t_1);
  3851. __pyx_t_1 = 0;
  3852. /* "fontTools/qu2cu/qu2cu.py":132
  3853. *
  3854. * # |t_(k+1) - t_k| / |t_k - t_(k - 1)| = ratio
  3855. * assert ck[0] == c_before[3] # <<<<<<<<<<<<<<
  3856. * ratio = abs(ck[1] - ck[0]) / abs(c_before[3] - c_before[2])
  3857. *
  3858. */
  3859. #ifndef CYTHON_WITHOUT_ASSERTIONS
  3860. if (unlikely(__pyx_assertions_enabled())) {
  3861. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ck, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
  3862. __Pyx_GOTREF(__pyx_t_1);
  3863. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_c_before, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error)
  3864. __Pyx_GOTREF(__pyx_t_7);
  3865. __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
  3866. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3867. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3868. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 132, __pyx_L1_error)
  3869. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3870. if (unlikely(!__pyx_t_9)) {
  3871. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  3872. __PYX_ERR(0, 132, __pyx_L1_error)
  3873. }
  3874. }
  3875. #else
  3876. if ((1)); else __PYX_ERR(0, 132, __pyx_L1_error)
  3877. #endif
  3878. /* "fontTools/qu2cu/qu2cu.py":133
  3879. * # |t_(k+1) - t_k| / |t_k - t_(k - 1)| = ratio
  3880. * assert ck[0] == c_before[3]
  3881. * ratio = abs(ck[1] - ck[0]) / abs(c_before[3] - c_before[2]) # <<<<<<<<<<<<<<
  3882. *
  3883. * prod_ratio *= ratio
  3884. */
  3885. __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_ck, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
  3886. __Pyx_GOTREF(__pyx_t_8);
  3887. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ck, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error)
  3888. __Pyx_GOTREF(__pyx_t_7);
  3889. __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  3890. __Pyx_GOTREF(__pyx_t_1);
  3891. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3892. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3893. __pyx_t_7 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error)
  3894. __Pyx_GOTREF(__pyx_t_7);
  3895. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3896. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_c_before, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  3897. __Pyx_GOTREF(__pyx_t_1);
  3898. __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_c_before, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
  3899. __Pyx_GOTREF(__pyx_t_8);
  3900. __pyx_t_10 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 133, __pyx_L1_error)
  3901. __Pyx_GOTREF(__pyx_t_10);
  3902. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3903. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3904. __pyx_t_8 = __Pyx_PyNumber_Absolute(__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
  3905. __Pyx_GOTREF(__pyx_t_8);
  3906. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3907. __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 133, __pyx_L1_error)
  3908. __Pyx_GOTREF(__pyx_t_10);
  3909. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3910. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3911. __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)
  3912. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3913. __pyx_v_ratio = __pyx_t_11;
  3914. /* "fontTools/qu2cu/qu2cu.py":135
  3915. * ratio = abs(ck[1] - ck[0]) / abs(c_before[3] - c_before[2])
  3916. *
  3917. * prod_ratio *= ratio # <<<<<<<<<<<<<<
  3918. * sum_ratio += prod_ratio
  3919. * ts.append(sum_ratio)
  3920. */
  3921. __pyx_v_prod_ratio = (__pyx_v_prod_ratio * __pyx_v_ratio);
  3922. /* "fontTools/qu2cu/qu2cu.py":136
  3923. *
  3924. * prod_ratio *= ratio
  3925. * sum_ratio += prod_ratio # <<<<<<<<<<<<<<
  3926. * ts.append(sum_ratio)
  3927. *
  3928. */
  3929. __pyx_v_sum_ratio = (__pyx_v_sum_ratio + __pyx_v_prod_ratio);
  3930. /* "fontTools/qu2cu/qu2cu.py":137
  3931. * prod_ratio *= ratio
  3932. * sum_ratio += prod_ratio
  3933. * ts.append(sum_ratio) # <<<<<<<<<<<<<<
  3934. *
  3935. * # (t(n) - t(n - 1)) / (t_(1) - t(0)) = prod_ratio
  3936. */
  3937. __pyx_t_10 = PyFloat_FromDouble(__pyx_v_sum_ratio); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 137, __pyx_L1_error)
  3938. __Pyx_GOTREF(__pyx_t_10);
  3939. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_ts, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 137, __pyx_L1_error)
  3940. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3941. }
  3942. /* "fontTools/qu2cu/qu2cu.py":141
  3943. * # (t(n) - t(n - 1)) / (t_(1) - t(0)) = prod_ratio
  3944. *
  3945. * ts = [t / sum_ratio for t in ts[:-1]] # <<<<<<<<<<<<<<
  3946. *
  3947. * p0 = curves[start][0]
  3948. */
  3949. { /* enter inner scope */
  3950. __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 141, __pyx_L1_error)
  3951. __Pyx_GOTREF(__pyx_t_10);
  3952. __pyx_t_8 = __Pyx_PyList_GetSlice(__pyx_v_ts, 0, -1L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
  3953. __Pyx_GOTREF(__pyx_t_8);
  3954. __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7);
  3955. __pyx_t_13 = 0;
  3956. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3957. for (;;) {
  3958. {
  3959. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
  3960. #if !CYTHON_ASSUME_SAFE_MACROS
  3961. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 141, __pyx_L1_error)
  3962. #endif
  3963. if (__pyx_t_13 >= __pyx_temp) break;
  3964. }
  3965. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3966. __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 141, __pyx_L1_error)
  3967. #else
  3968. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
  3969. __Pyx_GOTREF(__pyx_t_8);
  3970. #endif
  3971. __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
  3972. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3973. __pyx_7genexpr__pyx_v_t = __pyx_t_11;
  3974. if (unlikely(__pyx_v_sum_ratio == 0)) {
  3975. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  3976. __PYX_ERR(0, 141, __pyx_L1_error)
  3977. }
  3978. __pyx_t_8 = PyFloat_FromDouble((__pyx_7genexpr__pyx_v_t / __pyx_v_sum_ratio)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
  3979. __Pyx_GOTREF(__pyx_t_8);
  3980. if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 141, __pyx_L1_error)
  3981. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3982. }
  3983. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3984. } /* exit inner scope */
  3985. __Pyx_DECREF_SET(__pyx_v_ts, ((PyObject*)__pyx_t_10));
  3986. __pyx_t_10 = 0;
  3987. /* "fontTools/qu2cu/qu2cu.py":143
  3988. * ts = [t / sum_ratio for t in ts[:-1]]
  3989. *
  3990. * p0 = curves[start][0] # <<<<<<<<<<<<<<
  3991. * p1 = curves[start][1]
  3992. * p2 = curves[start + n - 1][2]
  3993. */
  3994. __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_v_start, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 143, __pyx_L1_error)
  3995. __Pyx_GOTREF(__pyx_t_10);
  3996. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
  3997. __Pyx_GOTREF(__pyx_t_7);
  3998. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3999. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error)
  4000. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4001. __pyx_v_p0 = __pyx_t_14;
  4002. /* "fontTools/qu2cu/qu2cu.py":144
  4003. *
  4004. * p0 = curves[start][0]
  4005. * p1 = curves[start][1] # <<<<<<<<<<<<<<
  4006. * p2 = curves[start + n - 1][2]
  4007. * p3 = curves[start + n - 1][3]
  4008. */
  4009. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_v_start, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L1_error)
  4010. __Pyx_GOTREF(__pyx_t_7);
  4011. __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 144, __pyx_L1_error)
  4012. __Pyx_GOTREF(__pyx_t_10);
  4013. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4014. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error)
  4015. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4016. __pyx_v_p1 = __pyx_t_14;
  4017. /* "fontTools/qu2cu/qu2cu.py":145
  4018. * p0 = curves[start][0]
  4019. * p1 = curves[start][1]
  4020. * p2 = curves[start + n - 1][2] # <<<<<<<<<<<<<<
  4021. * p3 = curves[start + n - 1][3]
  4022. *
  4023. */
  4024. __pyx_t_6 = ((__pyx_v_start + __pyx_v_n) - 1);
  4025. __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 145, __pyx_L1_error)
  4026. __Pyx_GOTREF(__pyx_t_10);
  4027. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_10, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 145, __pyx_L1_error)
  4028. __Pyx_GOTREF(__pyx_t_7);
  4029. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4030. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
  4031. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4032. __pyx_v_p2 = __pyx_t_14;
  4033. /* "fontTools/qu2cu/qu2cu.py":146
  4034. * p1 = curves[start][1]
  4035. * p2 = curves[start + n - 1][2]
  4036. * p3 = curves[start + n - 1][3] # <<<<<<<<<<<<<<
  4037. *
  4038. * # Build the curve by scaling the control-points.
  4039. */
  4040. __pyx_t_6 = ((__pyx_v_start + __pyx_v_n) - 1);
  4041. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_curves, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
  4042. __Pyx_GOTREF(__pyx_t_7);
  4043. __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_7, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L1_error)
  4044. __Pyx_GOTREF(__pyx_t_10);
  4045. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4046. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error)
  4047. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4048. __pyx_v_p3 = __pyx_t_14;
  4049. /* "fontTools/qu2cu/qu2cu.py":149
  4050. *
  4051. * # Build the curve by scaling the control-points.
  4052. * p1 = p0 + (p1 - p0) / (ts[0] if ts else 1) # <<<<<<<<<<<<<<
  4053. * p2 = p3 + (p2 - p3) / ((1 - ts[-1]) if ts else 1)
  4054. *
  4055. */
  4056. __pyx_t_10 = __pyx_PyComplex_FromComplex(__pyx_v_p0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 149, __pyx_L1_error)
  4057. __Pyx_GOTREF(__pyx_t_10);
  4058. __pyx_t_14 = __Pyx_c_diff_double(__pyx_v_p1, __pyx_v_p0);
  4059. __pyx_t_7 = __pyx_PyComplex_FromComplex(__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error)
  4060. __Pyx_GOTREF(__pyx_t_7);
  4061. __pyx_t_9 = (PyList_GET_SIZE(__pyx_v_ts) != 0);
  4062. if (__pyx_t_9) {
  4063. __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_ts, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
  4064. __Pyx_GOTREF(__pyx_t_1);
  4065. __pyx_t_8 = __pyx_t_1;
  4066. __pyx_t_1 = 0;
  4067. } else {
  4068. __Pyx_INCREF(__pyx_int_1);
  4069. __pyx_t_8 = __pyx_int_1;
  4070. }
  4071. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
  4072. __Pyx_GOTREF(__pyx_t_1);
  4073. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4074. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4075. __pyx_t_8 = PyNumber_Add(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error)
  4076. __Pyx_GOTREF(__pyx_t_8);
  4077. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4078. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4079. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error)
  4080. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4081. __pyx_v_p1 = __pyx_t_14;
  4082. /* "fontTools/qu2cu/qu2cu.py":150
  4083. * # Build the curve by scaling the control-points.
  4084. * p1 = p0 + (p1 - p0) / (ts[0] if ts else 1)
  4085. * p2 = p3 + (p2 - p3) / ((1 - ts[-1]) if ts else 1) # <<<<<<<<<<<<<<
  4086. *
  4087. * curve = (p0, p1, p2, p3)
  4088. */
  4089. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
  4090. __Pyx_GOTREF(__pyx_t_8);
  4091. __pyx_t_14 = __Pyx_c_diff_double(__pyx_v_p2, __pyx_v_p3);
  4092. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
  4093. __Pyx_GOTREF(__pyx_t_1);
  4094. __pyx_t_9 = (PyList_GET_SIZE(__pyx_v_ts) != 0);
  4095. if (__pyx_t_9) {
  4096. __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_ts, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
  4097. __Pyx_GOTREF(__pyx_t_7);
  4098. __pyx_t_15 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_t_7, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 150, __pyx_L1_error)
  4099. __Pyx_GOTREF(__pyx_t_15);
  4100. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4101. __pyx_t_10 = __pyx_t_15;
  4102. __pyx_t_15 = 0;
  4103. } else {
  4104. __Pyx_INCREF(__pyx_int_1);
  4105. __pyx_t_10 = __pyx_int_1;
  4106. }
  4107. __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 150, __pyx_L1_error)
  4108. __Pyx_GOTREF(__pyx_t_15);
  4109. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4110. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4111. __pyx_t_10 = PyNumber_Add(__pyx_t_8, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 150, __pyx_L1_error)
  4112. __Pyx_GOTREF(__pyx_t_10);
  4113. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4114. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  4115. __pyx_t_14 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
  4116. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4117. __pyx_v_p2 = __pyx_t_14;
  4118. /* "fontTools/qu2cu/qu2cu.py":152
  4119. * p2 = p3 + (p2 - p3) / ((1 - ts[-1]) if ts else 1)
  4120. *
  4121. * curve = (p0, p1, p2, p3) # <<<<<<<<<<<<<<
  4122. *
  4123. * return curve, ts
  4124. */
  4125. __pyx_t_10 = __pyx_PyComplex_FromComplex(__pyx_v_p0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 152, __pyx_L1_error)
  4126. __Pyx_GOTREF(__pyx_t_10);
  4127. __pyx_t_15 = __pyx_PyComplex_FromComplex(__pyx_v_p1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 152, __pyx_L1_error)
  4128. __Pyx_GOTREF(__pyx_t_15);
  4129. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error)
  4130. __Pyx_GOTREF(__pyx_t_8);
  4131. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  4132. __Pyx_GOTREF(__pyx_t_1);
  4133. __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error)
  4134. __Pyx_GOTREF(__pyx_t_7);
  4135. __Pyx_GIVEREF(__pyx_t_10);
  4136. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10)) __PYX_ERR(0, 152, __pyx_L1_error);
  4137. __Pyx_GIVEREF(__pyx_t_15);
  4138. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_15)) __PYX_ERR(0, 152, __pyx_L1_error);
  4139. __Pyx_GIVEREF(__pyx_t_8);
  4140. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error);
  4141. __Pyx_GIVEREF(__pyx_t_1);
  4142. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error);
  4143. __pyx_t_10 = 0;
  4144. __pyx_t_15 = 0;
  4145. __pyx_t_8 = 0;
  4146. __pyx_t_1 = 0;
  4147. __pyx_v_curve = __pyx_t_7;
  4148. __pyx_t_7 = 0;
  4149. /* "fontTools/qu2cu/qu2cu.py":154
  4150. * curve = (p0, p1, p2, p3)
  4151. *
  4152. * return curve, ts # <<<<<<<<<<<<<<
  4153. *
  4154. *
  4155. */
  4156. __Pyx_XDECREF(__pyx_r);
  4157. __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error)
  4158. __Pyx_GOTREF(__pyx_t_7);
  4159. __Pyx_INCREF(__pyx_v_curve);
  4160. __Pyx_GIVEREF(__pyx_v_curve);
  4161. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_curve)) __PYX_ERR(0, 154, __pyx_L1_error);
  4162. __Pyx_INCREF(__pyx_v_ts);
  4163. __Pyx_GIVEREF(__pyx_v_ts);
  4164. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ts)) __PYX_ERR(0, 154, __pyx_L1_error);
  4165. __pyx_r = __pyx_t_7;
  4166. __pyx_t_7 = 0;
  4167. goto __pyx_L0;
  4168. /* "fontTools/qu2cu/qu2cu.py":104
  4169. *
  4170. *
  4171. * @cython.cfunc # <<<<<<<<<<<<<<
  4172. * @cython.locals(
  4173. * start=cython.int,
  4174. */
  4175. /* function exit code */
  4176. __pyx_L1_error:;
  4177. __Pyx_XDECREF(__pyx_t_1);
  4178. __Pyx_XDECREF(__pyx_t_7);
  4179. __Pyx_XDECREF(__pyx_t_8);
  4180. __Pyx_XDECREF(__pyx_t_10);
  4181. __Pyx_XDECREF(__pyx_t_15);
  4182. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.merge_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4183. __pyx_r = 0;
  4184. __pyx_L0:;
  4185. __Pyx_XDECREF(__pyx_v_ts);
  4186. __Pyx_XDECREF(__pyx_v_ck);
  4187. __Pyx_XDECREF(__pyx_v_c_before);
  4188. __Pyx_XDECREF(__pyx_v_curve);
  4189. __Pyx_XGIVEREF(__pyx_r);
  4190. __Pyx_RefNannyFinishContext();
  4191. return __pyx_r;
  4192. }
  4193. /* "fontTools/qu2cu/qu2cu.py":157
  4194. *
  4195. *
  4196. * @cython.locals( # <<<<<<<<<<<<<<
  4197. * count=cython.int,
  4198. * num_offcurves=cython.int,
  4199. */
  4200. /* Python wrapper */
  4201. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_3add_implicit_on_curves(PyObject *__pyx_self,
  4202. #if CYTHON_METH_FASTCALL
  4203. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4204. #else
  4205. PyObject *__pyx_args, PyObject *__pyx_kwds
  4206. #endif
  4207. ); /*proto*/
  4208. PyDoc_STRVAR(__pyx_doc_9fontTools_5qu2cu_5qu2cu_2add_implicit_on_curves, "add_implicit_on_curves(p)");
  4209. static PyMethodDef __pyx_mdef_9fontTools_5qu2cu_5qu2cu_3add_implicit_on_curves = {"add_implicit_on_curves", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_5qu2cu_5qu2cu_3add_implicit_on_curves, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_5qu2cu_5qu2cu_2add_implicit_on_curves};
  4210. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_3add_implicit_on_curves(PyObject *__pyx_self,
  4211. #if CYTHON_METH_FASTCALL
  4212. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4213. #else
  4214. PyObject *__pyx_args, PyObject *__pyx_kwds
  4215. #endif
  4216. ) {
  4217. PyObject *__pyx_v_p = 0;
  4218. #if !CYTHON_METH_FASTCALL
  4219. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4220. #endif
  4221. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4222. PyObject* values[1] = {0};
  4223. int __pyx_lineno = 0;
  4224. const char *__pyx_filename = NULL;
  4225. int __pyx_clineno = 0;
  4226. PyObject *__pyx_r = 0;
  4227. __Pyx_RefNannyDeclarations
  4228. __Pyx_RefNannySetupContext("add_implicit_on_curves (wrapper)", 0);
  4229. #if !CYTHON_METH_FASTCALL
  4230. #if CYTHON_ASSUME_SAFE_MACROS
  4231. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4232. #else
  4233. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4234. #endif
  4235. #endif
  4236. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4237. {
  4238. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
  4239. if (__pyx_kwds) {
  4240. Py_ssize_t kw_args;
  4241. switch (__pyx_nargs) {
  4242. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4243. CYTHON_FALLTHROUGH;
  4244. case 0: break;
  4245. default: goto __pyx_L5_argtuple_error;
  4246. }
  4247. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  4248. switch (__pyx_nargs) {
  4249. case 0:
  4250. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p)) != 0)) {
  4251. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  4252. kw_args--;
  4253. }
  4254. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L3_error)
  4255. else goto __pyx_L5_argtuple_error;
  4256. }
  4257. if (unlikely(kw_args > 0)) {
  4258. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4259. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_implicit_on_curves") < 0)) __PYX_ERR(0, 157, __pyx_L3_error)
  4260. }
  4261. } else if (unlikely(__pyx_nargs != 1)) {
  4262. goto __pyx_L5_argtuple_error;
  4263. } else {
  4264. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4265. }
  4266. __pyx_v_p = values[0];
  4267. }
  4268. goto __pyx_L6_skip;
  4269. __pyx_L5_argtuple_error:;
  4270. __Pyx_RaiseArgtupleInvalid("add_implicit_on_curves", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 157, __pyx_L3_error)
  4271. __pyx_L6_skip:;
  4272. goto __pyx_L4_argument_unpacking_done;
  4273. __pyx_L3_error:;
  4274. {
  4275. Py_ssize_t __pyx_temp;
  4276. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4277. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4278. }
  4279. }
  4280. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.add_implicit_on_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4281. __Pyx_RefNannyFinishContext();
  4282. return NULL;
  4283. __pyx_L4_argument_unpacking_done:;
  4284. __pyx_r = __pyx_pf_9fontTools_5qu2cu_5qu2cu_2add_implicit_on_curves(__pyx_self, __pyx_v_p);
  4285. /* function exit code */
  4286. {
  4287. Py_ssize_t __pyx_temp;
  4288. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4289. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4290. }
  4291. }
  4292. __Pyx_RefNannyFinishContext();
  4293. return __pyx_r;
  4294. }
  4295. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_2add_implicit_on_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p) {
  4296. int __pyx_v_count;
  4297. int __pyx_v_num_offcurves;
  4298. int __pyx_v_i;
  4299. __pyx_t_double_complex __pyx_v_off1;
  4300. __pyx_t_double_complex __pyx_v_off2;
  4301. __pyx_t_double_complex __pyx_v_on;
  4302. PyObject *__pyx_v_q = NULL;
  4303. PyObject *__pyx_r = NULL;
  4304. __Pyx_RefNannyDeclarations
  4305. PyObject *__pyx_t_1 = NULL;
  4306. Py_ssize_t __pyx_t_2;
  4307. int __pyx_t_3;
  4308. int __pyx_t_4;
  4309. int __pyx_t_5;
  4310. __pyx_t_double_complex __pyx_t_6;
  4311. long __pyx_t_7;
  4312. int __pyx_t_8;
  4313. int __pyx_lineno = 0;
  4314. const char *__pyx_filename = NULL;
  4315. int __pyx_clineno = 0;
  4316. __Pyx_RefNannySetupContext("add_implicit_on_curves", 1);
  4317. /* "fontTools/qu2cu/qu2cu.py":166
  4318. * )
  4319. * def add_implicit_on_curves(p):
  4320. * q = list(p) # <<<<<<<<<<<<<<
  4321. * count = 0
  4322. * num_offcurves = len(p) - 2
  4323. */
  4324. __pyx_t_1 = PySequence_List(__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
  4325. __Pyx_GOTREF(__pyx_t_1);
  4326. __pyx_v_q = ((PyObject*)__pyx_t_1);
  4327. __pyx_t_1 = 0;
  4328. /* "fontTools/qu2cu/qu2cu.py":167
  4329. * def add_implicit_on_curves(p):
  4330. * q = list(p)
  4331. * count = 0 # <<<<<<<<<<<<<<
  4332. * num_offcurves = len(p) - 2
  4333. * for i in range(1, num_offcurves):
  4334. */
  4335. __pyx_v_count = 0;
  4336. /* "fontTools/qu2cu/qu2cu.py":168
  4337. * q = list(p)
  4338. * count = 0
  4339. * num_offcurves = len(p) - 2 # <<<<<<<<<<<<<<
  4340. * for i in range(1, num_offcurves):
  4341. * off1 = p[i]
  4342. */
  4343. __pyx_t_2 = PyObject_Length(__pyx_v_p); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 168, __pyx_L1_error)
  4344. __pyx_v_num_offcurves = (__pyx_t_2 - 2);
  4345. /* "fontTools/qu2cu/qu2cu.py":169
  4346. * count = 0
  4347. * num_offcurves = len(p) - 2
  4348. * for i in range(1, num_offcurves): # <<<<<<<<<<<<<<
  4349. * off1 = p[i]
  4350. * off2 = p[i + 1]
  4351. */
  4352. __pyx_t_3 = __pyx_v_num_offcurves;
  4353. __pyx_t_4 = __pyx_t_3;
  4354. for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  4355. __pyx_v_i = __pyx_t_5;
  4356. /* "fontTools/qu2cu/qu2cu.py":170
  4357. * num_offcurves = len(p) - 2
  4358. * for i in range(1, num_offcurves):
  4359. * off1 = p[i] # <<<<<<<<<<<<<<
  4360. * off2 = p[i + 1]
  4361. * on = off1 + (off2 - off1) * 0.5
  4362. */
  4363. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
  4364. __Pyx_GOTREF(__pyx_t_1);
  4365. __pyx_t_6 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
  4366. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4367. __pyx_v_off1 = __pyx_t_6;
  4368. /* "fontTools/qu2cu/qu2cu.py":171
  4369. * for i in range(1, num_offcurves):
  4370. * off1 = p[i]
  4371. * off2 = p[i + 1] # <<<<<<<<<<<<<<
  4372. * on = off1 + (off2 - off1) * 0.5
  4373. * q.insert(i + 1 + count, on)
  4374. */
  4375. __pyx_t_7 = (__pyx_v_i + 1);
  4376. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
  4377. __Pyx_GOTREF(__pyx_t_1);
  4378. __pyx_t_6 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error)
  4379. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4380. __pyx_v_off2 = __pyx_t_6;
  4381. /* "fontTools/qu2cu/qu2cu.py":172
  4382. * off1 = p[i]
  4383. * off2 = p[i + 1]
  4384. * on = off1 + (off2 - off1) * 0.5 # <<<<<<<<<<<<<<
  4385. * q.insert(i + 1 + count, on)
  4386. * count += 1
  4387. */
  4388. __pyx_v_on = __Pyx_c_sum_double(__pyx_v_off1, __Pyx_c_prod_double(__Pyx_c_diff_double(__pyx_v_off2, __pyx_v_off1), __pyx_t_double_complex_from_parts(0.5, 0)));
  4389. /* "fontTools/qu2cu/qu2cu.py":173
  4390. * off2 = p[i + 1]
  4391. * on = off1 + (off2 - off1) * 0.5
  4392. * q.insert(i + 1 + count, on) # <<<<<<<<<<<<<<
  4393. * count += 1
  4394. * return q
  4395. */
  4396. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_on); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  4397. __Pyx_GOTREF(__pyx_t_1);
  4398. __pyx_t_8 = PyList_Insert(__pyx_v_q, ((__pyx_v_i + 1) + __pyx_v_count), __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 173, __pyx_L1_error)
  4399. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4400. /* "fontTools/qu2cu/qu2cu.py":174
  4401. * on = off1 + (off2 - off1) * 0.5
  4402. * q.insert(i + 1 + count, on)
  4403. * count += 1 # <<<<<<<<<<<<<<
  4404. * return q
  4405. *
  4406. */
  4407. __pyx_v_count = (__pyx_v_count + 1);
  4408. }
  4409. /* "fontTools/qu2cu/qu2cu.py":175
  4410. * q.insert(i + 1 + count, on)
  4411. * count += 1
  4412. * return q # <<<<<<<<<<<<<<
  4413. *
  4414. *
  4415. */
  4416. __Pyx_XDECREF(__pyx_r);
  4417. __Pyx_INCREF(__pyx_v_q);
  4418. __pyx_r = __pyx_v_q;
  4419. goto __pyx_L0;
  4420. /* "fontTools/qu2cu/qu2cu.py":157
  4421. *
  4422. *
  4423. * @cython.locals( # <<<<<<<<<<<<<<
  4424. * count=cython.int,
  4425. * num_offcurves=cython.int,
  4426. */
  4427. /* function exit code */
  4428. __pyx_L1_error:;
  4429. __Pyx_XDECREF(__pyx_t_1);
  4430. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.add_implicit_on_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4431. __pyx_r = NULL;
  4432. __pyx_L0:;
  4433. __Pyx_XDECREF(__pyx_v_q);
  4434. __Pyx_XGIVEREF(__pyx_r);
  4435. __Pyx_RefNannyFinishContext();
  4436. return __pyx_r;
  4437. }
  4438. /* "fontTools/qu2cu/qu2cu.py":181
  4439. *
  4440. *
  4441. * @cython.locals( # <<<<<<<<<<<<<<
  4442. * cost=cython.int,
  4443. * is_complex=cython.int,
  4444. */
  4445. /* Python wrapper */
  4446. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_5quadratic_to_curves(PyObject *__pyx_self,
  4447. #if CYTHON_METH_FASTCALL
  4448. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4449. #else
  4450. PyObject *__pyx_args, PyObject *__pyx_kwds
  4451. #endif
  4452. ); /*proto*/
  4453. PyDoc_STRVAR(__pyx_doc_9fontTools_5qu2cu_5qu2cu_4quadratic_to_curves, "quadratic_to_curves(list quads: List[List[Point]], double max_err: float = 0.5, all_cubic: bool = False) -> List[Tuple[Point, ...]]\nConverts a connecting list of quadratic splines to a list of quadratic\n and cubic curves.\n\n A quadratic spline is specified as a list of points. Either each point is\n a 2-tuple of X,Y coordinates, or each point is a complex number with\n real/imaginary components representing X,Y coordinates.\n\n The first and last points are on-curve points and the rest are off-curve\n points, with an implied on-curve point in the middle between every two\n consequtive off-curve points.\n\n Returns:\n The output is a list of tuples of points. Points are represented\n in the same format as the input, either as 2-tuples or complex numbers.\n\n Each tuple is either of length three, for a quadratic curve, or four,\n for a cubic curve. Each curve's last point is the same as the next\n curve's first point.\n\n Args:\n quads: quadratic splines\n\n max_err: absolute error tolerance; defaults to 0.5\n\n all_cubic: if True, only cubic curves are generated; defaults to False\n ");
  4454. static PyMethodDef __pyx_mdef_9fontTools_5qu2cu_5qu2cu_5quadratic_to_curves = {"quadratic_to_curves", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_5qu2cu_5qu2cu_5quadratic_to_curves, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_5qu2cu_5qu2cu_4quadratic_to_curves};
  4455. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_5quadratic_to_curves(PyObject *__pyx_self,
  4456. #if CYTHON_METH_FASTCALL
  4457. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4458. #else
  4459. PyObject *__pyx_args, PyObject *__pyx_kwds
  4460. #endif
  4461. ) {
  4462. PyObject *__pyx_v_quads = 0;
  4463. double __pyx_v_max_err;
  4464. PyObject *__pyx_v_all_cubic = 0;
  4465. #if !CYTHON_METH_FASTCALL
  4466. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4467. #endif
  4468. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4469. PyObject* values[3] = {0,0,0};
  4470. int __pyx_lineno = 0;
  4471. const char *__pyx_filename = NULL;
  4472. int __pyx_clineno = 0;
  4473. PyObject *__pyx_r = 0;
  4474. __Pyx_RefNannyDeclarations
  4475. __Pyx_RefNannySetupContext("quadratic_to_curves (wrapper)", 0);
  4476. #if !CYTHON_METH_FASTCALL
  4477. #if CYTHON_ASSUME_SAFE_MACROS
  4478. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4479. #else
  4480. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4481. #endif
  4482. #endif
  4483. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4484. {
  4485. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_quads,&__pyx_n_s_max_err,&__pyx_n_s_all_cubic,0};
  4486. /* "fontTools/qu2cu/qu2cu.py":188
  4487. * quads: List[List[Point]],
  4488. * max_err: float = 0.5,
  4489. * all_cubic: bool = False, # <<<<<<<<<<<<<<
  4490. * ) -> List[Tuple[Point, ...]]:
  4491. * """Converts a connecting list of quadratic splines to a list of quadratic
  4492. */
  4493. values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
  4494. if (__pyx_kwds) {
  4495. Py_ssize_t kw_args;
  4496. switch (__pyx_nargs) {
  4497. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  4498. CYTHON_FALLTHROUGH;
  4499. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  4500. CYTHON_FALLTHROUGH;
  4501. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4502. CYTHON_FALLTHROUGH;
  4503. case 0: break;
  4504. default: goto __pyx_L5_argtuple_error;
  4505. }
  4506. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  4507. switch (__pyx_nargs) {
  4508. case 0:
  4509. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_quads)) != 0)) {
  4510. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  4511. kw_args--;
  4512. }
  4513. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error)
  4514. else goto __pyx_L5_argtuple_error;
  4515. CYTHON_FALLTHROUGH;
  4516. case 1:
  4517. if (kw_args > 0) {
  4518. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_err);
  4519. if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  4520. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error)
  4521. }
  4522. CYTHON_FALLTHROUGH;
  4523. case 2:
  4524. if (kw_args > 0) {
  4525. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_all_cubic);
  4526. if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  4527. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error)
  4528. }
  4529. }
  4530. if (unlikely(kw_args > 0)) {
  4531. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4532. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "quadratic_to_curves") < 0)) __PYX_ERR(0, 181, __pyx_L3_error)
  4533. }
  4534. } else {
  4535. switch (__pyx_nargs) {
  4536. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  4537. CYTHON_FALLTHROUGH;
  4538. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  4539. CYTHON_FALLTHROUGH;
  4540. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4541. break;
  4542. default: goto __pyx_L5_argtuple_error;
  4543. }
  4544. }
  4545. __pyx_v_quads = ((PyObject*)values[0]);
  4546. if (values[1]) {
  4547. __pyx_v_max_err = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_max_err == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L3_error)
  4548. } else {
  4549. __pyx_v_max_err = ((double)((double)0.5));
  4550. }
  4551. __pyx_v_all_cubic = values[2];
  4552. }
  4553. goto __pyx_L6_skip;
  4554. __pyx_L5_argtuple_error:;
  4555. __Pyx_RaiseArgtupleInvalid("quadratic_to_curves", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 181, __pyx_L3_error)
  4556. __pyx_L6_skip:;
  4557. goto __pyx_L4_argument_unpacking_done;
  4558. __pyx_L3_error:;
  4559. {
  4560. Py_ssize_t __pyx_temp;
  4561. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4562. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4563. }
  4564. }
  4565. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.quadratic_to_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4566. __Pyx_RefNannyFinishContext();
  4567. return NULL;
  4568. __pyx_L4_argument_unpacking_done:;
  4569. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_quads), (&PyList_Type), 0, "quads", 1))) __PYX_ERR(0, 186, __pyx_L1_error)
  4570. __pyx_r = __pyx_pf_9fontTools_5qu2cu_5qu2cu_4quadratic_to_curves(__pyx_self, __pyx_v_quads, __pyx_v_max_err, __pyx_v_all_cubic);
  4571. /* "fontTools/qu2cu/qu2cu.py":181
  4572. *
  4573. *
  4574. * @cython.locals( # <<<<<<<<<<<<<<
  4575. * cost=cython.int,
  4576. * is_complex=cython.int,
  4577. */
  4578. /* function exit code */
  4579. goto __pyx_L0;
  4580. __pyx_L1_error:;
  4581. __pyx_r = NULL;
  4582. __pyx_L0:;
  4583. {
  4584. Py_ssize_t __pyx_temp;
  4585. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4586. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4587. }
  4588. }
  4589. __Pyx_RefNannyFinishContext();
  4590. return __pyx_r;
  4591. }
  4592. static PyObject *__pyx_gb_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  4593. /* "fontTools/qu2cu/qu2cu.py":238
  4594. *
  4595. * if not is_complex:
  4596. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves] # <<<<<<<<<<<<<<
  4597. * return curves
  4598. *
  4599. */
  4600. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  4601. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *__pyx_cur_scope;
  4602. PyObject *__pyx_r = NULL;
  4603. __Pyx_RefNannyDeclarations
  4604. int __pyx_lineno = 0;
  4605. const char *__pyx_filename = NULL;
  4606. int __pyx_clineno = 0;
  4607. __Pyx_RefNannySetupContext("genexpr", 0);
  4608. __pyx_cur_scope = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr(__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
  4609. if (unlikely(!__pyx_cur_scope)) {
  4610. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)Py_None);
  4611. __Pyx_INCREF(Py_None);
  4612. __PYX_ERR(0, 238, __pyx_L1_error)
  4613. } else {
  4614. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  4615. }
  4616. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  4617. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4618. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4619. {
  4620. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_quadratic_to_curves_locals_genex, __pyx_n_s_fontTools_qu2cu_qu2cu); if (unlikely(!gen)) __PYX_ERR(0, 238, __pyx_L1_error)
  4621. __Pyx_DECREF(__pyx_cur_scope);
  4622. __Pyx_RefNannyFinishContext();
  4623. return (PyObject *) gen;
  4624. }
  4625. /* function exit code */
  4626. __pyx_L1_error:;
  4627. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.quadratic_to_curves.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4628. __pyx_r = NULL;
  4629. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  4630. __Pyx_XGIVEREF(__pyx_r);
  4631. __Pyx_RefNannyFinishContext();
  4632. return __pyx_r;
  4633. }
  4634. static PyObject *__pyx_gb_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  4635. {
  4636. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)__pyx_generator->closure);
  4637. PyObject *__pyx_r = NULL;
  4638. PyObject *__pyx_t_1 = NULL;
  4639. Py_ssize_t __pyx_t_2;
  4640. PyObject *(*__pyx_t_3)(PyObject *);
  4641. PyObject *__pyx_t_4 = NULL;
  4642. PyObject *__pyx_t_5 = NULL;
  4643. PyObject *__pyx_t_6 = NULL;
  4644. int __pyx_lineno = 0;
  4645. const char *__pyx_filename = NULL;
  4646. int __pyx_clineno = 0;
  4647. __Pyx_RefNannyDeclarations
  4648. __Pyx_RefNannySetupContext("genexpr", 0);
  4649. switch (__pyx_generator->resume_label) {
  4650. case 0: goto __pyx_L3_first_run;
  4651. case 1: goto __pyx_L6_resume_from_yield;
  4652. default: /* CPython raises the right error here */
  4653. __Pyx_RefNannyFinishContext();
  4654. return NULL;
  4655. }
  4656. __pyx_L3_first_run:;
  4657. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 238, __pyx_L1_error)
  4658. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 238, __pyx_L1_error) }
  4659. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  4660. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  4661. __pyx_t_2 = 0;
  4662. __pyx_t_3 = NULL;
  4663. } else {
  4664. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
  4665. __Pyx_GOTREF(__pyx_t_1);
  4666. __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
  4667. }
  4668. for (;;) {
  4669. if (likely(!__pyx_t_3)) {
  4670. if (likely(PyList_CheckExact(__pyx_t_1))) {
  4671. {
  4672. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  4673. #if !CYTHON_ASSUME_SAFE_MACROS
  4674. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
  4675. #endif
  4676. if (__pyx_t_2 >= __pyx_temp) break;
  4677. }
  4678. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4679. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
  4680. #else
  4681. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
  4682. __Pyx_GOTREF(__pyx_t_4);
  4683. #endif
  4684. } else {
  4685. {
  4686. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  4687. #if !CYTHON_ASSUME_SAFE_MACROS
  4688. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
  4689. #endif
  4690. if (__pyx_t_2 >= __pyx_temp) break;
  4691. }
  4692. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4693. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
  4694. #else
  4695. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
  4696. __Pyx_GOTREF(__pyx_t_4);
  4697. #endif
  4698. }
  4699. } else {
  4700. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  4701. if (unlikely(!__pyx_t_4)) {
  4702. PyObject* exc_type = PyErr_Occurred();
  4703. if (exc_type) {
  4704. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4705. else __PYX_ERR(0, 238, __pyx_L1_error)
  4706. }
  4707. break;
  4708. }
  4709. __Pyx_GOTREF(__pyx_t_4);
  4710. }
  4711. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c);
  4712. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_4);
  4713. __Pyx_GIVEREF(__pyx_t_4);
  4714. __pyx_t_4 = 0;
  4715. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_c, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
  4716. __Pyx_GOTREF(__pyx_t_4);
  4717. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_c, __pyx_n_s_imag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error)
  4718. __Pyx_GOTREF(__pyx_t_5);
  4719. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L1_error)
  4720. __Pyx_GOTREF(__pyx_t_6);
  4721. __Pyx_GIVEREF(__pyx_t_4);
  4722. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error);
  4723. __Pyx_GIVEREF(__pyx_t_5);
  4724. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error);
  4725. __pyx_t_4 = 0;
  4726. __pyx_t_5 = 0;
  4727. __pyx_r = __pyx_t_6;
  4728. __pyx_t_6 = 0;
  4729. __Pyx_XGIVEREF(__pyx_t_1);
  4730. __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
  4731. __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
  4732. __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
  4733. __Pyx_XGIVEREF(__pyx_r);
  4734. __Pyx_RefNannyFinishContext();
  4735. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  4736. /* return from generator, yielding value */
  4737. __pyx_generator->resume_label = 1;
  4738. return __pyx_r;
  4739. __pyx_L6_resume_from_yield:;
  4740. __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
  4741. __pyx_cur_scope->__pyx_t_0 = 0;
  4742. __Pyx_XGOTREF(__pyx_t_1);
  4743. __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
  4744. __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
  4745. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 238, __pyx_L1_error)
  4746. }
  4747. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4748. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  4749. /* function exit code */
  4750. PyErr_SetNone(PyExc_StopIteration);
  4751. goto __pyx_L0;
  4752. __pyx_L1_error:;
  4753. __Pyx_Generator_Replace_StopIteration(0);
  4754. __Pyx_XDECREF(__pyx_t_1);
  4755. __Pyx_XDECREF(__pyx_t_4);
  4756. __Pyx_XDECREF(__pyx_t_5);
  4757. __Pyx_XDECREF(__pyx_t_6);
  4758. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4759. __pyx_L0:;
  4760. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  4761. #if !CYTHON_USE_EXC_INFO_STACK
  4762. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  4763. #endif
  4764. __pyx_generator->resume_label = -1;
  4765. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  4766. __Pyx_RefNannyFinishContext();
  4767. return __pyx_r;
  4768. }
  4769. /* "fontTools/qu2cu/qu2cu.py":181
  4770. *
  4771. *
  4772. * @cython.locals( # <<<<<<<<<<<<<<
  4773. * cost=cython.int,
  4774. * is_complex=cython.int,
  4775. */
  4776. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_4quadratic_to_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quads, double __pyx_v_max_err, PyObject *__pyx_v_all_cubic) {
  4777. int __pyx_v_cost;
  4778. int __pyx_v_is_complex;
  4779. PyObject *__pyx_v_q = NULL;
  4780. PyObject *__pyx_v_costs = NULL;
  4781. PyObject *__pyx_v_p = NULL;
  4782. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  4783. PyObject *__pyx_v_qq = NULL;
  4784. PyObject *__pyx_v_curves = NULL;
  4785. PyObject *__pyx_8genexpr1__pyx_v_p = NULL;
  4786. PyObject *__pyx_8genexpr2__pyx_v_x = NULL;
  4787. PyObject *__pyx_8genexpr2__pyx_v_y = NULL;
  4788. PyObject *__pyx_8genexpr3__pyx_v_curve = NULL;
  4789. PyObject *__pyx_8genexpr3__pyx_v_0 = NULL;
  4790. PyObject *__pyx_r = NULL;
  4791. __Pyx_RefNannyDeclarations
  4792. PyObject *__pyx_t_1 = NULL;
  4793. PyObject *__pyx_t_2 = NULL;
  4794. int __pyx_t_3;
  4795. Py_ssize_t __pyx_t_4;
  4796. PyObject *__pyx_t_5 = NULL;
  4797. PyObject *__pyx_t_6 = NULL;
  4798. Py_ssize_t __pyx_t_7;
  4799. PyObject *(*__pyx_t_8)(PyObject *);
  4800. PyObject *__pyx_t_9 = NULL;
  4801. PyObject *__pyx_t_10 = NULL;
  4802. PyObject *__pyx_t_11 = NULL;
  4803. PyObject *__pyx_t_12 = NULL;
  4804. PyObject *(*__pyx_t_13)(PyObject *);
  4805. Py_ssize_t __pyx_t_14;
  4806. Py_ssize_t __pyx_t_15;
  4807. int __pyx_t_16;
  4808. int __pyx_t_17;
  4809. int __pyx_lineno = 0;
  4810. const char *__pyx_filename = NULL;
  4811. int __pyx_clineno = 0;
  4812. __Pyx_RefNannySetupContext("quadratic_to_curves", 0);
  4813. __Pyx_INCREF(__pyx_v_quads);
  4814. /* "fontTools/qu2cu/qu2cu.py":216
  4815. * all_cubic: if True, only cubic curves are generated; defaults to False
  4816. * """
  4817. * is_complex = type(quads[0][0]) is complex # <<<<<<<<<<<<<<
  4818. * if not is_complex:
  4819. * quads = [[complex(x, y) for (x, y) in p] for p in quads]
  4820. */
  4821. __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_quads, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
  4822. __Pyx_GOTREF(__pyx_t_1);
  4823. __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
  4824. __Pyx_GOTREF(__pyx_t_2);
  4825. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4826. __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_t_2)) == ((PyObject *)(&PyComplex_Type)));
  4827. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4828. __pyx_v_is_complex = __pyx_t_3;
  4829. /* "fontTools/qu2cu/qu2cu.py":217
  4830. * """
  4831. * is_complex = type(quads[0][0]) is complex
  4832. * if not is_complex: # <<<<<<<<<<<<<<
  4833. * quads = [[complex(x, y) for (x, y) in p] for p in quads]
  4834. *
  4835. */
  4836. __pyx_t_3 = (!(__pyx_v_is_complex != 0));
  4837. if (__pyx_t_3) {
  4838. /* "fontTools/qu2cu/qu2cu.py":218
  4839. * is_complex = type(quads[0][0]) is complex
  4840. * if not is_complex:
  4841. * quads = [[complex(x, y) for (x, y) in p] for p in quads] # <<<<<<<<<<<<<<
  4842. *
  4843. * q = [quads[0][0]]
  4844. */
  4845. { /* enter inner scope */
  4846. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L6_error)
  4847. __Pyx_GOTREF(__pyx_t_2);
  4848. __pyx_t_1 = __pyx_v_quads; __Pyx_INCREF(__pyx_t_1);
  4849. __pyx_t_4 = 0;
  4850. for (;;) {
  4851. {
  4852. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  4853. #if !CYTHON_ASSUME_SAFE_MACROS
  4854. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 218, __pyx_L6_error)
  4855. #endif
  4856. if (__pyx_t_4 >= __pyx_temp) break;
  4857. }
  4858. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4859. __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 218, __pyx_L6_error)
  4860. #else
  4861. __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L6_error)
  4862. __Pyx_GOTREF(__pyx_t_5);
  4863. #endif
  4864. __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_p, __pyx_t_5);
  4865. __pyx_t_5 = 0;
  4866. { /* enter inner scope */
  4867. __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L11_error)
  4868. __Pyx_GOTREF(__pyx_t_5);
  4869. if (likely(PyList_CheckExact(__pyx_8genexpr1__pyx_v_p)) || PyTuple_CheckExact(__pyx_8genexpr1__pyx_v_p)) {
  4870. __pyx_t_6 = __pyx_8genexpr1__pyx_v_p; __Pyx_INCREF(__pyx_t_6);
  4871. __pyx_t_7 = 0;
  4872. __pyx_t_8 = NULL;
  4873. } else {
  4874. __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_8genexpr1__pyx_v_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L11_error)
  4875. __Pyx_GOTREF(__pyx_t_6);
  4876. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 218, __pyx_L11_error)
  4877. }
  4878. for (;;) {
  4879. if (likely(!__pyx_t_8)) {
  4880. if (likely(PyList_CheckExact(__pyx_t_6))) {
  4881. {
  4882. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  4883. #if !CYTHON_ASSUME_SAFE_MACROS
  4884. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 218, __pyx_L11_error)
  4885. #endif
  4886. if (__pyx_t_7 >= __pyx_temp) break;
  4887. }
  4888. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4889. __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 218, __pyx_L11_error)
  4890. #else
  4891. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L11_error)
  4892. __Pyx_GOTREF(__pyx_t_9);
  4893. #endif
  4894. } else {
  4895. {
  4896. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  4897. #if !CYTHON_ASSUME_SAFE_MACROS
  4898. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 218, __pyx_L11_error)
  4899. #endif
  4900. if (__pyx_t_7 >= __pyx_temp) break;
  4901. }
  4902. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4903. __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 218, __pyx_L11_error)
  4904. #else
  4905. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L11_error)
  4906. __Pyx_GOTREF(__pyx_t_9);
  4907. #endif
  4908. }
  4909. } else {
  4910. __pyx_t_9 = __pyx_t_8(__pyx_t_6);
  4911. if (unlikely(!__pyx_t_9)) {
  4912. PyObject* exc_type = PyErr_Occurred();
  4913. if (exc_type) {
  4914. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4915. else __PYX_ERR(0, 218, __pyx_L11_error)
  4916. }
  4917. break;
  4918. }
  4919. __Pyx_GOTREF(__pyx_t_9);
  4920. }
  4921. if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
  4922. PyObject* sequence = __pyx_t_9;
  4923. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4924. if (unlikely(size != 2)) {
  4925. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4926. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4927. __PYX_ERR(0, 218, __pyx_L11_error)
  4928. }
  4929. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4930. if (likely(PyTuple_CheckExact(sequence))) {
  4931. __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
  4932. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
  4933. } else {
  4934. __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
  4935. __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
  4936. }
  4937. __Pyx_INCREF(__pyx_t_10);
  4938. __Pyx_INCREF(__pyx_t_11);
  4939. #else
  4940. __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 218, __pyx_L11_error)
  4941. __Pyx_GOTREF(__pyx_t_10);
  4942. __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 218, __pyx_L11_error)
  4943. __Pyx_GOTREF(__pyx_t_11);
  4944. #endif
  4945. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4946. } else {
  4947. Py_ssize_t index = -1;
  4948. __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 218, __pyx_L11_error)
  4949. __Pyx_GOTREF(__pyx_t_12);
  4950. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4951. __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
  4952. index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L14_unpacking_failed;
  4953. __Pyx_GOTREF(__pyx_t_10);
  4954. index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L14_unpacking_failed;
  4955. __Pyx_GOTREF(__pyx_t_11);
  4956. if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) __PYX_ERR(0, 218, __pyx_L11_error)
  4957. __pyx_t_13 = NULL;
  4958. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  4959. goto __pyx_L15_unpacking_done;
  4960. __pyx_L14_unpacking_failed:;
  4961. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  4962. __pyx_t_13 = NULL;
  4963. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4964. __PYX_ERR(0, 218, __pyx_L11_error)
  4965. __pyx_L15_unpacking_done:;
  4966. }
  4967. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_x, __pyx_t_10);
  4968. __pyx_t_10 = 0;
  4969. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_y, __pyx_t_11);
  4970. __pyx_t_11 = 0;
  4971. __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L11_error)
  4972. __Pyx_GOTREF(__pyx_t_9);
  4973. __Pyx_INCREF(__pyx_8genexpr2__pyx_v_x);
  4974. __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_x);
  4975. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_8genexpr2__pyx_v_x)) __PYX_ERR(0, 218, __pyx_L11_error);
  4976. __Pyx_INCREF(__pyx_8genexpr2__pyx_v_y);
  4977. __Pyx_GIVEREF(__pyx_8genexpr2__pyx_v_y);
  4978. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_8genexpr2__pyx_v_y)) __PYX_ERR(0, 218, __pyx_L11_error);
  4979. __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 218, __pyx_L11_error)
  4980. __Pyx_GOTREF(__pyx_t_11);
  4981. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4982. if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 218, __pyx_L11_error)
  4983. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4984. }
  4985. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4986. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x); __pyx_8genexpr2__pyx_v_x = 0;
  4987. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_y); __pyx_8genexpr2__pyx_v_y = 0;
  4988. goto __pyx_L17_exit_scope;
  4989. __pyx_L11_error:;
  4990. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x); __pyx_8genexpr2__pyx_v_x = 0;
  4991. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_y); __pyx_8genexpr2__pyx_v_y = 0;
  4992. goto __pyx_L6_error;
  4993. __pyx_L17_exit_scope:;
  4994. } /* exit inner scope */
  4995. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 218, __pyx_L6_error)
  4996. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4997. }
  4998. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4999. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_p); __pyx_8genexpr1__pyx_v_p = 0;
  5000. goto __pyx_L19_exit_scope;
  5001. __pyx_L6_error:;
  5002. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_p); __pyx_8genexpr1__pyx_v_p = 0;
  5003. goto __pyx_L1_error;
  5004. __pyx_L19_exit_scope:;
  5005. } /* exit inner scope */
  5006. __Pyx_DECREF_SET(__pyx_v_quads, ((PyObject*)__pyx_t_2));
  5007. __pyx_t_2 = 0;
  5008. /* "fontTools/qu2cu/qu2cu.py":217
  5009. * """
  5010. * is_complex = type(quads[0][0]) is complex
  5011. * if not is_complex: # <<<<<<<<<<<<<<
  5012. * quads = [[complex(x, y) for (x, y) in p] for p in quads]
  5013. *
  5014. */
  5015. }
  5016. /* "fontTools/qu2cu/qu2cu.py":220
  5017. * quads = [[complex(x, y) for (x, y) in p] for p in quads]
  5018. *
  5019. * q = [quads[0][0]] # <<<<<<<<<<<<<<
  5020. * costs = [1]
  5021. * cost = 1
  5022. */
  5023. __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_quads, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
  5024. __Pyx_GOTREF(__pyx_t_2);
  5025. __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
  5026. __Pyx_GOTREF(__pyx_t_1);
  5027. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5028. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
  5029. __Pyx_GOTREF(__pyx_t_2);
  5030. __Pyx_GIVEREF(__pyx_t_1);
  5031. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error);
  5032. __pyx_t_1 = 0;
  5033. __pyx_v_q = ((PyObject*)__pyx_t_2);
  5034. __pyx_t_2 = 0;
  5035. /* "fontTools/qu2cu/qu2cu.py":221
  5036. *
  5037. * q = [quads[0][0]]
  5038. * costs = [1] # <<<<<<<<<<<<<<
  5039. * cost = 1
  5040. * for p in quads:
  5041. */
  5042. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
  5043. __Pyx_GOTREF(__pyx_t_2);
  5044. __Pyx_INCREF(__pyx_int_1);
  5045. __Pyx_GIVEREF(__pyx_int_1);
  5046. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1)) __PYX_ERR(0, 221, __pyx_L1_error);
  5047. __pyx_v_costs = ((PyObject*)__pyx_t_2);
  5048. __pyx_t_2 = 0;
  5049. /* "fontTools/qu2cu/qu2cu.py":222
  5050. * q = [quads[0][0]]
  5051. * costs = [1]
  5052. * cost = 1 # <<<<<<<<<<<<<<
  5053. * for p in quads:
  5054. * assert q[-1] == p[0]
  5055. */
  5056. __pyx_v_cost = 1;
  5057. /* "fontTools/qu2cu/qu2cu.py":223
  5058. * costs = [1]
  5059. * cost = 1
  5060. * for p in quads: # <<<<<<<<<<<<<<
  5061. * assert q[-1] == p[0]
  5062. * for i in range(len(p) - 2):
  5063. */
  5064. __pyx_t_2 = __pyx_v_quads; __Pyx_INCREF(__pyx_t_2);
  5065. __pyx_t_4 = 0;
  5066. for (;;) {
  5067. {
  5068. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
  5069. #if !CYTHON_ASSUME_SAFE_MACROS
  5070. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5071. #endif
  5072. if (__pyx_t_4 >= __pyx_temp) break;
  5073. }
  5074. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5075. __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5076. #else
  5077. __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
  5078. __Pyx_GOTREF(__pyx_t_1);
  5079. #endif
  5080. __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_1);
  5081. __pyx_t_1 = 0;
  5082. /* "fontTools/qu2cu/qu2cu.py":224
  5083. * cost = 1
  5084. * for p in quads:
  5085. * assert q[-1] == p[0] # <<<<<<<<<<<<<<
  5086. * for i in range(len(p) - 2):
  5087. * cost += 1
  5088. */
  5089. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5090. if (unlikely(__pyx_assertions_enabled())) {
  5091. __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_q, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
  5092. __Pyx_GOTREF(__pyx_t_1);
  5093. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_p, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error)
  5094. __Pyx_GOTREF(__pyx_t_5);
  5095. __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error)
  5096. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5097. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5098. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 224, __pyx_L1_error)
  5099. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5100. if (unlikely(!__pyx_t_3)) {
  5101. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  5102. __PYX_ERR(0, 224, __pyx_L1_error)
  5103. }
  5104. }
  5105. #else
  5106. if ((1)); else __PYX_ERR(0, 224, __pyx_L1_error)
  5107. #endif
  5108. /* "fontTools/qu2cu/qu2cu.py":225
  5109. * for p in quads:
  5110. * assert q[-1] == p[0]
  5111. * for i in range(len(p) - 2): # <<<<<<<<<<<<<<
  5112. * cost += 1
  5113. * costs.append(cost)
  5114. */
  5115. __pyx_t_7 = PyObject_Length(__pyx_v_p); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 225, __pyx_L1_error)
  5116. __pyx_t_14 = (__pyx_t_7 - 2);
  5117. __pyx_t_7 = __pyx_t_14;
  5118. for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_7; __pyx_t_15+=1) {
  5119. __pyx_v_i = __pyx_t_15;
  5120. /* "fontTools/qu2cu/qu2cu.py":226
  5121. * assert q[-1] == p[0]
  5122. * for i in range(len(p) - 2):
  5123. * cost += 1 # <<<<<<<<<<<<<<
  5124. * costs.append(cost)
  5125. * costs.append(cost)
  5126. */
  5127. __pyx_v_cost = (__pyx_v_cost + 1);
  5128. /* "fontTools/qu2cu/qu2cu.py":227
  5129. * for i in range(len(p) - 2):
  5130. * cost += 1
  5131. * costs.append(cost) # <<<<<<<<<<<<<<
  5132. * costs.append(cost)
  5133. * qq = add_implicit_on_curves(p)[1:]
  5134. */
  5135. __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_cost); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
  5136. __Pyx_GOTREF(__pyx_t_6);
  5137. __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_costs, __pyx_t_6); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 227, __pyx_L1_error)
  5138. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5139. /* "fontTools/qu2cu/qu2cu.py":228
  5140. * cost += 1
  5141. * costs.append(cost)
  5142. * costs.append(cost) # <<<<<<<<<<<<<<
  5143. * qq = add_implicit_on_curves(p)[1:]
  5144. * costs.pop()
  5145. */
  5146. __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_cost); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 228, __pyx_L1_error)
  5147. __Pyx_GOTREF(__pyx_t_6);
  5148. __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_costs, __pyx_t_6); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 228, __pyx_L1_error)
  5149. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5150. }
  5151. /* "fontTools/qu2cu/qu2cu.py":229
  5152. * costs.append(cost)
  5153. * costs.append(cost)
  5154. * qq = add_implicit_on_curves(p)[1:] # <<<<<<<<<<<<<<
  5155. * costs.pop()
  5156. * q.extend(qq)
  5157. */
  5158. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_add_implicit_on_curves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  5159. __Pyx_GOTREF(__pyx_t_5);
  5160. __pyx_t_1 = NULL;
  5161. __pyx_t_17 = 0;
  5162. #if CYTHON_UNPACK_METHODS
  5163. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  5164. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
  5165. if (likely(__pyx_t_1)) {
  5166. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  5167. __Pyx_INCREF(__pyx_t_1);
  5168. __Pyx_INCREF(function);
  5169. __Pyx_DECREF_SET(__pyx_t_5, function);
  5170. __pyx_t_17 = 1;
  5171. }
  5172. }
  5173. #endif
  5174. {
  5175. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_p};
  5176. __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_17, 1+__pyx_t_17);
  5177. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5178. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error)
  5179. __Pyx_GOTREF(__pyx_t_6);
  5180. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5181. }
  5182. __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_6, 1, 0, NULL, NULL, &__pyx_slice_, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  5183. __Pyx_GOTREF(__pyx_t_5);
  5184. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5185. __Pyx_XDECREF_SET(__pyx_v_qq, __pyx_t_5);
  5186. __pyx_t_5 = 0;
  5187. /* "fontTools/qu2cu/qu2cu.py":230
  5188. * costs.append(cost)
  5189. * qq = add_implicit_on_curves(p)[1:]
  5190. * costs.pop() # <<<<<<<<<<<<<<
  5191. * q.extend(qq)
  5192. * cost += 1
  5193. */
  5194. __pyx_t_5 = __Pyx_PyList_Pop(__pyx_v_costs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5195. __Pyx_GOTREF(__pyx_t_5);
  5196. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5197. /* "fontTools/qu2cu/qu2cu.py":231
  5198. * qq = add_implicit_on_curves(p)[1:]
  5199. * costs.pop()
  5200. * q.extend(qq) # <<<<<<<<<<<<<<
  5201. * cost += 1
  5202. * costs.append(cost)
  5203. */
  5204. __pyx_t_16 = __Pyx_PyList_Extend(__pyx_v_q, __pyx_v_qq); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 231, __pyx_L1_error)
  5205. /* "fontTools/qu2cu/qu2cu.py":232
  5206. * costs.pop()
  5207. * q.extend(qq)
  5208. * cost += 1 # <<<<<<<<<<<<<<
  5209. * costs.append(cost)
  5210. *
  5211. */
  5212. __pyx_v_cost = (__pyx_v_cost + 1);
  5213. /* "fontTools/qu2cu/qu2cu.py":233
  5214. * q.extend(qq)
  5215. * cost += 1
  5216. * costs.append(cost) # <<<<<<<<<<<<<<
  5217. *
  5218. * curves = spline_to_curves(q, costs, max_err, all_cubic)
  5219. */
  5220. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_cost); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
  5221. __Pyx_GOTREF(__pyx_t_5);
  5222. __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_costs, __pyx_t_5); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error)
  5223. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5224. /* "fontTools/qu2cu/qu2cu.py":223
  5225. * costs = [1]
  5226. * cost = 1
  5227. * for p in quads: # <<<<<<<<<<<<<<
  5228. * assert q[-1] == p[0]
  5229. * for i in range(len(p) - 2):
  5230. */
  5231. }
  5232. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5233. /* "fontTools/qu2cu/qu2cu.py":235
  5234. * costs.append(cost)
  5235. *
  5236. * curves = spline_to_curves(q, costs, max_err, all_cubic) # <<<<<<<<<<<<<<
  5237. *
  5238. * if not is_complex:
  5239. */
  5240. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_spline_to_curves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
  5241. __Pyx_GOTREF(__pyx_t_5);
  5242. __pyx_t_6 = PyFloat_FromDouble(__pyx_v_max_err); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
  5243. __Pyx_GOTREF(__pyx_t_6);
  5244. __pyx_t_1 = NULL;
  5245. __pyx_t_17 = 0;
  5246. #if CYTHON_UNPACK_METHODS
  5247. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  5248. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
  5249. if (likely(__pyx_t_1)) {
  5250. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  5251. __Pyx_INCREF(__pyx_t_1);
  5252. __Pyx_INCREF(function);
  5253. __Pyx_DECREF_SET(__pyx_t_5, function);
  5254. __pyx_t_17 = 1;
  5255. }
  5256. }
  5257. #endif
  5258. {
  5259. PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_v_q, __pyx_v_costs, __pyx_t_6, __pyx_v_all_cubic};
  5260. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_17, 4+__pyx_t_17);
  5261. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5262. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5263. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  5264. __Pyx_GOTREF(__pyx_t_2);
  5265. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5266. }
  5267. __pyx_v_curves = __pyx_t_2;
  5268. __pyx_t_2 = 0;
  5269. /* "fontTools/qu2cu/qu2cu.py":237
  5270. * curves = spline_to_curves(q, costs, max_err, all_cubic)
  5271. *
  5272. * if not is_complex: # <<<<<<<<<<<<<<
  5273. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves]
  5274. * return curves
  5275. */
  5276. __pyx_t_3 = (!(__pyx_v_is_complex != 0));
  5277. if (__pyx_t_3) {
  5278. /* "fontTools/qu2cu/qu2cu.py":238
  5279. *
  5280. * if not is_complex:
  5281. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves] # <<<<<<<<<<<<<<
  5282. * return curves
  5283. *
  5284. */
  5285. { /* enter inner scope */
  5286. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L28_error)
  5287. __Pyx_GOTREF(__pyx_t_2);
  5288. if (likely(PyList_CheckExact(__pyx_v_curves)) || PyTuple_CheckExact(__pyx_v_curves)) {
  5289. __pyx_t_5 = __pyx_v_curves; __Pyx_INCREF(__pyx_t_5);
  5290. __pyx_t_4 = 0;
  5291. __pyx_t_8 = NULL;
  5292. } else {
  5293. __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_curves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L28_error)
  5294. __Pyx_GOTREF(__pyx_t_5);
  5295. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 238, __pyx_L28_error)
  5296. }
  5297. for (;;) {
  5298. if (likely(!__pyx_t_8)) {
  5299. if (likely(PyList_CheckExact(__pyx_t_5))) {
  5300. {
  5301. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  5302. #if !CYTHON_ASSUME_SAFE_MACROS
  5303. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L28_error)
  5304. #endif
  5305. if (__pyx_t_4 >= __pyx_temp) break;
  5306. }
  5307. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5308. __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L28_error)
  5309. #else
  5310. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L28_error)
  5311. __Pyx_GOTREF(__pyx_t_6);
  5312. #endif
  5313. } else {
  5314. {
  5315. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  5316. #if !CYTHON_ASSUME_SAFE_MACROS
  5317. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 238, __pyx_L28_error)
  5318. #endif
  5319. if (__pyx_t_4 >= __pyx_temp) break;
  5320. }
  5321. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5322. __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 238, __pyx_L28_error)
  5323. #else
  5324. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L28_error)
  5325. __Pyx_GOTREF(__pyx_t_6);
  5326. #endif
  5327. }
  5328. } else {
  5329. __pyx_t_6 = __pyx_t_8(__pyx_t_5);
  5330. if (unlikely(!__pyx_t_6)) {
  5331. PyObject* exc_type = PyErr_Occurred();
  5332. if (exc_type) {
  5333. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5334. else __PYX_ERR(0, 238, __pyx_L28_error)
  5335. }
  5336. break;
  5337. }
  5338. __Pyx_GOTREF(__pyx_t_6);
  5339. }
  5340. __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_curve, __pyx_t_6);
  5341. __pyx_t_6 = 0;
  5342. __pyx_t_6 = __pyx_pf_9fontTools_5qu2cu_5qu2cu_19quadratic_to_curves_8genexpr3_genexpr(NULL, __pyx_8genexpr3__pyx_v_curve); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L28_error)
  5343. __Pyx_GOTREF(__pyx_t_6);
  5344. __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L28_error)
  5345. __Pyx_GOTREF(__pyx_t_1);
  5346. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5347. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 238, __pyx_L28_error)
  5348. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5349. }
  5350. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5351. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_curve); __pyx_8genexpr3__pyx_v_curve = 0;
  5352. goto __pyx_L32_exit_scope;
  5353. __pyx_L28_error:;
  5354. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_curve); __pyx_8genexpr3__pyx_v_curve = 0;
  5355. goto __pyx_L1_error;
  5356. __pyx_L32_exit_scope:;
  5357. } /* exit inner scope */
  5358. __Pyx_DECREF_SET(__pyx_v_curves, __pyx_t_2);
  5359. __pyx_t_2 = 0;
  5360. /* "fontTools/qu2cu/qu2cu.py":237
  5361. * curves = spline_to_curves(q, costs, max_err, all_cubic)
  5362. *
  5363. * if not is_complex: # <<<<<<<<<<<<<<
  5364. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves]
  5365. * return curves
  5366. */
  5367. }
  5368. /* "fontTools/qu2cu/qu2cu.py":239
  5369. * if not is_complex:
  5370. * curves = [tuple((c.real, c.imag) for c in curve) for curve in curves]
  5371. * return curves # <<<<<<<<<<<<<<
  5372. *
  5373. *
  5374. */
  5375. __Pyx_XDECREF(__pyx_r);
  5376. if (!(likely(PyList_CheckExact(__pyx_v_curves))||((__pyx_v_curves) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_curves))) __PYX_ERR(0, 239, __pyx_L1_error)
  5377. __Pyx_INCREF(__pyx_v_curves);
  5378. __pyx_r = ((PyObject*)__pyx_v_curves);
  5379. goto __pyx_L0;
  5380. /* "fontTools/qu2cu/qu2cu.py":181
  5381. *
  5382. *
  5383. * @cython.locals( # <<<<<<<<<<<<<<
  5384. * cost=cython.int,
  5385. * is_complex=cython.int,
  5386. */
  5387. /* function exit code */
  5388. __pyx_L1_error:;
  5389. __Pyx_XDECREF(__pyx_t_1);
  5390. __Pyx_XDECREF(__pyx_t_2);
  5391. __Pyx_XDECREF(__pyx_t_5);
  5392. __Pyx_XDECREF(__pyx_t_6);
  5393. __Pyx_XDECREF(__pyx_t_9);
  5394. __Pyx_XDECREF(__pyx_t_10);
  5395. __Pyx_XDECREF(__pyx_t_11);
  5396. __Pyx_XDECREF(__pyx_t_12);
  5397. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.quadratic_to_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5398. __pyx_r = NULL;
  5399. __pyx_L0:;
  5400. __Pyx_XDECREF(__pyx_v_q);
  5401. __Pyx_XDECREF(__pyx_v_costs);
  5402. __Pyx_XDECREF(__pyx_v_p);
  5403. __Pyx_XDECREF(__pyx_v_qq);
  5404. __Pyx_XDECREF(__pyx_v_curves);
  5405. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_p);
  5406. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_x);
  5407. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_y);
  5408. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_curve);
  5409. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_0);
  5410. __Pyx_XDECREF(__pyx_v_quads);
  5411. __Pyx_XGIVEREF(__pyx_r);
  5412. __Pyx_RefNannyFinishContext();
  5413. return __pyx_r;
  5414. }
  5415. /* "fontTools/qu2cu/qu2cu.py":245
  5416. *
  5417. *
  5418. * @cython.locals( # <<<<<<<<<<<<<<
  5419. * i=cython.int,
  5420. * j=cython.int,
  5421. */
  5422. /* Python wrapper */
  5423. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_7spline_to_curves(PyObject *__pyx_self,
  5424. #if CYTHON_METH_FASTCALL
  5425. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5426. #else
  5427. PyObject *__pyx_args, PyObject *__pyx_kwds
  5428. #endif
  5429. ); /*proto*/
  5430. PyDoc_STRVAR(__pyx_doc_9fontTools_5qu2cu_5qu2cu_6spline_to_curves, "spline_to_curves(q, costs, double tolerance=0.5, int all_cubic=False)\n\n q: quadratic spline with alternating on-curve / off-curve points.\n\n costs: cumulative list of encoding cost of q in terms of number of\n points that need to be encoded. Implied on-curve points do not\n contribute to the cost. If all points need to be encoded, then\n costs will be range(1, len(q)+1).\n ");
  5431. static PyMethodDef __pyx_mdef_9fontTools_5qu2cu_5qu2cu_7spline_to_curves = {"spline_to_curves", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_5qu2cu_5qu2cu_7spline_to_curves, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_5qu2cu_5qu2cu_6spline_to_curves};
  5432. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_7spline_to_curves(PyObject *__pyx_self,
  5433. #if CYTHON_METH_FASTCALL
  5434. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5435. #else
  5436. PyObject *__pyx_args, PyObject *__pyx_kwds
  5437. #endif
  5438. ) {
  5439. PyObject *__pyx_v_q = 0;
  5440. PyObject *__pyx_v_costs = 0;
  5441. double __pyx_v_tolerance;
  5442. int __pyx_v_all_cubic;
  5443. #if !CYTHON_METH_FASTCALL
  5444. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5445. #endif
  5446. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5447. PyObject* values[4] = {0,0,0,0};
  5448. int __pyx_lineno = 0;
  5449. const char *__pyx_filename = NULL;
  5450. int __pyx_clineno = 0;
  5451. PyObject *__pyx_r = 0;
  5452. __Pyx_RefNannyDeclarations
  5453. __Pyx_RefNannySetupContext("spline_to_curves (wrapper)", 0);
  5454. #if !CYTHON_METH_FASTCALL
  5455. #if CYTHON_ASSUME_SAFE_MACROS
  5456. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5457. #else
  5458. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5459. #endif
  5460. #endif
  5461. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5462. {
  5463. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_costs,&__pyx_n_s_tolerance,&__pyx_n_s_all_cubic,0};
  5464. if (__pyx_kwds) {
  5465. Py_ssize_t kw_args;
  5466. switch (__pyx_nargs) {
  5467. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  5468. CYTHON_FALLTHROUGH;
  5469. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  5470. CYTHON_FALLTHROUGH;
  5471. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  5472. CYTHON_FALLTHROUGH;
  5473. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  5474. CYTHON_FALLTHROUGH;
  5475. case 0: break;
  5476. default: goto __pyx_L5_argtuple_error;
  5477. }
  5478. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  5479. switch (__pyx_nargs) {
  5480. case 0:
  5481. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
  5482. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  5483. kw_args--;
  5484. }
  5485. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error)
  5486. else goto __pyx_L5_argtuple_error;
  5487. CYTHON_FALLTHROUGH;
  5488. case 1:
  5489. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_costs)) != 0)) {
  5490. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  5491. kw_args--;
  5492. }
  5493. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error)
  5494. else {
  5495. __Pyx_RaiseArgtupleInvalid("spline_to_curves", 0, 2, 4, 1); __PYX_ERR(0, 245, __pyx_L3_error)
  5496. }
  5497. CYTHON_FALLTHROUGH;
  5498. case 2:
  5499. if (kw_args > 0) {
  5500. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tolerance);
  5501. if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  5502. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error)
  5503. }
  5504. CYTHON_FALLTHROUGH;
  5505. case 3:
  5506. if (kw_args > 0) {
  5507. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_all_cubic);
  5508. if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  5509. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error)
  5510. }
  5511. }
  5512. if (unlikely(kw_args > 0)) {
  5513. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5514. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "spline_to_curves") < 0)) __PYX_ERR(0, 245, __pyx_L3_error)
  5515. }
  5516. } else {
  5517. switch (__pyx_nargs) {
  5518. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  5519. CYTHON_FALLTHROUGH;
  5520. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  5521. CYTHON_FALLTHROUGH;
  5522. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  5523. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  5524. break;
  5525. default: goto __pyx_L5_argtuple_error;
  5526. }
  5527. }
  5528. __pyx_v_q = values[0];
  5529. __pyx_v_costs = values[1];
  5530. if (values[2]) {
  5531. __pyx_v_tolerance = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L3_error)
  5532. } else {
  5533. __pyx_v_tolerance = ((double)((double)0.5));
  5534. }
  5535. if (values[3]) {
  5536. __pyx_v_all_cubic = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_all_cubic == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L3_error)
  5537. } else {
  5538. /* "fontTools/qu2cu/qu2cu.py":268
  5539. * u=cython.complex,
  5540. * )
  5541. * def spline_to_curves(q, costs, tolerance=0.5, all_cubic=False): # <<<<<<<<<<<<<<
  5542. * """
  5543. * q: quadratic spline with alternating on-curve / off-curve points.
  5544. */
  5545. __pyx_v_all_cubic = ((int)((int)0));
  5546. }
  5547. }
  5548. goto __pyx_L6_skip;
  5549. __pyx_L5_argtuple_error:;
  5550. __Pyx_RaiseArgtupleInvalid("spline_to_curves", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 245, __pyx_L3_error)
  5551. __pyx_L6_skip:;
  5552. goto __pyx_L4_argument_unpacking_done;
  5553. __pyx_L3_error:;
  5554. {
  5555. Py_ssize_t __pyx_temp;
  5556. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5557. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  5558. }
  5559. }
  5560. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.spline_to_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5561. __Pyx_RefNannyFinishContext();
  5562. return NULL;
  5563. __pyx_L4_argument_unpacking_done:;
  5564. __pyx_r = __pyx_pf_9fontTools_5qu2cu_5qu2cu_6spline_to_curves(__pyx_self, __pyx_v_q, __pyx_v_costs, __pyx_v_tolerance, __pyx_v_all_cubic);
  5565. /* "fontTools/qu2cu/qu2cu.py":245
  5566. *
  5567. *
  5568. * @cython.locals( # <<<<<<<<<<<<<<
  5569. * i=cython.int,
  5570. * j=cython.int,
  5571. */
  5572. /* function exit code */
  5573. {
  5574. Py_ssize_t __pyx_temp;
  5575. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5576. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  5577. }
  5578. }
  5579. __Pyx_RefNannyFinishContext();
  5580. return __pyx_r;
  5581. }
  5582. static PyObject *__pyx_gb_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  5583. /* "fontTools/qu2cu/qu2cu.py":343
  5584. * for k, reconst in enumerate(reconstructed):
  5585. * orig = elevated_quadratics[j + k]
  5586. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig)) # <<<<<<<<<<<<<<
  5587. *
  5588. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance):
  5589. */
  5590. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  5591. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  5592. PyObject *__pyx_r = NULL;
  5593. __Pyx_RefNannyDeclarations
  5594. int __pyx_lineno = 0;
  5595. const char *__pyx_filename = NULL;
  5596. int __pyx_clineno = 0;
  5597. __Pyx_RefNannySetupContext("genexpr", 0);
  5598. __pyx_cur_scope = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr(__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  5599. if (unlikely(!__pyx_cur_scope)) {
  5600. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)Py_None);
  5601. __Pyx_INCREF(Py_None);
  5602. __PYX_ERR(0, 343, __pyx_L1_error)
  5603. } else {
  5604. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  5605. }
  5606. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  5607. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  5608. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  5609. {
  5610. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_spline_to_curves_locals_genexpr, __pyx_n_s_fontTools_qu2cu_qu2cu); if (unlikely(!gen)) __PYX_ERR(0, 343, __pyx_L1_error)
  5611. __Pyx_DECREF(__pyx_cur_scope);
  5612. __Pyx_RefNannyFinishContext();
  5613. return (PyObject *) gen;
  5614. }
  5615. /* function exit code */
  5616. __pyx_L1_error:;
  5617. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.spline_to_curves.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5618. __pyx_r = NULL;
  5619. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  5620. __Pyx_XGIVEREF(__pyx_r);
  5621. __Pyx_RefNannyFinishContext();
  5622. return __pyx_r;
  5623. }
  5624. static PyObject *__pyx_gb_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  5625. {
  5626. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  5627. PyObject *__pyx_r = NULL;
  5628. PyObject *__pyx_t_1 = NULL;
  5629. Py_ssize_t __pyx_t_2;
  5630. PyObject *(*__pyx_t_3)(PyObject *);
  5631. PyObject *__pyx_t_4 = NULL;
  5632. PyObject *__pyx_t_5 = NULL;
  5633. PyObject *__pyx_t_6 = NULL;
  5634. PyObject *__pyx_t_7 = NULL;
  5635. PyObject *(*__pyx_t_8)(PyObject *);
  5636. __pyx_t_double_complex __pyx_t_9;
  5637. __pyx_t_double_complex __pyx_t_10;
  5638. int __pyx_lineno = 0;
  5639. const char *__pyx_filename = NULL;
  5640. int __pyx_clineno = 0;
  5641. __Pyx_RefNannyDeclarations
  5642. __Pyx_RefNannySetupContext("genexpr", 0);
  5643. switch (__pyx_generator->resume_label) {
  5644. case 0: goto __pyx_L3_first_run;
  5645. case 1: goto __pyx_L8_resume_from_yield;
  5646. default: /* CPython raises the right error here */
  5647. __Pyx_RefNannyFinishContext();
  5648. return NULL;
  5649. }
  5650. __pyx_L3_first_run:;
  5651. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_error)
  5652. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 343, __pyx_L1_error) }
  5653. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  5654. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  5655. __pyx_t_2 = 0;
  5656. __pyx_t_3 = NULL;
  5657. } else {
  5658. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
  5659. __Pyx_GOTREF(__pyx_t_1);
  5660. __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
  5661. }
  5662. for (;;) {
  5663. if (likely(!__pyx_t_3)) {
  5664. if (likely(PyList_CheckExact(__pyx_t_1))) {
  5665. {
  5666. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  5667. #if !CYTHON_ASSUME_SAFE_MACROS
  5668. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 343, __pyx_L1_error)
  5669. #endif
  5670. if (__pyx_t_2 >= __pyx_temp) break;
  5671. }
  5672. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5673. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 343, __pyx_L1_error)
  5674. #else
  5675. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
  5676. __Pyx_GOTREF(__pyx_t_4);
  5677. #endif
  5678. } else {
  5679. {
  5680. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  5681. #if !CYTHON_ASSUME_SAFE_MACROS
  5682. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 343, __pyx_L1_error)
  5683. #endif
  5684. if (__pyx_t_2 >= __pyx_temp) break;
  5685. }
  5686. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5687. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 343, __pyx_L1_error)
  5688. #else
  5689. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
  5690. __Pyx_GOTREF(__pyx_t_4);
  5691. #endif
  5692. }
  5693. } else {
  5694. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  5695. if (unlikely(!__pyx_t_4)) {
  5696. PyObject* exc_type = PyErr_Occurred();
  5697. if (exc_type) {
  5698. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5699. else __PYX_ERR(0, 343, __pyx_L1_error)
  5700. }
  5701. break;
  5702. }
  5703. __Pyx_GOTREF(__pyx_t_4);
  5704. }
  5705. if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
  5706. PyObject* sequence = __pyx_t_4;
  5707. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5708. if (unlikely(size != 2)) {
  5709. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5710. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5711. __PYX_ERR(0, 343, __pyx_L1_error)
  5712. }
  5713. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5714. if (likely(PyTuple_CheckExact(sequence))) {
  5715. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  5716. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  5717. } else {
  5718. __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
  5719. __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
  5720. }
  5721. __Pyx_INCREF(__pyx_t_5);
  5722. __Pyx_INCREF(__pyx_t_6);
  5723. #else
  5724. __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
  5725. __Pyx_GOTREF(__pyx_t_5);
  5726. __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L1_error)
  5727. __Pyx_GOTREF(__pyx_t_6);
  5728. #endif
  5729. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5730. } else {
  5731. Py_ssize_t index = -1;
  5732. __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
  5733. __Pyx_GOTREF(__pyx_t_7);
  5734. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5735. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  5736. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
  5737. __Pyx_GOTREF(__pyx_t_5);
  5738. index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
  5739. __Pyx_GOTREF(__pyx_t_6);
  5740. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
  5741. __pyx_t_8 = NULL;
  5742. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5743. goto __pyx_L7_unpacking_done;
  5744. __pyx_L6_unpacking_failed:;
  5745. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5746. __pyx_t_8 = NULL;
  5747. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  5748. __PYX_ERR(0, 343, __pyx_L1_error)
  5749. __pyx_L7_unpacking_done:;
  5750. }
  5751. __pyx_t_9 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  5752. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5753. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  5754. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5755. __pyx_cur_scope->__pyx_v_v = __pyx_t_9;
  5756. __pyx_cur_scope->__pyx_v_u = __pyx_t_10;
  5757. __pyx_t_10 = __Pyx_c_diff_double(__pyx_cur_scope->__pyx_v_v, __pyx_cur_scope->__pyx_v_u);
  5758. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
  5759. __Pyx_GOTREF(__pyx_t_4);
  5760. __pyx_r = __pyx_t_4;
  5761. __pyx_t_4 = 0;
  5762. __Pyx_XGIVEREF(__pyx_t_1);
  5763. __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
  5764. __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
  5765. __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
  5766. __Pyx_XGIVEREF(__pyx_r);
  5767. __Pyx_RefNannyFinishContext();
  5768. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  5769. /* return from generator, yielding value */
  5770. __pyx_generator->resume_label = 1;
  5771. return __pyx_r;
  5772. __pyx_L8_resume_from_yield:;
  5773. __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
  5774. __pyx_cur_scope->__pyx_t_0 = 0;
  5775. __Pyx_XGOTREF(__pyx_t_1);
  5776. __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
  5777. __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
  5778. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_error)
  5779. }
  5780. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5781. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  5782. /* function exit code */
  5783. PyErr_SetNone(PyExc_StopIteration);
  5784. goto __pyx_L0;
  5785. __pyx_L1_error:;
  5786. __Pyx_Generator_Replace_StopIteration(0);
  5787. __Pyx_XDECREF(__pyx_t_1);
  5788. __Pyx_XDECREF(__pyx_t_4);
  5789. __Pyx_XDECREF(__pyx_t_5);
  5790. __Pyx_XDECREF(__pyx_t_6);
  5791. __Pyx_XDECREF(__pyx_t_7);
  5792. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5793. __pyx_L0:;
  5794. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  5795. #if !CYTHON_USE_EXC_INFO_STACK
  5796. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  5797. #endif
  5798. __pyx_generator->resume_label = -1;
  5799. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  5800. __Pyx_RefNannyFinishContext();
  5801. return __pyx_r;
  5802. }
  5803. /* "fontTools/qu2cu/qu2cu.py":245
  5804. *
  5805. *
  5806. * @cython.locals( # <<<<<<<<<<<<<<
  5807. * i=cython.int,
  5808. * j=cython.int,
  5809. */
  5810. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_6spline_to_curves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_q, PyObject *__pyx_v_costs, double __pyx_v_tolerance, int __pyx_v_all_cubic) {
  5811. int __pyx_v_i;
  5812. int __pyx_v_j;
  5813. int __pyx_v_k;
  5814. int __pyx_v_start;
  5815. int __pyx_v_i_sol_count;
  5816. int __pyx_v_j_sol_count;
  5817. double __pyx_v_err;
  5818. double __pyx_v_error;
  5819. double __pyx_v_i_sol_error;
  5820. double __pyx_v_j_sol_error;
  5821. int __pyx_v_is_cubic;
  5822. int __pyx_v_count;
  5823. __pyx_t_double_complex __pyx_v_p0;
  5824. __pyx_t_double_complex __pyx_v_p1;
  5825. __pyx_t_double_complex __pyx_v_p2;
  5826. __pyx_t_double_complex __pyx_v_p3;
  5827. PyObject *__pyx_v_elevated_quadratics = NULL;
  5828. PyObject *__pyx_v_forced = NULL;
  5829. PyObject *__pyx_v_sols = NULL;
  5830. PyObject *__pyx_v_impossible = NULL;
  5831. PyObject *__pyx_v_best_sol = NULL;
  5832. PyObject *__pyx_v_this_count = NULL;
  5833. PyObject *__pyx_v_i_sol = NULL;
  5834. PyObject *__pyx_v_curve = NULL;
  5835. PyObject *__pyx_v_ts = NULL;
  5836. PyObject *__pyx_v_reconstructed_iter = NULL;
  5837. PyObject *__pyx_v_reconstructed = NULL;
  5838. PyObject *__pyx_v_reconst = NULL;
  5839. PyObject *__pyx_v_orig = NULL;
  5840. PyObject *__pyx_v_splits = NULL;
  5841. PyObject *__pyx_v_cubic = NULL;
  5842. PyObject *__pyx_v_curves = NULL;
  5843. int __pyx_8genexpr5__pyx_v_i;
  5844. PyObject *__pyx_gb_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_2generator1 = 0;
  5845. PyObject *__pyx_r = NULL;
  5846. __Pyx_RefNannyDeclarations
  5847. Py_ssize_t __pyx_t_1;
  5848. int __pyx_t_2;
  5849. PyObject *__pyx_t_3 = NULL;
  5850. Py_ssize_t __pyx_t_4;
  5851. int __pyx_t_5;
  5852. PyObject *__pyx_t_6 = NULL;
  5853. PyObject *__pyx_t_7 = NULL;
  5854. PyObject *__pyx_t_8 = NULL;
  5855. long __pyx_t_9;
  5856. __pyx_t_double_complex __pyx_t_10;
  5857. int __pyx_t_11;
  5858. int __pyx_t_12;
  5859. int __pyx_t_13;
  5860. int __pyx_t_14;
  5861. int __pyx_t_15;
  5862. double __pyx_t_16;
  5863. PyObject *__pyx_t_17 = NULL;
  5864. PyObject *__pyx_t_18 = NULL;
  5865. PyObject *__pyx_t_19 = NULL;
  5866. PyObject *__pyx_t_20 = NULL;
  5867. PyObject *__pyx_t_21 = NULL;
  5868. PyObject *(*__pyx_t_22)(PyObject *);
  5869. Py_ssize_t __pyx_t_23;
  5870. PyObject *(*__pyx_t_24)(PyObject *);
  5871. int __pyx_t_25;
  5872. double __pyx_t_26;
  5873. double __pyx_t_27;
  5874. __pyx_t_double_complex __pyx_t_28;
  5875. __pyx_t_double_complex __pyx_t_29;
  5876. __pyx_t_double_complex __pyx_t_30;
  5877. int __pyx_lineno = 0;
  5878. const char *__pyx_filename = NULL;
  5879. int __pyx_clineno = 0;
  5880. __Pyx_RefNannySetupContext("spline_to_curves", 1);
  5881. /* "fontTools/qu2cu/qu2cu.py":278
  5882. * """
  5883. *
  5884. * assert len(q) >= 3, "quadratic spline requires at least 3 points" # <<<<<<<<<<<<<<
  5885. *
  5886. * # Elevate quadratic segments to cubic
  5887. */
  5888. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5889. if (unlikely(__pyx_assertions_enabled())) {
  5890. __pyx_t_1 = PyObject_Length(__pyx_v_q); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 278, __pyx_L1_error)
  5891. __pyx_t_2 = (__pyx_t_1 >= 3);
  5892. if (unlikely(!__pyx_t_2)) {
  5893. __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_quadratic_spline_requires_at_lea, 0, 0);
  5894. __PYX_ERR(0, 278, __pyx_L1_error)
  5895. }
  5896. }
  5897. #else
  5898. if ((1)); else __PYX_ERR(0, 278, __pyx_L1_error)
  5899. #endif
  5900. /* "fontTools/qu2cu/qu2cu.py":281
  5901. *
  5902. * # Elevate quadratic segments to cubic
  5903. * elevated_quadratics = [ # <<<<<<<<<<<<<<
  5904. * elevate_quadratic(*q[i : i + 3]) for i in range(0, len(q) - 2, 2)
  5905. * ]
  5906. */
  5907. { /* enter inner scope */
  5908. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
  5909. __Pyx_GOTREF(__pyx_t_3);
  5910. /* "fontTools/qu2cu/qu2cu.py":282
  5911. * # Elevate quadratic segments to cubic
  5912. * elevated_quadratics = [
  5913. * elevate_quadratic(*q[i : i + 3]) for i in range(0, len(q) - 2, 2) # <<<<<<<<<<<<<<
  5914. * ]
  5915. *
  5916. */
  5917. __pyx_t_1 = PyObject_Length(__pyx_v_q); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 282, __pyx_L1_error)
  5918. __pyx_t_4 = (__pyx_t_1 - 2);
  5919. __pyx_t_1 = __pyx_t_4;
  5920. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=2) {
  5921. __pyx_8genexpr5__pyx_v_i = __pyx_t_5;
  5922. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_elevate_quadratic); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
  5923. __Pyx_GOTREF(__pyx_t_6);
  5924. __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_q, __pyx_8genexpr5__pyx_v_i, (__pyx_8genexpr5__pyx_v_i + 3), NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
  5925. __Pyx_GOTREF(__pyx_t_7);
  5926. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 282, __pyx_L1_error)
  5927. __Pyx_GOTREF(__pyx_t_8);
  5928. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5929. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
  5930. __Pyx_GOTREF(__pyx_t_7);
  5931. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5932. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5933. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 281, __pyx_L1_error)
  5934. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5935. }
  5936. } /* exit inner scope */
  5937. __pyx_v_elevated_quadratics = ((PyObject*)__pyx_t_3);
  5938. __pyx_t_3 = 0;
  5939. /* "fontTools/qu2cu/qu2cu.py":286
  5940. *
  5941. * # Find sharp corners; they have to be oncurves for sure.
  5942. * forced = set() # <<<<<<<<<<<<<<
  5943. * for i in range(1, len(elevated_quadratics)):
  5944. * p0 = elevated_quadratics[i - 1][2]
  5945. */
  5946. __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error)
  5947. __Pyx_GOTREF(__pyx_t_3);
  5948. __pyx_v_forced = ((PyObject*)__pyx_t_3);
  5949. __pyx_t_3 = 0;
  5950. /* "fontTools/qu2cu/qu2cu.py":287
  5951. * # Find sharp corners; they have to be oncurves for sure.
  5952. * forced = set()
  5953. * for i in range(1, len(elevated_quadratics)): # <<<<<<<<<<<<<<
  5954. * p0 = elevated_quadratics[i - 1][2]
  5955. * p1 = elevated_quadratics[i][0]
  5956. */
  5957. __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_v_elevated_quadratics); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
  5958. __pyx_t_1 = __pyx_t_4;
  5959. for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) {
  5960. __pyx_v_i = __pyx_t_5;
  5961. /* "fontTools/qu2cu/qu2cu.py":288
  5962. * forced = set()
  5963. * for i in range(1, len(elevated_quadratics)):
  5964. * p0 = elevated_quadratics[i - 1][2] # <<<<<<<<<<<<<<
  5965. * p1 = elevated_quadratics[i][0]
  5966. * p2 = elevated_quadratics[i][1]
  5967. */
  5968. __pyx_t_9 = (__pyx_v_i - 1);
  5969. __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elevated_quadratics, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
  5970. __Pyx_GOTREF(__pyx_t_3);
  5971. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
  5972. __Pyx_GOTREF(__pyx_t_7);
  5973. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5974. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L1_error)
  5975. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5976. __pyx_v_p0 = __pyx_t_10;
  5977. /* "fontTools/qu2cu/qu2cu.py":289
  5978. * for i in range(1, len(elevated_quadratics)):
  5979. * p0 = elevated_quadratics[i - 1][2]
  5980. * p1 = elevated_quadratics[i][0] # <<<<<<<<<<<<<<
  5981. * p2 = elevated_quadratics[i][1]
  5982. * if abs(p1 - p0) + abs(p2 - p1) > tolerance + abs(p2 - p0):
  5983. */
  5984. __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_elevated_quadratics, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
  5985. __Pyx_GOTREF(__pyx_t_7);
  5986. __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
  5987. __Pyx_GOTREF(__pyx_t_3);
  5988. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5989. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
  5990. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5991. __pyx_v_p1 = __pyx_t_10;
  5992. /* "fontTools/qu2cu/qu2cu.py":290
  5993. * p0 = elevated_quadratics[i - 1][2]
  5994. * p1 = elevated_quadratics[i][0]
  5995. * p2 = elevated_quadratics[i][1] # <<<<<<<<<<<<<<
  5996. * if abs(p1 - p0) + abs(p2 - p1) > tolerance + abs(p2 - p0):
  5997. * forced.add(i)
  5998. */
  5999. __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elevated_quadratics, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error)
  6000. __Pyx_GOTREF(__pyx_t_3);
  6001. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error)
  6002. __Pyx_GOTREF(__pyx_t_7);
  6003. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6004. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
  6005. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6006. __pyx_v_p2 = __pyx_t_10;
  6007. /* "fontTools/qu2cu/qu2cu.py":291
  6008. * p1 = elevated_quadratics[i][0]
  6009. * p2 = elevated_quadratics[i][1]
  6010. * if abs(p1 - p0) + abs(p2 - p1) > tolerance + abs(p2 - p0): # <<<<<<<<<<<<<<
  6011. * forced.add(i)
  6012. *
  6013. */
  6014. __pyx_t_2 = ((__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p1, __pyx_v_p0)) + __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p2, __pyx_v_p1))) > (__pyx_v_tolerance + __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p2, __pyx_v_p0))));
  6015. if (__pyx_t_2) {
  6016. /* "fontTools/qu2cu/qu2cu.py":292
  6017. * p2 = elevated_quadratics[i][1]
  6018. * if abs(p1 - p0) + abs(p2 - p1) > tolerance + abs(p2 - p0):
  6019. * forced.add(i) # <<<<<<<<<<<<<<
  6020. *
  6021. * # Dynamic-Programming to find the solution with fewest number of
  6022. */
  6023. __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 292, __pyx_L1_error)
  6024. __Pyx_GOTREF(__pyx_t_7);
  6025. __pyx_t_11 = PySet_Add(__pyx_v_forced, __pyx_t_7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 292, __pyx_L1_error)
  6026. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6027. /* "fontTools/qu2cu/qu2cu.py":291
  6028. * p1 = elevated_quadratics[i][0]
  6029. * p2 = elevated_quadratics[i][1]
  6030. * if abs(p1 - p0) + abs(p2 - p1) > tolerance + abs(p2 - p0): # <<<<<<<<<<<<<<
  6031. * forced.add(i)
  6032. *
  6033. */
  6034. }
  6035. }
  6036. /* "fontTools/qu2cu/qu2cu.py":296
  6037. * # Dynamic-Programming to find the solution with fewest number of
  6038. * # cubic curves, and within those the one with smallest error.
  6039. * sols = [Solution(0, 0, 0, False)] # <<<<<<<<<<<<<<
  6040. * impossible = Solution(len(elevated_quadratics) * 3 + 1, 0, 1, False)
  6041. * start = 0
  6042. */
  6043. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Solution); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error)
  6044. __Pyx_GOTREF(__pyx_t_7);
  6045. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
  6046. __Pyx_GOTREF(__pyx_t_3);
  6047. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6048. __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error)
  6049. __Pyx_GOTREF(__pyx_t_7);
  6050. __Pyx_GIVEREF(__pyx_t_3);
  6051. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error);
  6052. __pyx_t_3 = 0;
  6053. __pyx_v_sols = ((PyObject*)__pyx_t_7);
  6054. __pyx_t_7 = 0;
  6055. /* "fontTools/qu2cu/qu2cu.py":297
  6056. * # cubic curves, and within those the one with smallest error.
  6057. * sols = [Solution(0, 0, 0, False)]
  6058. * impossible = Solution(len(elevated_quadratics) * 3 + 1, 0, 1, False) # <<<<<<<<<<<<<<
  6059. * start = 0
  6060. * for i in range(1, len(elevated_quadratics) + 1):
  6061. */
  6062. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Solution); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
  6063. __Pyx_GOTREF(__pyx_t_3);
  6064. __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_v_elevated_quadratics); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 297, __pyx_L1_error)
  6065. __pyx_t_8 = PyInt_FromSsize_t(((__pyx_t_4 * 3) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error)
  6066. __Pyx_GOTREF(__pyx_t_8);
  6067. __pyx_t_6 = NULL;
  6068. __pyx_t_5 = 0;
  6069. #if CYTHON_UNPACK_METHODS
  6070. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  6071. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  6072. if (likely(__pyx_t_6)) {
  6073. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6074. __Pyx_INCREF(__pyx_t_6);
  6075. __Pyx_INCREF(function);
  6076. __Pyx_DECREF_SET(__pyx_t_3, function);
  6077. __pyx_t_5 = 1;
  6078. }
  6079. }
  6080. #endif
  6081. {
  6082. PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_t_8, __pyx_int_0, __pyx_int_1, Py_False};
  6083. __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 4+__pyx_t_5);
  6084. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  6085. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6086. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L1_error)
  6087. __Pyx_GOTREF(__pyx_t_7);
  6088. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6089. }
  6090. __pyx_v_impossible = __pyx_t_7;
  6091. __pyx_t_7 = 0;
  6092. /* "fontTools/qu2cu/qu2cu.py":298
  6093. * sols = [Solution(0, 0, 0, False)]
  6094. * impossible = Solution(len(elevated_quadratics) * 3 + 1, 0, 1, False)
  6095. * start = 0 # <<<<<<<<<<<<<<
  6096. * for i in range(1, len(elevated_quadratics) + 1):
  6097. * best_sol = impossible
  6098. */
  6099. __pyx_v_start = 0;
  6100. /* "fontTools/qu2cu/qu2cu.py":299
  6101. * impossible = Solution(len(elevated_quadratics) * 3 + 1, 0, 1, False)
  6102. * start = 0
  6103. * for i in range(1, len(elevated_quadratics) + 1): # <<<<<<<<<<<<<<
  6104. * best_sol = impossible
  6105. * for j in range(start, i):
  6106. */
  6107. __pyx_t_4 = __Pyx_PyList_GET_SIZE(__pyx_v_elevated_quadratics); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 299, __pyx_L1_error)
  6108. __pyx_t_1 = (__pyx_t_4 + 1);
  6109. __pyx_t_4 = __pyx_t_1;
  6110. for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  6111. __pyx_v_i = __pyx_t_5;
  6112. /* "fontTools/qu2cu/qu2cu.py":300
  6113. * start = 0
  6114. * for i in range(1, len(elevated_quadratics) + 1):
  6115. * best_sol = impossible # <<<<<<<<<<<<<<
  6116. * for j in range(start, i):
  6117. * j_sol_count, j_sol_error = sols[j].num_points, sols[j].error
  6118. */
  6119. __Pyx_INCREF(__pyx_v_impossible);
  6120. __Pyx_XDECREF_SET(__pyx_v_best_sol, __pyx_v_impossible);
  6121. /* "fontTools/qu2cu/qu2cu.py":301
  6122. * for i in range(1, len(elevated_quadratics) + 1):
  6123. * best_sol = impossible
  6124. * for j in range(start, i): # <<<<<<<<<<<<<<
  6125. * j_sol_count, j_sol_error = sols[j].num_points, sols[j].error
  6126. *
  6127. */
  6128. __pyx_t_12 = __pyx_v_i;
  6129. __pyx_t_13 = __pyx_t_12;
  6130. for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
  6131. __pyx_v_j = __pyx_t_14;
  6132. /* "fontTools/qu2cu/qu2cu.py":302
  6133. * best_sol = impossible
  6134. * for j in range(start, i):
  6135. * j_sol_count, j_sol_error = sols[j].num_points, sols[j].error # <<<<<<<<<<<<<<
  6136. *
  6137. * if not all_cubic:
  6138. */
  6139. __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_sols, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
  6140. __Pyx_GOTREF(__pyx_t_7);
  6141. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_num_points); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
  6142. __Pyx_GOTREF(__pyx_t_3);
  6143. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6144. __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
  6145. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6146. __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_sols, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
  6147. __Pyx_GOTREF(__pyx_t_3);
  6148. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
  6149. __Pyx_GOTREF(__pyx_t_7);
  6150. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6151. __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
  6152. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6153. __pyx_v_j_sol_count = __pyx_t_15;
  6154. __pyx_v_j_sol_error = __pyx_t_16;
  6155. /* "fontTools/qu2cu/qu2cu.py":304
  6156. * j_sol_count, j_sol_error = sols[j].num_points, sols[j].error
  6157. *
  6158. * if not all_cubic: # <<<<<<<<<<<<<<
  6159. * # Solution with quadratics between j:i
  6160. * this_count = costs[2 * i - 1] - costs[2 * j] + 1
  6161. */
  6162. __pyx_t_2 = (!(__pyx_v_all_cubic != 0));
  6163. if (__pyx_t_2) {
  6164. /* "fontTools/qu2cu/qu2cu.py":306
  6165. * if not all_cubic:
  6166. * # Solution with quadratics between j:i
  6167. * this_count = costs[2 * i - 1] - costs[2 * j] + 1 # <<<<<<<<<<<<<<
  6168. * i_sol_count = j_sol_count + this_count
  6169. * i_sol_error = j_sol_error
  6170. */
  6171. __pyx_t_9 = ((2 * __pyx_v_i) - 1);
  6172. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_costs, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 306, __pyx_L1_error)
  6173. __Pyx_GOTREF(__pyx_t_7);
  6174. __pyx_t_9 = (2 * __pyx_v_j);
  6175. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_costs, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
  6176. __Pyx_GOTREF(__pyx_t_3);
  6177. __pyx_t_8 = PyNumber_Subtract(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
  6178. __Pyx_GOTREF(__pyx_t_8);
  6179. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6180. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6181. __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
  6182. __Pyx_GOTREF(__pyx_t_3);
  6183. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6184. __Pyx_XDECREF_SET(__pyx_v_this_count, __pyx_t_3);
  6185. __pyx_t_3 = 0;
  6186. /* "fontTools/qu2cu/qu2cu.py":307
  6187. * # Solution with quadratics between j:i
  6188. * this_count = costs[2 * i - 1] - costs[2 * j] + 1
  6189. * i_sol_count = j_sol_count + this_count # <<<<<<<<<<<<<<
  6190. * i_sol_error = j_sol_error
  6191. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False)
  6192. */
  6193. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j_sol_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error)
  6194. __Pyx_GOTREF(__pyx_t_3);
  6195. __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_this_count); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 307, __pyx_L1_error)
  6196. __Pyx_GOTREF(__pyx_t_8);
  6197. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6198. __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L1_error)
  6199. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6200. __pyx_v_i_sol_count = __pyx_t_15;
  6201. /* "fontTools/qu2cu/qu2cu.py":308
  6202. * this_count = costs[2 * i - 1] - costs[2 * j] + 1
  6203. * i_sol_count = j_sol_count + this_count
  6204. * i_sol_error = j_sol_error # <<<<<<<<<<<<<<
  6205. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False)
  6206. * if i_sol < best_sol:
  6207. */
  6208. __pyx_v_i_sol_error = __pyx_v_j_sol_error;
  6209. /* "fontTools/qu2cu/qu2cu.py":309
  6210. * i_sol_count = j_sol_count + this_count
  6211. * i_sol_error = j_sol_error
  6212. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False) # <<<<<<<<<<<<<<
  6213. * if i_sol < best_sol:
  6214. * best_sol = i_sol
  6215. */
  6216. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Solution); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
  6217. __Pyx_GOTREF(__pyx_t_3);
  6218. __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i_sol_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 309, __pyx_L1_error)
  6219. __Pyx_GOTREF(__pyx_t_7);
  6220. __pyx_t_6 = PyFloat_FromDouble(__pyx_v_i_sol_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 309, __pyx_L1_error)
  6221. __Pyx_GOTREF(__pyx_t_6);
  6222. __pyx_t_17 = __Pyx_PyInt_From_int((__pyx_v_i - __pyx_v_j)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 309, __pyx_L1_error)
  6223. __Pyx_GOTREF(__pyx_t_17);
  6224. __pyx_t_18 = NULL;
  6225. __pyx_t_15 = 0;
  6226. #if CYTHON_UNPACK_METHODS
  6227. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  6228. __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3);
  6229. if (likely(__pyx_t_18)) {
  6230. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6231. __Pyx_INCREF(__pyx_t_18);
  6232. __Pyx_INCREF(function);
  6233. __Pyx_DECREF_SET(__pyx_t_3, function);
  6234. __pyx_t_15 = 1;
  6235. }
  6236. }
  6237. #endif
  6238. {
  6239. PyObject *__pyx_callargs[5] = {__pyx_t_18, __pyx_t_7, __pyx_t_6, __pyx_t_17, Py_False};
  6240. __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_15, 4+__pyx_t_15);
  6241. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  6242. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6243. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6244. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6245. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 309, __pyx_L1_error)
  6246. __Pyx_GOTREF(__pyx_t_8);
  6247. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6248. }
  6249. __Pyx_XDECREF_SET(__pyx_v_i_sol, __pyx_t_8);
  6250. __pyx_t_8 = 0;
  6251. /* "fontTools/qu2cu/qu2cu.py":310
  6252. * i_sol_error = j_sol_error
  6253. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False)
  6254. * if i_sol < best_sol: # <<<<<<<<<<<<<<
  6255. * best_sol = i_sol
  6256. *
  6257. */
  6258. __pyx_t_8 = PyObject_RichCompare(__pyx_v_i_sol, __pyx_v_best_sol, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 310, __pyx_L1_error)
  6259. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
  6260. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6261. if (__pyx_t_2) {
  6262. /* "fontTools/qu2cu/qu2cu.py":311
  6263. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False)
  6264. * if i_sol < best_sol:
  6265. * best_sol = i_sol # <<<<<<<<<<<<<<
  6266. *
  6267. * if this_count <= 3:
  6268. */
  6269. __Pyx_INCREF(__pyx_v_i_sol);
  6270. __Pyx_DECREF_SET(__pyx_v_best_sol, __pyx_v_i_sol);
  6271. /* "fontTools/qu2cu/qu2cu.py":310
  6272. * i_sol_error = j_sol_error
  6273. * i_sol = Solution(i_sol_count, i_sol_error, i - j, False)
  6274. * if i_sol < best_sol: # <<<<<<<<<<<<<<
  6275. * best_sol = i_sol
  6276. *
  6277. */
  6278. }
  6279. /* "fontTools/qu2cu/qu2cu.py":313
  6280. * best_sol = i_sol
  6281. *
  6282. * if this_count <= 3: # <<<<<<<<<<<<<<
  6283. * # Can't get any better than this in the path below
  6284. * continue
  6285. */
  6286. __pyx_t_8 = PyObject_RichCompare(__pyx_v_this_count, __pyx_int_3, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error)
  6287. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 313, __pyx_L1_error)
  6288. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6289. if (__pyx_t_2) {
  6290. /* "fontTools/qu2cu/qu2cu.py":315
  6291. * if this_count <= 3:
  6292. * # Can't get any better than this in the path below
  6293. * continue # <<<<<<<<<<<<<<
  6294. *
  6295. * # Fit elevated_quadratics[j:i] into one cubic
  6296. */
  6297. goto __pyx_L10_continue;
  6298. /* "fontTools/qu2cu/qu2cu.py":313
  6299. * best_sol = i_sol
  6300. *
  6301. * if this_count <= 3: # <<<<<<<<<<<<<<
  6302. * # Can't get any better than this in the path below
  6303. * continue
  6304. */
  6305. }
  6306. /* "fontTools/qu2cu/qu2cu.py":304
  6307. * j_sol_count, j_sol_error = sols[j].num_points, sols[j].error
  6308. *
  6309. * if not all_cubic: # <<<<<<<<<<<<<<
  6310. * # Solution with quadratics between j:i
  6311. * this_count = costs[2 * i - 1] - costs[2 * j] + 1
  6312. */
  6313. }
  6314. /* "fontTools/qu2cu/qu2cu.py":318
  6315. *
  6316. * # Fit elevated_quadratics[j:i] into one cubic
  6317. * try: # <<<<<<<<<<<<<<
  6318. * curve, ts = merge_curves(elevated_quadratics, j, i - j)
  6319. * except ZeroDivisionError:
  6320. */
  6321. {
  6322. __Pyx_PyThreadState_declare
  6323. __Pyx_PyThreadState_assign
  6324. __Pyx_ExceptionSave(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
  6325. __Pyx_XGOTREF(__pyx_t_19);
  6326. __Pyx_XGOTREF(__pyx_t_20);
  6327. __Pyx_XGOTREF(__pyx_t_21);
  6328. /*try:*/ {
  6329. /* "fontTools/qu2cu/qu2cu.py":319
  6330. * # Fit elevated_quadratics[j:i] into one cubic
  6331. * try:
  6332. * curve, ts = merge_curves(elevated_quadratics, j, i - j) # <<<<<<<<<<<<<<
  6333. * except ZeroDivisionError:
  6334. * continue
  6335. */
  6336. __pyx_t_8 = __pyx_f_9fontTools_5qu2cu_5qu2cu_merge_curves(__pyx_v_elevated_quadratics, __pyx_v_j, (__pyx_v_i - __pyx_v_j)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L15_error)
  6337. __Pyx_GOTREF(__pyx_t_8);
  6338. if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
  6339. PyObject* sequence = __pyx_t_8;
  6340. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6341. if (unlikely(size != 2)) {
  6342. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6343. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6344. __PYX_ERR(0, 319, __pyx_L15_error)
  6345. }
  6346. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6347. if (likely(PyTuple_CheckExact(sequence))) {
  6348. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6349. __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1);
  6350. } else {
  6351. __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
  6352. __pyx_t_17 = PyList_GET_ITEM(sequence, 1);
  6353. }
  6354. __Pyx_INCREF(__pyx_t_3);
  6355. __Pyx_INCREF(__pyx_t_17);
  6356. #else
  6357. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L15_error)
  6358. __Pyx_GOTREF(__pyx_t_3);
  6359. __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 319, __pyx_L15_error)
  6360. __Pyx_GOTREF(__pyx_t_17);
  6361. #endif
  6362. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6363. } else {
  6364. Py_ssize_t index = -1;
  6365. __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L15_error)
  6366. __Pyx_GOTREF(__pyx_t_6);
  6367. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6368. __pyx_t_22 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  6369. index = 0; __pyx_t_3 = __pyx_t_22(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L23_unpacking_failed;
  6370. __Pyx_GOTREF(__pyx_t_3);
  6371. index = 1; __pyx_t_17 = __pyx_t_22(__pyx_t_6); if (unlikely(!__pyx_t_17)) goto __pyx_L23_unpacking_failed;
  6372. __Pyx_GOTREF(__pyx_t_17);
  6373. if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_6), 2) < 0) __PYX_ERR(0, 319, __pyx_L15_error)
  6374. __pyx_t_22 = NULL;
  6375. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6376. goto __pyx_L24_unpacking_done;
  6377. __pyx_L23_unpacking_failed:;
  6378. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6379. __pyx_t_22 = NULL;
  6380. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6381. __PYX_ERR(0, 319, __pyx_L15_error)
  6382. __pyx_L24_unpacking_done:;
  6383. }
  6384. __Pyx_XDECREF_SET(__pyx_v_curve, __pyx_t_3);
  6385. __pyx_t_3 = 0;
  6386. __Pyx_XDECREF_SET(__pyx_v_ts, __pyx_t_17);
  6387. __pyx_t_17 = 0;
  6388. /* "fontTools/qu2cu/qu2cu.py":318
  6389. *
  6390. * # Fit elevated_quadratics[j:i] into one cubic
  6391. * try: # <<<<<<<<<<<<<<
  6392. * curve, ts = merge_curves(elevated_quadratics, j, i - j)
  6393. * except ZeroDivisionError:
  6394. */
  6395. }
  6396. __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  6397. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  6398. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  6399. goto __pyx_L22_try_end;
  6400. __pyx_L15_error:;
  6401. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  6402. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  6403. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6404. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  6405. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  6406. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  6407. /* "fontTools/qu2cu/qu2cu.py":320
  6408. * try:
  6409. * curve, ts = merge_curves(elevated_quadratics, j, i - j)
  6410. * except ZeroDivisionError: # <<<<<<<<<<<<<<
  6411. * continue
  6412. *
  6413. */
  6414. __pyx_t_15 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ZeroDivisionError);
  6415. if (__pyx_t_15) {
  6416. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.spline_to_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6417. if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_17, &__pyx_t_3) < 0) __PYX_ERR(0, 320, __pyx_L17_except_error)
  6418. __Pyx_XGOTREF(__pyx_t_8);
  6419. __Pyx_XGOTREF(__pyx_t_17);
  6420. __Pyx_XGOTREF(__pyx_t_3);
  6421. /* "fontTools/qu2cu/qu2cu.py":321
  6422. * curve, ts = merge_curves(elevated_quadratics, j, i - j)
  6423. * except ZeroDivisionError:
  6424. * continue # <<<<<<<<<<<<<<
  6425. *
  6426. * # Now reconstruct the segments from the fitted curve
  6427. */
  6428. goto __pyx_L25_except_continue;
  6429. __pyx_L25_except_continue:;
  6430. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6431. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6432. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6433. goto __pyx_L21_try_continue;
  6434. }
  6435. goto __pyx_L17_except_error;
  6436. /* "fontTools/qu2cu/qu2cu.py":318
  6437. *
  6438. * # Fit elevated_quadratics[j:i] into one cubic
  6439. * try: # <<<<<<<<<<<<<<
  6440. * curve, ts = merge_curves(elevated_quadratics, j, i - j)
  6441. * except ZeroDivisionError:
  6442. */
  6443. __pyx_L17_except_error:;
  6444. __Pyx_XGIVEREF(__pyx_t_19);
  6445. __Pyx_XGIVEREF(__pyx_t_20);
  6446. __Pyx_XGIVEREF(__pyx_t_21);
  6447. __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
  6448. goto __pyx_L1_error;
  6449. __pyx_L21_try_continue:;
  6450. __Pyx_XGIVEREF(__pyx_t_19);
  6451. __Pyx_XGIVEREF(__pyx_t_20);
  6452. __Pyx_XGIVEREF(__pyx_t_21);
  6453. __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
  6454. goto __pyx_L10_continue;
  6455. __pyx_L22_try_end:;
  6456. }
  6457. /* "fontTools/qu2cu/qu2cu.py":324
  6458. *
  6459. * # Now reconstruct the segments from the fitted curve
  6460. * reconstructed_iter = splitCubicAtTC(*curve, *ts) # <<<<<<<<<<<<<<
  6461. * reconstructed = []
  6462. *
  6463. */
  6464. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_splitCubicAtTC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
  6465. __Pyx_GOTREF(__pyx_t_3);
  6466. __pyx_t_17 = __Pyx_PySequence_Tuple(__pyx_v_curve); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 324, __pyx_L1_error)
  6467. __Pyx_GOTREF(__pyx_t_17);
  6468. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_ts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error)
  6469. __Pyx_GOTREF(__pyx_t_8);
  6470. __pyx_t_6 = PyNumber_Add(__pyx_t_17, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 324, __pyx_L1_error)
  6471. __Pyx_GOTREF(__pyx_t_6);
  6472. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6473. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6474. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error)
  6475. __Pyx_GOTREF(__pyx_t_8);
  6476. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6477. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6478. __Pyx_XDECREF_SET(__pyx_v_reconstructed_iter, __pyx_t_8);
  6479. __pyx_t_8 = 0;
  6480. /* "fontTools/qu2cu/qu2cu.py":325
  6481. * # Now reconstruct the segments from the fitted curve
  6482. * reconstructed_iter = splitCubicAtTC(*curve, *ts)
  6483. * reconstructed = [] # <<<<<<<<<<<<<<
  6484. *
  6485. * # Knot errors
  6486. */
  6487. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L1_error)
  6488. __Pyx_GOTREF(__pyx_t_8);
  6489. __Pyx_XDECREF_SET(__pyx_v_reconstructed, ((PyObject*)__pyx_t_8));
  6490. __pyx_t_8 = 0;
  6491. /* "fontTools/qu2cu/qu2cu.py":328
  6492. *
  6493. * # Knot errors
  6494. * error = 0 # <<<<<<<<<<<<<<
  6495. * for k, reconst in enumerate(reconstructed_iter):
  6496. * orig = elevated_quadratics[j + k]
  6497. */
  6498. __pyx_v_error = 0.0;
  6499. /* "fontTools/qu2cu/qu2cu.py":329
  6500. * # Knot errors
  6501. * error = 0
  6502. * for k, reconst in enumerate(reconstructed_iter): # <<<<<<<<<<<<<<
  6503. * orig = elevated_quadratics[j + k]
  6504. * err = abs(reconst[3] - orig[3])
  6505. */
  6506. __pyx_t_15 = 0;
  6507. if (likely(PyList_CheckExact(__pyx_v_reconstructed_iter)) || PyTuple_CheckExact(__pyx_v_reconstructed_iter)) {
  6508. __pyx_t_8 = __pyx_v_reconstructed_iter; __Pyx_INCREF(__pyx_t_8);
  6509. __pyx_t_23 = 0;
  6510. __pyx_t_24 = NULL;
  6511. } else {
  6512. __pyx_t_23 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_reconstructed_iter); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 329, __pyx_L1_error)
  6513. __Pyx_GOTREF(__pyx_t_8);
  6514. __pyx_t_24 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 329, __pyx_L1_error)
  6515. }
  6516. for (;;) {
  6517. if (likely(!__pyx_t_24)) {
  6518. if (likely(PyList_CheckExact(__pyx_t_8))) {
  6519. {
  6520. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
  6521. #if !CYTHON_ASSUME_SAFE_MACROS
  6522. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 329, __pyx_L1_error)
  6523. #endif
  6524. if (__pyx_t_23 >= __pyx_temp) break;
  6525. }
  6526. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6527. __pyx_t_6 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_23); __Pyx_INCREF(__pyx_t_6); __pyx_t_23++; if (unlikely((0 < 0))) __PYX_ERR(0, 329, __pyx_L1_error)
  6528. #else
  6529. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
  6530. __Pyx_GOTREF(__pyx_t_6);
  6531. #endif
  6532. } else {
  6533. {
  6534. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
  6535. #if !CYTHON_ASSUME_SAFE_MACROS
  6536. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 329, __pyx_L1_error)
  6537. #endif
  6538. if (__pyx_t_23 >= __pyx_temp) break;
  6539. }
  6540. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6541. __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_23); __Pyx_INCREF(__pyx_t_6); __pyx_t_23++; if (unlikely((0 < 0))) __PYX_ERR(0, 329, __pyx_L1_error)
  6542. #else
  6543. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
  6544. __Pyx_GOTREF(__pyx_t_6);
  6545. #endif
  6546. }
  6547. } else {
  6548. __pyx_t_6 = __pyx_t_24(__pyx_t_8);
  6549. if (unlikely(!__pyx_t_6)) {
  6550. PyObject* exc_type = PyErr_Occurred();
  6551. if (exc_type) {
  6552. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  6553. else __PYX_ERR(0, 329, __pyx_L1_error)
  6554. }
  6555. break;
  6556. }
  6557. __Pyx_GOTREF(__pyx_t_6);
  6558. }
  6559. __Pyx_XDECREF_SET(__pyx_v_reconst, __pyx_t_6);
  6560. __pyx_t_6 = 0;
  6561. __pyx_v_k = __pyx_t_15;
  6562. __pyx_t_15 = (__pyx_t_15 + 1);
  6563. /* "fontTools/qu2cu/qu2cu.py":330
  6564. * error = 0
  6565. * for k, reconst in enumerate(reconstructed_iter):
  6566. * orig = elevated_quadratics[j + k] # <<<<<<<<<<<<<<
  6567. * err = abs(reconst[3] - orig[3])
  6568. * error = max(error, err)
  6569. */
  6570. __pyx_t_25 = (__pyx_v_j + __pyx_v_k);
  6571. __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_elevated_quadratics, __pyx_t_25, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
  6572. __Pyx_GOTREF(__pyx_t_6);
  6573. __Pyx_XDECREF_SET(__pyx_v_orig, __pyx_t_6);
  6574. __pyx_t_6 = 0;
  6575. /* "fontTools/qu2cu/qu2cu.py":331
  6576. * for k, reconst in enumerate(reconstructed_iter):
  6577. * orig = elevated_quadratics[j + k]
  6578. * err = abs(reconst[3] - orig[3]) # <<<<<<<<<<<<<<
  6579. * error = max(error, err)
  6580. * if error > tolerance:
  6581. */
  6582. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_reconst, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 331, __pyx_L1_error)
  6583. __Pyx_GOTREF(__pyx_t_6);
  6584. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_orig, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
  6585. __Pyx_GOTREF(__pyx_t_3);
  6586. __pyx_t_17 = PyNumber_Subtract(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 331, __pyx_L1_error)
  6587. __Pyx_GOTREF(__pyx_t_17);
  6588. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6589. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6590. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
  6591. __Pyx_GOTREF(__pyx_t_3);
  6592. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6593. __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 331, __pyx_L1_error)
  6594. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6595. __pyx_v_err = __pyx_t_16;
  6596. /* "fontTools/qu2cu/qu2cu.py":332
  6597. * orig = elevated_quadratics[j + k]
  6598. * err = abs(reconst[3] - orig[3])
  6599. * error = max(error, err) # <<<<<<<<<<<<<<
  6600. * if error > tolerance:
  6601. * break
  6602. */
  6603. __pyx_t_16 = __pyx_v_err;
  6604. __pyx_t_26 = __pyx_v_error;
  6605. __pyx_t_2 = (__pyx_t_16 > __pyx_t_26);
  6606. if (__pyx_t_2) {
  6607. __pyx_t_27 = __pyx_t_16;
  6608. } else {
  6609. __pyx_t_27 = __pyx_t_26;
  6610. }
  6611. __pyx_v_error = __pyx_t_27;
  6612. /* "fontTools/qu2cu/qu2cu.py":333
  6613. * err = abs(reconst[3] - orig[3])
  6614. * error = max(error, err)
  6615. * if error > tolerance: # <<<<<<<<<<<<<<
  6616. * break
  6617. * reconstructed.append(reconst)
  6618. */
  6619. __pyx_t_2 = (__pyx_v_error > __pyx_v_tolerance);
  6620. if (__pyx_t_2) {
  6621. /* "fontTools/qu2cu/qu2cu.py":334
  6622. * error = max(error, err)
  6623. * if error > tolerance:
  6624. * break # <<<<<<<<<<<<<<
  6625. * reconstructed.append(reconst)
  6626. * if error > tolerance:
  6627. */
  6628. goto __pyx_L28_break;
  6629. /* "fontTools/qu2cu/qu2cu.py":333
  6630. * err = abs(reconst[3] - orig[3])
  6631. * error = max(error, err)
  6632. * if error > tolerance: # <<<<<<<<<<<<<<
  6633. * break
  6634. * reconstructed.append(reconst)
  6635. */
  6636. }
  6637. /* "fontTools/qu2cu/qu2cu.py":335
  6638. * if error > tolerance:
  6639. * break
  6640. * reconstructed.append(reconst) # <<<<<<<<<<<<<<
  6641. * if error > tolerance:
  6642. * # Not feasible
  6643. */
  6644. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_reconstructed, __pyx_v_reconst); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 335, __pyx_L1_error)
  6645. /* "fontTools/qu2cu/qu2cu.py":329
  6646. * # Knot errors
  6647. * error = 0
  6648. * for k, reconst in enumerate(reconstructed_iter): # <<<<<<<<<<<<<<
  6649. * orig = elevated_quadratics[j + k]
  6650. * err = abs(reconst[3] - orig[3])
  6651. */
  6652. }
  6653. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6654. goto __pyx_L30_for_end;
  6655. __pyx_L28_break:;
  6656. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6657. goto __pyx_L30_for_end;
  6658. __pyx_L30_for_end:;
  6659. /* "fontTools/qu2cu/qu2cu.py":336
  6660. * break
  6661. * reconstructed.append(reconst)
  6662. * if error > tolerance: # <<<<<<<<<<<<<<
  6663. * # Not feasible
  6664. * continue
  6665. */
  6666. __pyx_t_2 = (__pyx_v_error > __pyx_v_tolerance);
  6667. if (__pyx_t_2) {
  6668. /* "fontTools/qu2cu/qu2cu.py":338
  6669. * if error > tolerance:
  6670. * # Not feasible
  6671. * continue # <<<<<<<<<<<<<<
  6672. *
  6673. * # Interior errors
  6674. */
  6675. goto __pyx_L10_continue;
  6676. /* "fontTools/qu2cu/qu2cu.py":336
  6677. * break
  6678. * reconstructed.append(reconst)
  6679. * if error > tolerance: # <<<<<<<<<<<<<<
  6680. * # Not feasible
  6681. * continue
  6682. */
  6683. }
  6684. /* "fontTools/qu2cu/qu2cu.py":341
  6685. *
  6686. * # Interior errors
  6687. * for k, reconst in enumerate(reconstructed): # <<<<<<<<<<<<<<
  6688. * orig = elevated_quadratics[j + k]
  6689. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig))
  6690. */
  6691. __pyx_t_15 = 0;
  6692. __pyx_t_8 = __pyx_v_reconstructed; __Pyx_INCREF(__pyx_t_8);
  6693. __pyx_t_23 = 0;
  6694. for (;;) {
  6695. {
  6696. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
  6697. #if !CYTHON_ASSUME_SAFE_MACROS
  6698. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 341, __pyx_L1_error)
  6699. #endif
  6700. if (__pyx_t_23 >= __pyx_temp) break;
  6701. }
  6702. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6703. __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely((0 < 0))) __PYX_ERR(0, 341, __pyx_L1_error)
  6704. #else
  6705. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
  6706. __Pyx_GOTREF(__pyx_t_3);
  6707. #endif
  6708. __Pyx_XDECREF_SET(__pyx_v_reconst, __pyx_t_3);
  6709. __pyx_t_3 = 0;
  6710. __pyx_v_k = __pyx_t_15;
  6711. __pyx_t_15 = (__pyx_t_15 + 1);
  6712. /* "fontTools/qu2cu/qu2cu.py":342
  6713. * # Interior errors
  6714. * for k, reconst in enumerate(reconstructed):
  6715. * orig = elevated_quadratics[j + k] # <<<<<<<<<<<<<<
  6716. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig))
  6717. *
  6718. */
  6719. __pyx_t_25 = (__pyx_v_j + __pyx_v_k);
  6720. __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elevated_quadratics, __pyx_t_25, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
  6721. __Pyx_GOTREF(__pyx_t_3);
  6722. __Pyx_XDECREF_SET(__pyx_v_orig, __pyx_t_3);
  6723. __pyx_t_3 = 0;
  6724. /* "fontTools/qu2cu/qu2cu.py":343
  6725. * for k, reconst in enumerate(reconstructed):
  6726. * orig = elevated_quadratics[j + k]
  6727. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig)) # <<<<<<<<<<<<<<
  6728. *
  6729. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance):
  6730. */
  6731. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
  6732. __Pyx_GOTREF(__pyx_t_3);
  6733. __Pyx_INCREF(__pyx_v_reconst);
  6734. __Pyx_GIVEREF(__pyx_v_reconst);
  6735. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_reconst)) __PYX_ERR(0, 343, __pyx_L1_error);
  6736. __Pyx_INCREF(__pyx_v_orig);
  6737. __Pyx_GIVEREF(__pyx_v_orig);
  6738. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_orig)) __PYX_ERR(0, 343, __pyx_L1_error);
  6739. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 343, __pyx_L1_error)
  6740. __Pyx_GOTREF(__pyx_t_17);
  6741. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6742. __pyx_t_3 = __pyx_pf_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_genexpr(NULL, __pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
  6743. __Pyx_GOTREF(__pyx_t_3);
  6744. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6745. __pyx_t_17 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 343, __pyx_L1_error)
  6746. __Pyx_GOTREF(__pyx_t_17);
  6747. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6748. if (1) {
  6749. PyObject* sequence = __pyx_t_17;
  6750. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6751. if (unlikely(size != 4)) {
  6752. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  6753. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6754. __PYX_ERR(0, 343, __pyx_L1_error)
  6755. }
  6756. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6757. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6758. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  6759. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
  6760. __pyx_t_18 = PyTuple_GET_ITEM(sequence, 3);
  6761. __Pyx_INCREF(__pyx_t_3);
  6762. __Pyx_INCREF(__pyx_t_6);
  6763. __Pyx_INCREF(__pyx_t_7);
  6764. __Pyx_INCREF(__pyx_t_18);
  6765. #else
  6766. {
  6767. Py_ssize_t i;
  6768. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_6,&__pyx_t_7,&__pyx_t_18};
  6769. for (i=0; i < 4; i++) {
  6770. PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 343, __pyx_L1_error)
  6771. __Pyx_GOTREF(item);
  6772. *(temps[i]) = item;
  6773. }
  6774. }
  6775. #endif
  6776. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6777. }
  6778. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  6779. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6780. __pyx_t_28 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  6781. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6782. __pyx_t_29 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  6783. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6784. __pyx_t_30 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_18); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error)
  6785. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  6786. __pyx_v_p0 = __pyx_t_10;
  6787. __pyx_v_p1 = __pyx_t_28;
  6788. __pyx_v_p2 = __pyx_t_29;
  6789. __pyx_v_p3 = __pyx_t_30;
  6790. /* "fontTools/qu2cu/qu2cu.py":345
  6791. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig))
  6792. *
  6793. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance): # <<<<<<<<<<<<<<
  6794. * error = tolerance + 1
  6795. * break
  6796. */
  6797. __pyx_t_25 = __pyx_f_9fontTools_5qu2cu_5qu2cu_cubic_farthest_fit_inside(__pyx_v_p0, __pyx_v_p1, __pyx_v_p2, __pyx_v_p3, __pyx_v_tolerance); if (unlikely(__pyx_t_25 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L1_error)
  6798. __pyx_t_2 = (!(__pyx_t_25 != 0));
  6799. if (__pyx_t_2) {
  6800. /* "fontTools/qu2cu/qu2cu.py":346
  6801. *
  6802. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance):
  6803. * error = tolerance + 1 # <<<<<<<<<<<<<<
  6804. * break
  6805. * if error > tolerance:
  6806. */
  6807. __pyx_v_error = (__pyx_v_tolerance + 1.0);
  6808. /* "fontTools/qu2cu/qu2cu.py":347
  6809. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance):
  6810. * error = tolerance + 1
  6811. * break # <<<<<<<<<<<<<<
  6812. * if error > tolerance:
  6813. * # Not feasible
  6814. */
  6815. goto __pyx_L33_break;
  6816. /* "fontTools/qu2cu/qu2cu.py":345
  6817. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig))
  6818. *
  6819. * if not cubic_farthest_fit_inside(p0, p1, p2, p3, tolerance): # <<<<<<<<<<<<<<
  6820. * error = tolerance + 1
  6821. * break
  6822. */
  6823. }
  6824. /* "fontTools/qu2cu/qu2cu.py":341
  6825. *
  6826. * # Interior errors
  6827. * for k, reconst in enumerate(reconstructed): # <<<<<<<<<<<<<<
  6828. * orig = elevated_quadratics[j + k]
  6829. * p0, p1, p2, p3 = tuple(v - u for v, u in zip(reconst, orig))
  6830. */
  6831. }
  6832. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6833. goto __pyx_L35_for_end;
  6834. __pyx_L33_break:;
  6835. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6836. goto __pyx_L35_for_end;
  6837. __pyx_L35_for_end:;
  6838. /* "fontTools/qu2cu/qu2cu.py":348
  6839. * error = tolerance + 1
  6840. * break
  6841. * if error > tolerance: # <<<<<<<<<<<<<<
  6842. * # Not feasible
  6843. * continue
  6844. */
  6845. __pyx_t_2 = (__pyx_v_error > __pyx_v_tolerance);
  6846. if (__pyx_t_2) {
  6847. /* "fontTools/qu2cu/qu2cu.py":350
  6848. * if error > tolerance:
  6849. * # Not feasible
  6850. * continue # <<<<<<<<<<<<<<
  6851. *
  6852. * # Save best solution
  6853. */
  6854. goto __pyx_L10_continue;
  6855. /* "fontTools/qu2cu/qu2cu.py":348
  6856. * error = tolerance + 1
  6857. * break
  6858. * if error > tolerance: # <<<<<<<<<<<<<<
  6859. * # Not feasible
  6860. * continue
  6861. */
  6862. }
  6863. /* "fontTools/qu2cu/qu2cu.py":353
  6864. *
  6865. * # Save best solution
  6866. * i_sol_count = j_sol_count + 3 # <<<<<<<<<<<<<<
  6867. * i_sol_error = max(j_sol_error, error)
  6868. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True)
  6869. */
  6870. __pyx_v_i_sol_count = (__pyx_v_j_sol_count + 3);
  6871. /* "fontTools/qu2cu/qu2cu.py":354
  6872. * # Save best solution
  6873. * i_sol_count = j_sol_count + 3
  6874. * i_sol_error = max(j_sol_error, error) # <<<<<<<<<<<<<<
  6875. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True)
  6876. * if i_sol < best_sol:
  6877. */
  6878. __pyx_t_27 = __pyx_v_error;
  6879. __pyx_t_16 = __pyx_v_j_sol_error;
  6880. __pyx_t_2 = (__pyx_t_27 > __pyx_t_16);
  6881. if (__pyx_t_2) {
  6882. __pyx_t_26 = __pyx_t_27;
  6883. } else {
  6884. __pyx_t_26 = __pyx_t_16;
  6885. }
  6886. __pyx_v_i_sol_error = __pyx_t_26;
  6887. /* "fontTools/qu2cu/qu2cu.py":355
  6888. * i_sol_count = j_sol_count + 3
  6889. * i_sol_error = max(j_sol_error, error)
  6890. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True) # <<<<<<<<<<<<<<
  6891. * if i_sol < best_sol:
  6892. * best_sol = i_sol
  6893. */
  6894. __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_Solution); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 355, __pyx_L1_error)
  6895. __Pyx_GOTREF(__pyx_t_17);
  6896. __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_i_sol_count); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 355, __pyx_L1_error)
  6897. __Pyx_GOTREF(__pyx_t_18);
  6898. __pyx_t_7 = PyFloat_FromDouble(__pyx_v_i_sol_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 355, __pyx_L1_error)
  6899. __Pyx_GOTREF(__pyx_t_7);
  6900. __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_i - __pyx_v_j)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L1_error)
  6901. __Pyx_GOTREF(__pyx_t_6);
  6902. __pyx_t_3 = NULL;
  6903. __pyx_t_15 = 0;
  6904. #if CYTHON_UNPACK_METHODS
  6905. if (unlikely(PyMethod_Check(__pyx_t_17))) {
  6906. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_17);
  6907. if (likely(__pyx_t_3)) {
  6908. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
  6909. __Pyx_INCREF(__pyx_t_3);
  6910. __Pyx_INCREF(function);
  6911. __Pyx_DECREF_SET(__pyx_t_17, function);
  6912. __pyx_t_15 = 1;
  6913. }
  6914. }
  6915. #endif
  6916. {
  6917. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_t_18, __pyx_t_7, __pyx_t_6, Py_True};
  6918. __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_15, 4+__pyx_t_15);
  6919. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6920. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  6921. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6922. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6923. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error)
  6924. __Pyx_GOTREF(__pyx_t_8);
  6925. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  6926. }
  6927. __Pyx_XDECREF_SET(__pyx_v_i_sol, __pyx_t_8);
  6928. __pyx_t_8 = 0;
  6929. /* "fontTools/qu2cu/qu2cu.py":356
  6930. * i_sol_error = max(j_sol_error, error)
  6931. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True)
  6932. * if i_sol < best_sol: # <<<<<<<<<<<<<<
  6933. * best_sol = i_sol
  6934. *
  6935. */
  6936. __pyx_t_8 = PyObject_RichCompare(__pyx_v_i_sol, __pyx_v_best_sol, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error)
  6937. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 356, __pyx_L1_error)
  6938. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6939. if (__pyx_t_2) {
  6940. /* "fontTools/qu2cu/qu2cu.py":357
  6941. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True)
  6942. * if i_sol < best_sol:
  6943. * best_sol = i_sol # <<<<<<<<<<<<<<
  6944. *
  6945. * if i_sol_count == 3:
  6946. */
  6947. __Pyx_INCREF(__pyx_v_i_sol);
  6948. __Pyx_DECREF_SET(__pyx_v_best_sol, __pyx_v_i_sol);
  6949. /* "fontTools/qu2cu/qu2cu.py":356
  6950. * i_sol_error = max(j_sol_error, error)
  6951. * i_sol = Solution(i_sol_count, i_sol_error, i - j, True)
  6952. * if i_sol < best_sol: # <<<<<<<<<<<<<<
  6953. * best_sol = i_sol
  6954. *
  6955. */
  6956. }
  6957. /* "fontTools/qu2cu/qu2cu.py":359
  6958. * best_sol = i_sol
  6959. *
  6960. * if i_sol_count == 3: # <<<<<<<<<<<<<<
  6961. * # Can't get any better than this
  6962. * break
  6963. */
  6964. __pyx_t_2 = (__pyx_v_i_sol_count == 3);
  6965. if (__pyx_t_2) {
  6966. /* "fontTools/qu2cu/qu2cu.py":361
  6967. * if i_sol_count == 3:
  6968. * # Can't get any better than this
  6969. * break # <<<<<<<<<<<<<<
  6970. *
  6971. * sols.append(best_sol)
  6972. */
  6973. goto __pyx_L11_break;
  6974. /* "fontTools/qu2cu/qu2cu.py":359
  6975. * best_sol = i_sol
  6976. *
  6977. * if i_sol_count == 3: # <<<<<<<<<<<<<<
  6978. * # Can't get any better than this
  6979. * break
  6980. */
  6981. }
  6982. __pyx_L10_continue:;
  6983. }
  6984. __pyx_L11_break:;
  6985. /* "fontTools/qu2cu/qu2cu.py":363
  6986. * break
  6987. *
  6988. * sols.append(best_sol) # <<<<<<<<<<<<<<
  6989. * if i in forced:
  6990. * start = i
  6991. */
  6992. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_sols, __pyx_v_best_sol); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 363, __pyx_L1_error)
  6993. /* "fontTools/qu2cu/qu2cu.py":364
  6994. *
  6995. * sols.append(best_sol)
  6996. * if i in forced: # <<<<<<<<<<<<<<
  6997. * start = i
  6998. *
  6999. */
  7000. __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L1_error)
  7001. __Pyx_GOTREF(__pyx_t_8);
  7002. __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_8, __pyx_v_forced, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 364, __pyx_L1_error)
  7003. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7004. if (__pyx_t_2) {
  7005. /* "fontTools/qu2cu/qu2cu.py":365
  7006. * sols.append(best_sol)
  7007. * if i in forced:
  7008. * start = i # <<<<<<<<<<<<<<
  7009. *
  7010. * # Reconstruct solution
  7011. */
  7012. __pyx_v_start = __pyx_v_i;
  7013. /* "fontTools/qu2cu/qu2cu.py":364
  7014. *
  7015. * sols.append(best_sol)
  7016. * if i in forced: # <<<<<<<<<<<<<<
  7017. * start = i
  7018. *
  7019. */
  7020. }
  7021. }
  7022. /* "fontTools/qu2cu/qu2cu.py":368
  7023. *
  7024. * # Reconstruct solution
  7025. * splits = [] # <<<<<<<<<<<<<<
  7026. * cubic = []
  7027. * i = len(sols) - 1
  7028. */
  7029. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 368, __pyx_L1_error)
  7030. __Pyx_GOTREF(__pyx_t_8);
  7031. __pyx_v_splits = ((PyObject*)__pyx_t_8);
  7032. __pyx_t_8 = 0;
  7033. /* "fontTools/qu2cu/qu2cu.py":369
  7034. * # Reconstruct solution
  7035. * splits = []
  7036. * cubic = [] # <<<<<<<<<<<<<<
  7037. * i = len(sols) - 1
  7038. * while i:
  7039. */
  7040. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 369, __pyx_L1_error)
  7041. __Pyx_GOTREF(__pyx_t_8);
  7042. __pyx_v_cubic = ((PyObject*)__pyx_t_8);
  7043. __pyx_t_8 = 0;
  7044. /* "fontTools/qu2cu/qu2cu.py":370
  7045. * splits = []
  7046. * cubic = []
  7047. * i = len(sols) - 1 # <<<<<<<<<<<<<<
  7048. * while i:
  7049. * count, is_cubic = sols[i].start_index, sols[i].is_cubic
  7050. */
  7051. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_sols); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 370, __pyx_L1_error)
  7052. __pyx_v_i = (__pyx_t_1 - 1);
  7053. /* "fontTools/qu2cu/qu2cu.py":371
  7054. * cubic = []
  7055. * i = len(sols) - 1
  7056. * while i: # <<<<<<<<<<<<<<
  7057. * count, is_cubic = sols[i].start_index, sols[i].is_cubic
  7058. * splits.append(i)
  7059. */
  7060. while (1) {
  7061. __pyx_t_2 = (__pyx_v_i != 0);
  7062. if (!__pyx_t_2) break;
  7063. /* "fontTools/qu2cu/qu2cu.py":372
  7064. * i = len(sols) - 1
  7065. * while i:
  7066. * count, is_cubic = sols[i].start_index, sols[i].is_cubic # <<<<<<<<<<<<<<
  7067. * splits.append(i)
  7068. * cubic.append(is_cubic)
  7069. */
  7070. __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_sols, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 372, __pyx_L1_error)
  7071. __Pyx_GOTREF(__pyx_t_8);
  7072. __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_start_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 372, __pyx_L1_error)
  7073. __Pyx_GOTREF(__pyx_t_17);
  7074. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7075. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_17); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L1_error)
  7076. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  7077. __pyx_t_17 = __Pyx_GetItemInt_List(__pyx_v_sols, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 372, __pyx_L1_error)
  7078. __Pyx_GOTREF(__pyx_t_17);
  7079. __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_is_cubic); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 372, __pyx_L1_error)
  7080. __Pyx_GOTREF(__pyx_t_8);
  7081. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  7082. __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L1_error)
  7083. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7084. __pyx_v_count = __pyx_t_5;
  7085. __pyx_v_is_cubic = __pyx_t_12;
  7086. /* "fontTools/qu2cu/qu2cu.py":373
  7087. * while i:
  7088. * count, is_cubic = sols[i].start_index, sols[i].is_cubic
  7089. * splits.append(i) # <<<<<<<<<<<<<<
  7090. * cubic.append(is_cubic)
  7091. * i -= count
  7092. */
  7093. __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error)
  7094. __Pyx_GOTREF(__pyx_t_8);
  7095. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_splits, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 373, __pyx_L1_error)
  7096. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7097. /* "fontTools/qu2cu/qu2cu.py":374
  7098. * count, is_cubic = sols[i].start_index, sols[i].is_cubic
  7099. * splits.append(i)
  7100. * cubic.append(is_cubic) # <<<<<<<<<<<<<<
  7101. * i -= count
  7102. * curves = []
  7103. */
  7104. __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_cubic); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 374, __pyx_L1_error)
  7105. __Pyx_GOTREF(__pyx_t_8);
  7106. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_cubic, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 374, __pyx_L1_error)
  7107. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7108. /* "fontTools/qu2cu/qu2cu.py":375
  7109. * splits.append(i)
  7110. * cubic.append(is_cubic)
  7111. * i -= count # <<<<<<<<<<<<<<
  7112. * curves = []
  7113. * j = 0
  7114. */
  7115. __pyx_v_i = (__pyx_v_i - __pyx_v_count);
  7116. }
  7117. /* "fontTools/qu2cu/qu2cu.py":376
  7118. * cubic.append(is_cubic)
  7119. * i -= count
  7120. * curves = [] # <<<<<<<<<<<<<<
  7121. * j = 0
  7122. * for i, is_cubic in reversed(list(zip(splits, cubic))):
  7123. */
  7124. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 376, __pyx_L1_error)
  7125. __Pyx_GOTREF(__pyx_t_8);
  7126. __pyx_v_curves = ((PyObject*)__pyx_t_8);
  7127. __pyx_t_8 = 0;
  7128. /* "fontTools/qu2cu/qu2cu.py":377
  7129. * i -= count
  7130. * curves = []
  7131. * j = 0 # <<<<<<<<<<<<<<
  7132. * for i, is_cubic in reversed(list(zip(splits, cubic))):
  7133. * if is_cubic:
  7134. */
  7135. __pyx_v_j = 0;
  7136. /* "fontTools/qu2cu/qu2cu.py":378
  7137. * curves = []
  7138. * j = 0
  7139. * for i, is_cubic in reversed(list(zip(splits, cubic))): # <<<<<<<<<<<<<<
  7140. * if is_cubic:
  7141. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0])
  7142. */
  7143. __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error)
  7144. __Pyx_GOTREF(__pyx_t_8);
  7145. __Pyx_INCREF(__pyx_v_splits);
  7146. __Pyx_GIVEREF(__pyx_v_splits);
  7147. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_splits)) __PYX_ERR(0, 378, __pyx_L1_error);
  7148. __Pyx_INCREF(__pyx_v_cubic);
  7149. __Pyx_GIVEREF(__pyx_v_cubic);
  7150. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_cubic)) __PYX_ERR(0, 378, __pyx_L1_error);
  7151. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_8, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 378, __pyx_L1_error)
  7152. __Pyx_GOTREF(__pyx_t_17);
  7153. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7154. __pyx_t_8 = __Pyx_PySequence_ListKeepNew(__pyx_t_17); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error)
  7155. __Pyx_GOTREF(__pyx_t_8);
  7156. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  7157. __pyx_t_17 = __pyx_t_8; __Pyx_INCREF(__pyx_t_17);
  7158. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_t_17);
  7159. #if !CYTHON_ASSUME_SAFE_MACROS
  7160. if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7161. #endif
  7162. --__pyx_t_1;
  7163. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7164. for (;;) {
  7165. if (__pyx_t_1 < 0) break;
  7166. {
  7167. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_17);
  7168. #if !CYTHON_ASSUME_SAFE_MACROS
  7169. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7170. #endif
  7171. if (__pyx_t_1 >= __pyx_temp) break;
  7172. }
  7173. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7174. __pyx_t_8 = PyList_GET_ITEM(__pyx_t_17, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1--; if (unlikely((0 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7175. #else
  7176. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_17, __pyx_t_1); __pyx_t_1--; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error)
  7177. __Pyx_GOTREF(__pyx_t_8);
  7178. #endif
  7179. if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
  7180. PyObject* sequence = __pyx_t_8;
  7181. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7182. if (unlikely(size != 2)) {
  7183. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7184. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7185. __PYX_ERR(0, 378, __pyx_L1_error)
  7186. }
  7187. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7188. if (likely(PyTuple_CheckExact(sequence))) {
  7189. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
  7190. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  7191. } else {
  7192. __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
  7193. __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
  7194. }
  7195. __Pyx_INCREF(__pyx_t_6);
  7196. __Pyx_INCREF(__pyx_t_7);
  7197. #else
  7198. __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error)
  7199. __Pyx_GOTREF(__pyx_t_6);
  7200. __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L1_error)
  7201. __Pyx_GOTREF(__pyx_t_7);
  7202. #endif
  7203. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7204. } else {
  7205. Py_ssize_t index = -1;
  7206. __pyx_t_18 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 378, __pyx_L1_error)
  7207. __Pyx_GOTREF(__pyx_t_18);
  7208. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7209. __pyx_t_22 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_18);
  7210. index = 0; __pyx_t_6 = __pyx_t_22(__pyx_t_18); if (unlikely(!__pyx_t_6)) goto __pyx_L44_unpacking_failed;
  7211. __Pyx_GOTREF(__pyx_t_6);
  7212. index = 1; __pyx_t_7 = __pyx_t_22(__pyx_t_18); if (unlikely(!__pyx_t_7)) goto __pyx_L44_unpacking_failed;
  7213. __Pyx_GOTREF(__pyx_t_7);
  7214. if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_18), 2) < 0) __PYX_ERR(0, 378, __pyx_L1_error)
  7215. __pyx_t_22 = NULL;
  7216. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  7217. goto __pyx_L45_unpacking_done;
  7218. __pyx_L44_unpacking_failed:;
  7219. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  7220. __pyx_t_22 = NULL;
  7221. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7222. __PYX_ERR(0, 378, __pyx_L1_error)
  7223. __pyx_L45_unpacking_done:;
  7224. }
  7225. __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error)
  7226. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7227. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error)
  7228. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7229. __pyx_v_i = __pyx_t_12;
  7230. __pyx_v_is_cubic = __pyx_t_5;
  7231. /* "fontTools/qu2cu/qu2cu.py":379
  7232. * j = 0
  7233. * for i, is_cubic in reversed(list(zip(splits, cubic))):
  7234. * if is_cubic: # <<<<<<<<<<<<<<
  7235. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0])
  7236. * else:
  7237. */
  7238. __pyx_t_2 = (__pyx_v_is_cubic != 0);
  7239. if (__pyx_t_2) {
  7240. /* "fontTools/qu2cu/qu2cu.py":380
  7241. * for i, is_cubic in reversed(list(zip(splits, cubic))):
  7242. * if is_cubic:
  7243. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0]) # <<<<<<<<<<<<<<
  7244. * else:
  7245. * for k in range(j, i):
  7246. */
  7247. __pyx_t_8 = __pyx_f_9fontTools_5qu2cu_5qu2cu_merge_curves(__pyx_v_elevated_quadratics, __pyx_v_j, (__pyx_v_i - __pyx_v_j)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 380, __pyx_L1_error)
  7248. __Pyx_GOTREF(__pyx_t_8);
  7249. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error)
  7250. __Pyx_GOTREF(__pyx_t_7);
  7251. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7252. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_curves, __pyx_t_7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 380, __pyx_L1_error)
  7253. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7254. /* "fontTools/qu2cu/qu2cu.py":379
  7255. * j = 0
  7256. * for i, is_cubic in reversed(list(zip(splits, cubic))):
  7257. * if is_cubic: # <<<<<<<<<<<<<<
  7258. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0])
  7259. * else:
  7260. */
  7261. goto __pyx_L46;
  7262. }
  7263. /* "fontTools/qu2cu/qu2cu.py":382
  7264. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0])
  7265. * else:
  7266. * for k in range(j, i): # <<<<<<<<<<<<<<
  7267. * curves.append(q[k * 2 : k * 2 + 3])
  7268. * j = i
  7269. */
  7270. /*else*/ {
  7271. __pyx_t_5 = __pyx_v_i;
  7272. __pyx_t_12 = __pyx_t_5;
  7273. for (__pyx_t_13 = __pyx_v_j; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
  7274. __pyx_v_k = __pyx_t_13;
  7275. /* "fontTools/qu2cu/qu2cu.py":383
  7276. * else:
  7277. * for k in range(j, i):
  7278. * curves.append(q[k * 2 : k * 2 + 3]) # <<<<<<<<<<<<<<
  7279. * j = i
  7280. *
  7281. */
  7282. __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_q, (__pyx_v_k * 2), ((__pyx_v_k * 2) + 3), NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 383, __pyx_L1_error)
  7283. __Pyx_GOTREF(__pyx_t_7);
  7284. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_curves, __pyx_t_7); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 383, __pyx_L1_error)
  7285. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7286. }
  7287. }
  7288. __pyx_L46:;
  7289. /* "fontTools/qu2cu/qu2cu.py":384
  7290. * for k in range(j, i):
  7291. * curves.append(q[k * 2 : k * 2 + 3])
  7292. * j = i # <<<<<<<<<<<<<<
  7293. *
  7294. * return curves
  7295. */
  7296. __pyx_v_j = __pyx_v_i;
  7297. /* "fontTools/qu2cu/qu2cu.py":378
  7298. * curves = []
  7299. * j = 0
  7300. * for i, is_cubic in reversed(list(zip(splits, cubic))): # <<<<<<<<<<<<<<
  7301. * if is_cubic:
  7302. * curves.append(merge_curves(elevated_quadratics, j, i - j)[0])
  7303. */
  7304. }
  7305. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  7306. /* "fontTools/qu2cu/qu2cu.py":386
  7307. * j = i
  7308. *
  7309. * return curves # <<<<<<<<<<<<<<
  7310. *
  7311. *
  7312. */
  7313. __Pyx_XDECREF(__pyx_r);
  7314. __Pyx_INCREF(__pyx_v_curves);
  7315. __pyx_r = __pyx_v_curves;
  7316. goto __pyx_L0;
  7317. /* "fontTools/qu2cu/qu2cu.py":245
  7318. *
  7319. *
  7320. * @cython.locals( # <<<<<<<<<<<<<<
  7321. * i=cython.int,
  7322. * j=cython.int,
  7323. */
  7324. /* function exit code */
  7325. __pyx_L1_error:;
  7326. __Pyx_XDECREF(__pyx_t_3);
  7327. __Pyx_XDECREF(__pyx_t_6);
  7328. __Pyx_XDECREF(__pyx_t_7);
  7329. __Pyx_XDECREF(__pyx_t_8);
  7330. __Pyx_XDECREF(__pyx_t_17);
  7331. __Pyx_XDECREF(__pyx_t_18);
  7332. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.spline_to_curves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7333. __pyx_r = NULL;
  7334. __pyx_L0:;
  7335. __Pyx_XDECREF(__pyx_v_elevated_quadratics);
  7336. __Pyx_XDECREF(__pyx_v_forced);
  7337. __Pyx_XDECREF(__pyx_v_sols);
  7338. __Pyx_XDECREF(__pyx_v_impossible);
  7339. __Pyx_XDECREF(__pyx_v_best_sol);
  7340. __Pyx_XDECREF(__pyx_v_this_count);
  7341. __Pyx_XDECREF(__pyx_v_i_sol);
  7342. __Pyx_XDECREF(__pyx_v_curve);
  7343. __Pyx_XDECREF(__pyx_v_ts);
  7344. __Pyx_XDECREF(__pyx_v_reconstructed_iter);
  7345. __Pyx_XDECREF(__pyx_v_reconstructed);
  7346. __Pyx_XDECREF(__pyx_v_reconst);
  7347. __Pyx_XDECREF(__pyx_v_orig);
  7348. __Pyx_XDECREF(__pyx_v_splits);
  7349. __Pyx_XDECREF(__pyx_v_cubic);
  7350. __Pyx_XDECREF(__pyx_v_curves);
  7351. __Pyx_XDECREF(__pyx_gb_9fontTools_5qu2cu_5qu2cu_16spline_to_curves_2generator1);
  7352. __Pyx_XGIVEREF(__pyx_r);
  7353. __Pyx_RefNannyFinishContext();
  7354. return __pyx_r;
  7355. }
  7356. /* "fontTools/qu2cu/qu2cu.py":389
  7357. *
  7358. *
  7359. * def main(): # <<<<<<<<<<<<<<
  7360. * from fontTools.cu2qu.benchmark import generate_curve
  7361. * from fontTools.cu2qu import curve_to_quadratic
  7362. */
  7363. /* Python wrapper */
  7364. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_9main(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  7365. PyDoc_STRVAR(__pyx_doc_9fontTools_5qu2cu_5qu2cu_8main, "main()");
  7366. static PyMethodDef __pyx_mdef_9fontTools_5qu2cu_5qu2cu_9main = {"main", (PyCFunction)__pyx_pw_9fontTools_5qu2cu_5qu2cu_9main, METH_NOARGS, __pyx_doc_9fontTools_5qu2cu_5qu2cu_8main};
  7367. static PyObject *__pyx_pw_9fontTools_5qu2cu_5qu2cu_9main(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  7368. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7369. PyObject *__pyx_r = 0;
  7370. __Pyx_RefNannyDeclarations
  7371. __Pyx_RefNannySetupContext("main (wrapper)", 0);
  7372. __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  7373. __pyx_r = __pyx_pf_9fontTools_5qu2cu_5qu2cu_8main(__pyx_self);
  7374. /* function exit code */
  7375. __Pyx_RefNannyFinishContext();
  7376. return __pyx_r;
  7377. }
  7378. static PyObject *__pyx_pf_9fontTools_5qu2cu_5qu2cu_8main(CYTHON_UNUSED PyObject *__pyx_self) {
  7379. PyObject *__pyx_v_generate_curve = NULL;
  7380. PyObject *__pyx_v_curve_to_quadratic = NULL;
  7381. double __pyx_v_tolerance;
  7382. double __pyx_v_reconstruct_tolerance;
  7383. PyObject *__pyx_v_curve = NULL;
  7384. PyObject *__pyx_v_quadratics = NULL;
  7385. PyObject *__pyx_v_curves = NULL;
  7386. PyObject *__pyx_r = NULL;
  7387. __Pyx_RefNannyDeclarations
  7388. PyObject *__pyx_t_1 = NULL;
  7389. PyObject *__pyx_t_2 = NULL;
  7390. PyObject *__pyx_t_3 = NULL;
  7391. int __pyx_t_4;
  7392. PyObject *__pyx_t_5 = NULL;
  7393. Py_ssize_t __pyx_t_6;
  7394. PyObject *__pyx_t_7 = NULL;
  7395. int __pyx_lineno = 0;
  7396. const char *__pyx_filename = NULL;
  7397. int __pyx_clineno = 0;
  7398. __Pyx_RefNannySetupContext("main", 1);
  7399. /* "fontTools/qu2cu/qu2cu.py":390
  7400. *
  7401. * def main():
  7402. * from fontTools.cu2qu.benchmark import generate_curve # <<<<<<<<<<<<<<
  7403. * from fontTools.cu2qu import curve_to_quadratic
  7404. *
  7405. */
  7406. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
  7407. __Pyx_GOTREF(__pyx_t_1);
  7408. __Pyx_INCREF(__pyx_n_s_generate_curve);
  7409. __Pyx_GIVEREF(__pyx_n_s_generate_curve);
  7410. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_generate_curve)) __PYX_ERR(0, 390, __pyx_L1_error);
  7411. __pyx_t_2 = __Pyx_Import(__pyx_n_s_fontTools_cu2qu_benchmark, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
  7412. __Pyx_GOTREF(__pyx_t_2);
  7413. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7414. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_generate_curve); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
  7415. __Pyx_GOTREF(__pyx_t_1);
  7416. __Pyx_INCREF(__pyx_t_1);
  7417. __pyx_v_generate_curve = __pyx_t_1;
  7418. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7419. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7420. /* "fontTools/qu2cu/qu2cu.py":391
  7421. * def main():
  7422. * from fontTools.cu2qu.benchmark import generate_curve
  7423. * from fontTools.cu2qu import curve_to_quadratic # <<<<<<<<<<<<<<
  7424. *
  7425. * tolerance = 0.05
  7426. */
  7427. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
  7428. __Pyx_GOTREF(__pyx_t_2);
  7429. __Pyx_INCREF(__pyx_n_s_curve_to_quadratic);
  7430. __Pyx_GIVEREF(__pyx_n_s_curve_to_quadratic);
  7431. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_curve_to_quadratic)) __PYX_ERR(0, 391, __pyx_L1_error);
  7432. __pyx_t_1 = __Pyx_Import(__pyx_n_s_fontTools_cu2qu, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
  7433. __Pyx_GOTREF(__pyx_t_1);
  7434. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7435. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_curve_to_quadratic); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
  7436. __Pyx_GOTREF(__pyx_t_2);
  7437. __Pyx_INCREF(__pyx_t_2);
  7438. __pyx_v_curve_to_quadratic = __pyx_t_2;
  7439. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7440. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7441. /* "fontTools/qu2cu/qu2cu.py":393
  7442. * from fontTools.cu2qu import curve_to_quadratic
  7443. *
  7444. * tolerance = 0.05 # <<<<<<<<<<<<<<
  7445. * reconstruct_tolerance = tolerance * 1
  7446. * curve = generate_curve()
  7447. */
  7448. __pyx_v_tolerance = 0.05;
  7449. /* "fontTools/qu2cu/qu2cu.py":394
  7450. *
  7451. * tolerance = 0.05
  7452. * reconstruct_tolerance = tolerance * 1 # <<<<<<<<<<<<<<
  7453. * curve = generate_curve()
  7454. * quadratics = curve_to_quadratic(curve, tolerance)
  7455. */
  7456. __pyx_v_reconstruct_tolerance = (__pyx_v_tolerance * 1.0);
  7457. /* "fontTools/qu2cu/qu2cu.py":395
  7458. * tolerance = 0.05
  7459. * reconstruct_tolerance = tolerance * 1
  7460. * curve = generate_curve() # <<<<<<<<<<<<<<
  7461. * quadratics = curve_to_quadratic(curve, tolerance)
  7462. * print(
  7463. */
  7464. __Pyx_INCREF(__pyx_v_generate_curve);
  7465. __pyx_t_2 = __pyx_v_generate_curve; __pyx_t_3 = NULL;
  7466. __pyx_t_4 = 0;
  7467. #if CYTHON_UNPACK_METHODS
  7468. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  7469. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  7470. if (likely(__pyx_t_3)) {
  7471. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  7472. __Pyx_INCREF(__pyx_t_3);
  7473. __Pyx_INCREF(function);
  7474. __Pyx_DECREF_SET(__pyx_t_2, function);
  7475. __pyx_t_4 = 1;
  7476. }
  7477. }
  7478. #endif
  7479. {
  7480. PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
  7481. __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
  7482. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  7483. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
  7484. __Pyx_GOTREF(__pyx_t_1);
  7485. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7486. }
  7487. __pyx_v_curve = __pyx_t_1;
  7488. __pyx_t_1 = 0;
  7489. /* "fontTools/qu2cu/qu2cu.py":396
  7490. * reconstruct_tolerance = tolerance * 1
  7491. * curve = generate_curve()
  7492. * quadratics = curve_to_quadratic(curve, tolerance) # <<<<<<<<<<<<<<
  7493. * print(
  7494. * "cu2qu tolerance %g. qu2cu tolerance %g." % (tolerance, reconstruct_tolerance)
  7495. */
  7496. __pyx_t_2 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
  7497. __Pyx_GOTREF(__pyx_t_2);
  7498. __Pyx_INCREF(__pyx_v_curve_to_quadratic);
  7499. __pyx_t_3 = __pyx_v_curve_to_quadratic; __pyx_t_5 = NULL;
  7500. __pyx_t_4 = 0;
  7501. #if CYTHON_UNPACK_METHODS
  7502. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  7503. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
  7504. if (likely(__pyx_t_5)) {
  7505. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7506. __Pyx_INCREF(__pyx_t_5);
  7507. __Pyx_INCREF(function);
  7508. __Pyx_DECREF_SET(__pyx_t_3, function);
  7509. __pyx_t_4 = 1;
  7510. }
  7511. }
  7512. #endif
  7513. {
  7514. PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_curve, __pyx_t_2};
  7515. __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
  7516. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7517. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7518. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
  7519. __Pyx_GOTREF(__pyx_t_1);
  7520. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7521. }
  7522. __pyx_v_quadratics = __pyx_t_1;
  7523. __pyx_t_1 = 0;
  7524. /* "fontTools/qu2cu/qu2cu.py":398
  7525. * quadratics = curve_to_quadratic(curve, tolerance)
  7526. * print(
  7527. * "cu2qu tolerance %g. qu2cu tolerance %g." % (tolerance, reconstruct_tolerance) # <<<<<<<<<<<<<<
  7528. * )
  7529. * print("One random cubic turned into %d quadratics." % len(quadratics))
  7530. */
  7531. __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error)
  7532. __Pyx_GOTREF(__pyx_t_1);
  7533. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_reconstruct_tolerance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error)
  7534. __Pyx_GOTREF(__pyx_t_3);
  7535. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error)
  7536. __Pyx_GOTREF(__pyx_t_2);
  7537. __Pyx_GIVEREF(__pyx_t_1);
  7538. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error);
  7539. __Pyx_GIVEREF(__pyx_t_3);
  7540. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error);
  7541. __pyx_t_1 = 0;
  7542. __pyx_t_3 = 0;
  7543. __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error)
  7544. __Pyx_GOTREF(__pyx_t_3);
  7545. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7546. /* "fontTools/qu2cu/qu2cu.py":397
  7547. * curve = generate_curve()
  7548. * quadratics = curve_to_quadratic(curve, tolerance)
  7549. * print( # <<<<<<<<<<<<<<
  7550. * "cu2qu tolerance %g. qu2cu tolerance %g." % (tolerance, reconstruct_tolerance)
  7551. * )
  7552. */
  7553. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
  7554. __Pyx_GOTREF(__pyx_t_2);
  7555. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7556. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7557. /* "fontTools/qu2cu/qu2cu.py":400
  7558. * "cu2qu tolerance %g. qu2cu tolerance %g." % (tolerance, reconstruct_tolerance)
  7559. * )
  7560. * print("One random cubic turned into %d quadratics." % len(quadratics)) # <<<<<<<<<<<<<<
  7561. * curves = quadratic_to_curves([quadratics], reconstruct_tolerance)
  7562. * print("Those quadratics turned back into %d cubics. " % len(curves))
  7563. */
  7564. __pyx_t_6 = PyObject_Length(__pyx_v_quadratics); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 400, __pyx_L1_error)
  7565. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  7566. __Pyx_GOTREF(__pyx_t_2);
  7567. __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_One_random_cubic_turned_into_d_q, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)
  7568. __Pyx_GOTREF(__pyx_t_3);
  7569. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7570. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  7571. __Pyx_GOTREF(__pyx_t_2);
  7572. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7573. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7574. /* "fontTools/qu2cu/qu2cu.py":401
  7575. * )
  7576. * print("One random cubic turned into %d quadratics." % len(quadratics))
  7577. * curves = quadratic_to_curves([quadratics], reconstruct_tolerance) # <<<<<<<<<<<<<<
  7578. * print("Those quadratics turned back into %d cubics. " % len(curves))
  7579. * print("Original curve:", curve)
  7580. */
  7581. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_quadratic_to_curves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
  7582. __Pyx_GOTREF(__pyx_t_3);
  7583. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error)
  7584. __Pyx_GOTREF(__pyx_t_1);
  7585. __Pyx_INCREF(__pyx_v_quadratics);
  7586. __Pyx_GIVEREF(__pyx_v_quadratics);
  7587. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_quadratics)) __PYX_ERR(0, 401, __pyx_L1_error);
  7588. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_reconstruct_tolerance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
  7589. __Pyx_GOTREF(__pyx_t_5);
  7590. __pyx_t_7 = NULL;
  7591. __pyx_t_4 = 0;
  7592. #if CYTHON_UNPACK_METHODS
  7593. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  7594. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
  7595. if (likely(__pyx_t_7)) {
  7596. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7597. __Pyx_INCREF(__pyx_t_7);
  7598. __Pyx_INCREF(function);
  7599. __Pyx_DECREF_SET(__pyx_t_3, function);
  7600. __pyx_t_4 = 1;
  7601. }
  7602. }
  7603. #endif
  7604. {
  7605. PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_1, __pyx_t_5};
  7606. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
  7607. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7608. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7609. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7610. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
  7611. __Pyx_GOTREF(__pyx_t_2);
  7612. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7613. }
  7614. __pyx_v_curves = __pyx_t_2;
  7615. __pyx_t_2 = 0;
  7616. /* "fontTools/qu2cu/qu2cu.py":402
  7617. * print("One random cubic turned into %d quadratics." % len(quadratics))
  7618. * curves = quadratic_to_curves([quadratics], reconstruct_tolerance)
  7619. * print("Those quadratics turned back into %d cubics. " % len(curves)) # <<<<<<<<<<<<<<
  7620. * print("Original curve:", curve)
  7621. * print("Reconstructed curve(s):", curves)
  7622. */
  7623. __pyx_t_6 = PyObject_Length(__pyx_v_curves); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 402, __pyx_L1_error)
  7624. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  7625. __Pyx_GOTREF(__pyx_t_2);
  7626. __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_Those_quadratics_turned_back_int, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
  7627. __Pyx_GOTREF(__pyx_t_3);
  7628. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7629. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  7630. __Pyx_GOTREF(__pyx_t_2);
  7631. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7632. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7633. /* "fontTools/qu2cu/qu2cu.py":403
  7634. * curves = quadratic_to_curves([quadratics], reconstruct_tolerance)
  7635. * print("Those quadratics turned back into %d cubics. " % len(curves))
  7636. * print("Original curve:", curve) # <<<<<<<<<<<<<<
  7637. * print("Reconstructed curve(s):", curves)
  7638. *
  7639. */
  7640. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
  7641. __Pyx_GOTREF(__pyx_t_2);
  7642. __Pyx_INCREF(__pyx_kp_u_Original_curve);
  7643. __Pyx_GIVEREF(__pyx_kp_u_Original_curve);
  7644. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Original_curve)) __PYX_ERR(0, 403, __pyx_L1_error);
  7645. __Pyx_INCREF(__pyx_v_curve);
  7646. __Pyx_GIVEREF(__pyx_v_curve);
  7647. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_curve)) __PYX_ERR(0, 403, __pyx_L1_error);
  7648. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 403, __pyx_L1_error)
  7649. __Pyx_GOTREF(__pyx_t_3);
  7650. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7651. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7652. /* "fontTools/qu2cu/qu2cu.py":404
  7653. * print("Those quadratics turned back into %d cubics. " % len(curves))
  7654. * print("Original curve:", curve)
  7655. * print("Reconstructed curve(s):", curves) # <<<<<<<<<<<<<<
  7656. *
  7657. *
  7658. */
  7659. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error)
  7660. __Pyx_GOTREF(__pyx_t_3);
  7661. __Pyx_INCREF(__pyx_kp_u_Reconstructed_curve_s);
  7662. __Pyx_GIVEREF(__pyx_kp_u_Reconstructed_curve_s);
  7663. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Reconstructed_curve_s)) __PYX_ERR(0, 404, __pyx_L1_error);
  7664. __Pyx_INCREF(__pyx_v_curves);
  7665. __Pyx_GIVEREF(__pyx_v_curves);
  7666. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_curves)) __PYX_ERR(0, 404, __pyx_L1_error);
  7667. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  7668. __Pyx_GOTREF(__pyx_t_2);
  7669. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7670. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7671. /* "fontTools/qu2cu/qu2cu.py":389
  7672. *
  7673. *
  7674. * def main(): # <<<<<<<<<<<<<<
  7675. * from fontTools.cu2qu.benchmark import generate_curve
  7676. * from fontTools.cu2qu import curve_to_quadratic
  7677. */
  7678. /* function exit code */
  7679. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7680. goto __pyx_L0;
  7681. __pyx_L1_error:;
  7682. __Pyx_XDECREF(__pyx_t_1);
  7683. __Pyx_XDECREF(__pyx_t_2);
  7684. __Pyx_XDECREF(__pyx_t_3);
  7685. __Pyx_XDECREF(__pyx_t_5);
  7686. __Pyx_XDECREF(__pyx_t_7);
  7687. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu.main", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7688. __pyx_r = NULL;
  7689. __pyx_L0:;
  7690. __Pyx_XDECREF(__pyx_v_generate_curve);
  7691. __Pyx_XDECREF(__pyx_v_curve_to_quadratic);
  7692. __Pyx_XDECREF(__pyx_v_curve);
  7693. __Pyx_XDECREF(__pyx_v_quadratics);
  7694. __Pyx_XDECREF(__pyx_v_curves);
  7695. __Pyx_XGIVEREF(__pyx_r);
  7696. __Pyx_RefNannyFinishContext();
  7697. return __pyx_r;
  7698. }
  7699. static struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *__pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr[8];
  7700. static int __pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr = 0;
  7701. static PyObject *__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  7702. PyObject *o;
  7703. #if CYTHON_COMPILING_IN_LIMITED_API
  7704. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  7705. o = alloc_func(t, 0);
  7706. #else
  7707. #if CYTHON_COMPILING_IN_CPYTHON
  7708. if (likely((int)(__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr)))) {
  7709. o = (PyObject*)__pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr[--__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr];
  7710. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr));
  7711. (void) PyObject_INIT(o, t);
  7712. PyObject_GC_Track(o);
  7713. } else
  7714. #endif
  7715. {
  7716. o = (*t->tp_alloc)(t, 0);
  7717. if (unlikely(!o)) return 0;
  7718. }
  7719. #endif
  7720. return o;
  7721. }
  7722. static void __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr(PyObject *o) {
  7723. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)o;
  7724. #if CYTHON_USE_TP_FINALIZE
  7725. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  7726. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr) {
  7727. if (PyObject_CallFinalizerFromDealloc(o)) return;
  7728. }
  7729. }
  7730. #endif
  7731. PyObject_GC_UnTrack(o);
  7732. Py_CLEAR(p->__pyx_genexpr_arg_0);
  7733. Py_CLEAR(p->__pyx_v_c);
  7734. Py_CLEAR(p->__pyx_t_0);
  7735. #if CYTHON_COMPILING_IN_CPYTHON
  7736. if (((int)(__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr)))) {
  7737. __pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr[__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)o);
  7738. } else
  7739. #endif
  7740. {
  7741. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  7742. (*Py_TYPE(o)->tp_free)(o);
  7743. #else
  7744. {
  7745. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  7746. if (tp_free) tp_free(o);
  7747. }
  7748. #endif
  7749. }
  7750. }
  7751. static int __pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
  7752. int e;
  7753. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr *)o;
  7754. if (p->__pyx_genexpr_arg_0) {
  7755. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  7756. }
  7757. if (p->__pyx_v_c) {
  7758. e = (*v)(p->__pyx_v_c, a); if (e) return e;
  7759. }
  7760. if (p->__pyx_t_0) {
  7761. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  7762. }
  7763. return 0;
  7764. }
  7765. #if CYTHON_USE_TYPE_SPECS
  7766. static PyType_Slot __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr_slots[] = {
  7767. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr},
  7768. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr},
  7769. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr},
  7770. {0, 0},
  7771. };
  7772. static PyType_Spec __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr_spec = {
  7773. "fontTools.qu2cu.qu2cu.__pyx_scope_struct__genexpr",
  7774. sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr),
  7775. 0,
  7776. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  7777. __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr_slots,
  7778. };
  7779. #else
  7780. static PyTypeObject __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr = {
  7781. PyVarObject_HEAD_INIT(0, 0)
  7782. "fontTools.qu2cu.qu2cu.""__pyx_scope_struct__genexpr", /*tp_name*/
  7783. sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr), /*tp_basicsize*/
  7784. 0, /*tp_itemsize*/
  7785. __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr, /*tp_dealloc*/
  7786. #if PY_VERSION_HEX < 0x030800b4
  7787. 0, /*tp_print*/
  7788. #endif
  7789. #if PY_VERSION_HEX >= 0x030800b4
  7790. 0, /*tp_vectorcall_offset*/
  7791. #endif
  7792. 0, /*tp_getattr*/
  7793. 0, /*tp_setattr*/
  7794. #if PY_MAJOR_VERSION < 3
  7795. 0, /*tp_compare*/
  7796. #endif
  7797. #if PY_MAJOR_VERSION >= 3
  7798. 0, /*tp_as_async*/
  7799. #endif
  7800. 0, /*tp_repr*/
  7801. 0, /*tp_as_number*/
  7802. 0, /*tp_as_sequence*/
  7803. 0, /*tp_as_mapping*/
  7804. 0, /*tp_hash*/
  7805. 0, /*tp_call*/
  7806. 0, /*tp_str*/
  7807. 0, /*tp_getattro*/
  7808. 0, /*tp_setattro*/
  7809. 0, /*tp_as_buffer*/
  7810. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  7811. 0, /*tp_doc*/
  7812. __pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr, /*tp_traverse*/
  7813. 0, /*tp_clear*/
  7814. 0, /*tp_richcompare*/
  7815. 0, /*tp_weaklistoffset*/
  7816. 0, /*tp_iter*/
  7817. 0, /*tp_iternext*/
  7818. 0, /*tp_methods*/
  7819. 0, /*tp_members*/
  7820. 0, /*tp_getset*/
  7821. 0, /*tp_base*/
  7822. 0, /*tp_dict*/
  7823. 0, /*tp_descr_get*/
  7824. 0, /*tp_descr_set*/
  7825. #if !CYTHON_USE_TYPE_SPECS
  7826. 0, /*tp_dictoffset*/
  7827. #endif
  7828. 0, /*tp_init*/
  7829. 0, /*tp_alloc*/
  7830. __pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr, /*tp_new*/
  7831. 0, /*tp_free*/
  7832. 0, /*tp_is_gc*/
  7833. 0, /*tp_bases*/
  7834. 0, /*tp_mro*/
  7835. 0, /*tp_cache*/
  7836. 0, /*tp_subclasses*/
  7837. 0, /*tp_weaklist*/
  7838. 0, /*tp_del*/
  7839. 0, /*tp_version_tag*/
  7840. #if PY_VERSION_HEX >= 0x030400a1
  7841. #if CYTHON_USE_TP_FINALIZE
  7842. 0, /*tp_finalize*/
  7843. #else
  7844. NULL, /*tp_finalize*/
  7845. #endif
  7846. #endif
  7847. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  7848. 0, /*tp_vectorcall*/
  7849. #endif
  7850. #if __PYX_NEED_TP_PRINT_SLOT == 1
  7851. 0, /*tp_print*/
  7852. #endif
  7853. #if PY_VERSION_HEX >= 0x030C0000
  7854. 0, /*tp_watched*/
  7855. #endif
  7856. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  7857. 0, /*tp_pypy_flags*/
  7858. #endif
  7859. };
  7860. #endif
  7861. static struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr[8];
  7862. static int __pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr = 0;
  7863. static PyObject *__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  7864. PyObject *o;
  7865. #if CYTHON_COMPILING_IN_LIMITED_API
  7866. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  7867. o = alloc_func(t, 0);
  7868. #else
  7869. #if CYTHON_COMPILING_IN_CPYTHON
  7870. if (likely((int)(__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr)))) {
  7871. o = (PyObject*)__pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr[--__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr];
  7872. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr));
  7873. (void) PyObject_INIT(o, t);
  7874. PyObject_GC_Track(o);
  7875. } else
  7876. #endif
  7877. {
  7878. o = (*t->tp_alloc)(t, 0);
  7879. if (unlikely(!o)) return 0;
  7880. }
  7881. #endif
  7882. return o;
  7883. }
  7884. static void __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr(PyObject *o) {
  7885. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)o;
  7886. #if CYTHON_USE_TP_FINALIZE
  7887. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  7888. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr) {
  7889. if (PyObject_CallFinalizerFromDealloc(o)) return;
  7890. }
  7891. }
  7892. #endif
  7893. PyObject_GC_UnTrack(o);
  7894. Py_CLEAR(p->__pyx_genexpr_arg_0);
  7895. Py_CLEAR(p->__pyx_t_0);
  7896. #if CYTHON_COMPILING_IN_CPYTHON
  7897. if (((int)(__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr)))) {
  7898. __pyx_freelist_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr[__pyx_freecount_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)o);
  7899. } else
  7900. #endif
  7901. {
  7902. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  7903. (*Py_TYPE(o)->tp_free)(o);
  7904. #else
  7905. {
  7906. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  7907. if (tp_free) tp_free(o);
  7908. }
  7909. #endif
  7910. }
  7911. }
  7912. static int __pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  7913. int e;
  7914. struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr *)o;
  7915. if (p->__pyx_genexpr_arg_0) {
  7916. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  7917. }
  7918. if (p->__pyx_t_0) {
  7919. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  7920. }
  7921. return 0;
  7922. }
  7923. #if CYTHON_USE_TYPE_SPECS
  7924. static PyType_Slot __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr_slots[] = {
  7925. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr},
  7926. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr},
  7927. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr},
  7928. {0, 0},
  7929. };
  7930. static PyType_Spec __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr_spec = {
  7931. "fontTools.qu2cu.qu2cu.__pyx_scope_struct_1_genexpr",
  7932. sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr),
  7933. 0,
  7934. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  7935. __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr_slots,
  7936. };
  7937. #else
  7938. static PyTypeObject __pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr = {
  7939. PyVarObject_HEAD_INIT(0, 0)
  7940. "fontTools.qu2cu.qu2cu.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  7941. sizeof(struct __pyx_obj_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  7942. 0, /*tp_itemsize*/
  7943. __pyx_tp_dealloc_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  7944. #if PY_VERSION_HEX < 0x030800b4
  7945. 0, /*tp_print*/
  7946. #endif
  7947. #if PY_VERSION_HEX >= 0x030800b4
  7948. 0, /*tp_vectorcall_offset*/
  7949. #endif
  7950. 0, /*tp_getattr*/
  7951. 0, /*tp_setattr*/
  7952. #if PY_MAJOR_VERSION < 3
  7953. 0, /*tp_compare*/
  7954. #endif
  7955. #if PY_MAJOR_VERSION >= 3
  7956. 0, /*tp_as_async*/
  7957. #endif
  7958. 0, /*tp_repr*/
  7959. 0, /*tp_as_number*/
  7960. 0, /*tp_as_sequence*/
  7961. 0, /*tp_as_mapping*/
  7962. 0, /*tp_hash*/
  7963. 0, /*tp_call*/
  7964. 0, /*tp_str*/
  7965. 0, /*tp_getattro*/
  7966. 0, /*tp_setattro*/
  7967. 0, /*tp_as_buffer*/
  7968. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  7969. 0, /*tp_doc*/
  7970. __pyx_tp_traverse_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  7971. 0, /*tp_clear*/
  7972. 0, /*tp_richcompare*/
  7973. 0, /*tp_weaklistoffset*/
  7974. 0, /*tp_iter*/
  7975. 0, /*tp_iternext*/
  7976. 0, /*tp_methods*/
  7977. 0, /*tp_members*/
  7978. 0, /*tp_getset*/
  7979. 0, /*tp_base*/
  7980. 0, /*tp_dict*/
  7981. 0, /*tp_descr_get*/
  7982. 0, /*tp_descr_set*/
  7983. #if !CYTHON_USE_TYPE_SPECS
  7984. 0, /*tp_dictoffset*/
  7985. #endif
  7986. 0, /*tp_init*/
  7987. 0, /*tp_alloc*/
  7988. __pyx_tp_new_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr, /*tp_new*/
  7989. 0, /*tp_free*/
  7990. 0, /*tp_is_gc*/
  7991. 0, /*tp_bases*/
  7992. 0, /*tp_mro*/
  7993. 0, /*tp_cache*/
  7994. 0, /*tp_subclasses*/
  7995. 0, /*tp_weaklist*/
  7996. 0, /*tp_del*/
  7997. 0, /*tp_version_tag*/
  7998. #if PY_VERSION_HEX >= 0x030400a1
  7999. #if CYTHON_USE_TP_FINALIZE
  8000. 0, /*tp_finalize*/
  8001. #else
  8002. NULL, /*tp_finalize*/
  8003. #endif
  8004. #endif
  8005. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  8006. 0, /*tp_vectorcall*/
  8007. #endif
  8008. #if __PYX_NEED_TP_PRINT_SLOT == 1
  8009. 0, /*tp_print*/
  8010. #endif
  8011. #if PY_VERSION_HEX >= 0x030C0000
  8012. 0, /*tp_watched*/
  8013. #endif
  8014. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  8015. 0, /*tp_pypy_flags*/
  8016. #endif
  8017. };
  8018. #endif
  8019. static PyMethodDef __pyx_methods[] = {
  8020. {0, 0, 0, 0}
  8021. };
  8022. #ifndef CYTHON_SMALL_CODE
  8023. #if defined(__clang__)
  8024. #define CYTHON_SMALL_CODE
  8025. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  8026. #define CYTHON_SMALL_CODE __attribute__((cold))
  8027. #else
  8028. #define CYTHON_SMALL_CODE
  8029. #endif
  8030. #endif
  8031. /* #### Code section: pystring_table ### */
  8032. static int __Pyx_CreateStringTabAndInitStrings(void) {
  8033. __Pyx_StringTabEntry __pyx_string_tab[] = {
  8034. {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  8035. {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  8036. {&__pyx_n_s_COMPILED, __pyx_k_COMPILED, sizeof(__pyx_k_COMPILED), 0, 0, 1, 1},
  8037. {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  8038. {&__pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_k_Lib_fontTools_qu2cu_qu2cu_py, sizeof(__pyx_k_Lib_fontTools_qu2cu_qu2cu_py), 0, 0, 1, 0},
  8039. {&__pyx_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1},
  8040. {&__pyx_kp_s_List_List_Point, __pyx_k_List_List_Point, sizeof(__pyx_k_List_List_Point), 0, 0, 1, 0},
  8041. {&__pyx_kp_s_List_Tuple_Point, __pyx_k_List_Tuple_Point, sizeof(__pyx_k_List_Tuple_Point), 0, 0, 1, 0},
  8042. {&__pyx_kp_u_One_random_cubic_turned_into_d_q, __pyx_k_One_random_cubic_turned_into_d_q, sizeof(__pyx_k_One_random_cubic_turned_into_d_q), 0, 1, 0, 0},
  8043. {&__pyx_kp_u_Original_curve, __pyx_k_Original_curve, sizeof(__pyx_k_Original_curve), 0, 1, 0, 0},
  8044. {&__pyx_n_s_Point, __pyx_k_Point, sizeof(__pyx_k_Point), 0, 0, 1, 1},
  8045. {&__pyx_kp_u_Reconstructed_curve_s, __pyx_k_Reconstructed_curve_s, sizeof(__pyx_k_Reconstructed_curve_s), 0, 1, 0, 0},
  8046. {&__pyx_n_s_Solution, __pyx_k_Solution, sizeof(__pyx_k_Solution), 0, 0, 1, 1},
  8047. {&__pyx_n_u_Solution, __pyx_k_Solution, sizeof(__pyx_k_Solution), 0, 1, 0, 1},
  8048. {&__pyx_kp_u_Those_quadratics_turned_back_int, __pyx_k_Those_quadratics_turned_back_int, sizeof(__pyx_k_Those_quadratics_turned_back_int), 0, 1, 0, 0},
  8049. {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1},
  8050. {&__pyx_n_s_Union, __pyx_k_Union, sizeof(__pyx_k_Union), 0, 0, 1, 1},
  8051. {&__pyx_n_s_ZeroDivisionError, __pyx_k_ZeroDivisionError, sizeof(__pyx_k_ZeroDivisionError), 0, 0, 1, 1},
  8052. {&__pyx_n_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 1},
  8053. {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  8054. {&__pyx_n_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 1},
  8055. {&__pyx_n_s_add_implicit_on_curves, __pyx_k_add_implicit_on_curves, sizeof(__pyx_k_add_implicit_on_curves), 0, 0, 1, 1},
  8056. {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  8057. {&__pyx_n_s_all_cubic, __pyx_k_all_cubic, sizeof(__pyx_k_all_cubic), 0, 0, 1, 1},
  8058. {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  8059. {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
  8060. {&__pyx_n_s_best_sol, __pyx_k_best_sol, sizeof(__pyx_k_best_sol), 0, 0, 1, 1},
  8061. {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1},
  8062. {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
  8063. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  8064. {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  8065. {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  8066. {&__pyx_n_s_cost, __pyx_k_cost, sizeof(__pyx_k_cost), 0, 0, 1, 1},
  8067. {&__pyx_n_s_costs, __pyx_k_costs, sizeof(__pyx_k_costs), 0, 0, 1, 1},
  8068. {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  8069. {&__pyx_kp_u_cu2qu_tolerance_g_qu2cu_toleranc, __pyx_k_cu2qu_tolerance_g_qu2cu_toleranc, sizeof(__pyx_k_cu2qu_tolerance_g_qu2cu_toleranc), 0, 1, 0, 0},
  8070. {&__pyx_n_s_cubic, __pyx_k_cubic, sizeof(__pyx_k_cubic), 0, 0, 1, 1},
  8071. {&__pyx_n_s_curve, __pyx_k_curve, sizeof(__pyx_k_curve), 0, 0, 1, 1},
  8072. {&__pyx_n_s_curve_to_quadratic, __pyx_k_curve_to_quadratic, sizeof(__pyx_k_curve_to_quadratic), 0, 0, 1, 1},
  8073. {&__pyx_n_s_curves, __pyx_k_curves, sizeof(__pyx_k_curves), 0, 0, 1, 1},
  8074. {&__pyx_n_s_cython, __pyx_k_cython, sizeof(__pyx_k_cython), 0, 0, 1, 1},
  8075. {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
  8076. {&__pyx_n_s_elevate_quadratic, __pyx_k_elevate_quadratic, sizeof(__pyx_k_elevate_quadratic), 0, 0, 1, 1},
  8077. {&__pyx_n_s_elevated_quadratics, __pyx_k_elevated_quadratics, sizeof(__pyx_k_elevated_quadratics), 0, 0, 1, 1},
  8078. {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
  8079. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  8080. {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
  8081. {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  8082. {&__pyx_n_u_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 1, 0, 1},
  8083. {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
  8084. {&__pyx_n_s_fontTools_cu2qu, __pyx_k_fontTools_cu2qu, sizeof(__pyx_k_fontTools_cu2qu), 0, 0, 1, 1},
  8085. {&__pyx_n_s_fontTools_cu2qu_benchmark, __pyx_k_fontTools_cu2qu_benchmark, sizeof(__pyx_k_fontTools_cu2qu_benchmark), 0, 0, 1, 1},
  8086. {&__pyx_n_s_fontTools_misc, __pyx_k_fontTools_misc, sizeof(__pyx_k_fontTools_misc), 0, 0, 1, 1},
  8087. {&__pyx_n_s_fontTools_misc_bezierTools, __pyx_k_fontTools_misc_bezierTools, sizeof(__pyx_k_fontTools_misc_bezierTools), 0, 0, 1, 1},
  8088. {&__pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_k_fontTools_qu2cu_qu2cu, sizeof(__pyx_k_fontTools_qu2cu_qu2cu), 0, 0, 1, 1},
  8089. {&__pyx_n_s_forced, __pyx_k_forced, sizeof(__pyx_k_forced), 0, 0, 1, 1},
  8090. {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
  8091. {&__pyx_n_s_generate_curve, __pyx_k_generate_curve, sizeof(__pyx_k_generate_curve), 0, 0, 1, 1},
  8092. {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  8093. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  8094. {&__pyx_n_s_i_sol, __pyx_k_i_sol, sizeof(__pyx_k_i_sol), 0, 0, 1, 1},
  8095. {&__pyx_n_s_i_sol_count, __pyx_k_i_sol_count, sizeof(__pyx_k_i_sol_count), 0, 0, 1, 1},
  8096. {&__pyx_n_s_i_sol_error, __pyx_k_i_sol_error, sizeof(__pyx_k_i_sol_error), 0, 0, 1, 1},
  8097. {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  8098. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  8099. {&__pyx_n_s_impossible, __pyx_k_impossible, sizeof(__pyx_k_impossible), 0, 0, 1, 1},
  8100. {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
  8101. {&__pyx_n_s_is_complex, __pyx_k_is_complex, sizeof(__pyx_k_is_complex), 0, 0, 1, 1},
  8102. {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
  8103. {&__pyx_n_s_is_cubic, __pyx_k_is_cubic, sizeof(__pyx_k_is_cubic), 0, 0, 1, 1},
  8104. {&__pyx_n_u_is_cubic, __pyx_k_is_cubic, sizeof(__pyx_k_is_cubic), 0, 1, 0, 1},
  8105. {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
  8106. {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  8107. {&__pyx_n_s_j_sol_count, __pyx_k_j_sol_count, sizeof(__pyx_k_j_sol_count), 0, 0, 1, 1},
  8108. {&__pyx_n_s_j_sol_error, __pyx_k_j_sol_error, sizeof(__pyx_k_j_sol_error), 0, 0, 1, 1},
  8109. {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  8110. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  8111. {&__pyx_n_u_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 1, 0, 1},
  8112. {&__pyx_n_s_main_2, __pyx_k_main_2, sizeof(__pyx_k_main_2), 0, 0, 1, 1},
  8113. {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  8114. {&__pyx_n_s_max_err, __pyx_k_max_err, sizeof(__pyx_k_max_err), 0, 0, 1, 1},
  8115. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  8116. {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
  8117. {&__pyx_n_s_num_offcurves, __pyx_k_num_offcurves, sizeof(__pyx_k_num_offcurves), 0, 0, 1, 1},
  8118. {&__pyx_n_s_num_points, __pyx_k_num_points, sizeof(__pyx_k_num_points), 0, 0, 1, 1},
  8119. {&__pyx_n_u_num_points, __pyx_k_num_points, sizeof(__pyx_k_num_points), 0, 1, 0, 1},
  8120. {&__pyx_n_s_off1, __pyx_k_off1, sizeof(__pyx_k_off1), 0, 0, 1, 1},
  8121. {&__pyx_n_s_off2, __pyx_k_off2, sizeof(__pyx_k_off2), 0, 0, 1, 1},
  8122. {&__pyx_n_s_on, __pyx_k_on, sizeof(__pyx_k_on), 0, 0, 1, 1},
  8123. {&__pyx_n_s_orig, __pyx_k_orig, sizeof(__pyx_k_orig), 0, 0, 1, 1},
  8124. {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  8125. {&__pyx_n_s_p0, __pyx_k_p0, sizeof(__pyx_k_p0), 0, 0, 1, 1},
  8126. {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1},
  8127. {&__pyx_n_s_p1_2_3, __pyx_k_p1_2_3, sizeof(__pyx_k_p1_2_3), 0, 0, 1, 1},
  8128. {&__pyx_n_s_p2, __pyx_k_p2, sizeof(__pyx_k_p2), 0, 0, 1, 1},
  8129. {&__pyx_n_s_p3, __pyx_k_p3, sizeof(__pyx_k_p3), 0, 0, 1, 1},
  8130. {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  8131. {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  8132. {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
  8133. {&__pyx_n_s_qq, __pyx_k_qq, sizeof(__pyx_k_qq), 0, 0, 1, 1},
  8134. {&__pyx_kp_u_quadratic_spline_requires_at_lea, __pyx_k_quadratic_spline_requires_at_lea, sizeof(__pyx_k_quadratic_spline_requires_at_lea), 0, 1, 0, 0},
  8135. {&__pyx_n_s_quadratic_to_curves, __pyx_k_quadratic_to_curves, sizeof(__pyx_k_quadratic_to_curves), 0, 0, 1, 1},
  8136. {&__pyx_n_u_quadratic_to_curves, __pyx_k_quadratic_to_curves, sizeof(__pyx_k_quadratic_to_curves), 0, 1, 0, 1},
  8137. {&__pyx_n_s_quadratic_to_curves_locals_genex, __pyx_k_quadratic_to_curves_locals_genex, sizeof(__pyx_k_quadratic_to_curves_locals_genex), 0, 0, 1, 1},
  8138. {&__pyx_n_s_quadratics, __pyx_k_quadratics, sizeof(__pyx_k_quadratics), 0, 0, 1, 1},
  8139. {&__pyx_n_s_quads, __pyx_k_quads, sizeof(__pyx_k_quads), 0, 0, 1, 1},
  8140. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  8141. {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  8142. {&__pyx_n_s_reconst, __pyx_k_reconst, sizeof(__pyx_k_reconst), 0, 0, 1, 1},
  8143. {&__pyx_n_s_reconstruct_tolerance, __pyx_k_reconstruct_tolerance, sizeof(__pyx_k_reconstruct_tolerance), 0, 0, 1, 1},
  8144. {&__pyx_n_s_reconstructed, __pyx_k_reconstructed, sizeof(__pyx_k_reconstructed), 0, 0, 1, 1},
  8145. {&__pyx_n_s_reconstructed_iter, __pyx_k_reconstructed_iter, sizeof(__pyx_k_reconstructed_iter), 0, 0, 1, 1},
  8146. {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  8147. {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
  8148. {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  8149. {&__pyx_n_s_sols, __pyx_k_sols, sizeof(__pyx_k_sols), 0, 0, 1, 1},
  8150. {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
  8151. {&__pyx_n_s_spline_to_curves, __pyx_k_spline_to_curves, sizeof(__pyx_k_spline_to_curves), 0, 0, 1, 1},
  8152. {&__pyx_n_s_spline_to_curves_locals_genexpr, __pyx_k_spline_to_curves_locals_genexpr, sizeof(__pyx_k_spline_to_curves_locals_genexpr), 0, 0, 1, 1},
  8153. {&__pyx_n_s_splitCubicAtTC, __pyx_k_splitCubicAtTC, sizeof(__pyx_k_splitCubicAtTC), 0, 0, 1, 1},
  8154. {&__pyx_n_s_splits, __pyx_k_splits, sizeof(__pyx_k_splits), 0, 0, 1, 1},
  8155. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  8156. {&__pyx_n_s_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 0, 1, 1},
  8157. {&__pyx_n_u_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 1, 0, 1},
  8158. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  8159. {&__pyx_n_s_this_count, __pyx_k_this_count, sizeof(__pyx_k_this_count), 0, 0, 1, 1},
  8160. {&__pyx_n_s_this_sol_count, __pyx_k_this_sol_count, sizeof(__pyx_k_this_sol_count), 0, 0, 1, 1},
  8161. {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  8162. {&__pyx_n_s_tolerance, __pyx_k_tolerance, sizeof(__pyx_k_tolerance), 0, 0, 1, 1},
  8163. {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1},
  8164. {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1},
  8165. {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  8166. {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  8167. {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  8168. {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  8169. {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  8170. {0, 0, 0, 0, 0, 0, 0}
  8171. };
  8172. return __Pyx_InitStrings(__pyx_string_tab);
  8173. }
  8174. /* #### Code section: cached_builtins ### */
  8175. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  8176. __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 23, __pyx_L1_error)
  8177. __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 23, __pyx_L1_error)
  8178. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 127, __pyx_L1_error)
  8179. __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 132, __pyx_L1_error)
  8180. __pyx_builtin_ZeroDivisionError = __Pyx_GetBuiltinName(__pyx_n_s_ZeroDivisionError); if (!__pyx_builtin_ZeroDivisionError) __PYX_ERR(0, 320, __pyx_L1_error)
  8181. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 329, __pyx_L1_error)
  8182. __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 378, __pyx_L1_error)
  8183. __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 378, __pyx_L1_error)
  8184. __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 397, __pyx_L1_error)
  8185. return 0;
  8186. __pyx_L1_error:;
  8187. return -1;
  8188. }
  8189. /* #### Code section: cached_constants ### */
  8190. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  8191. __Pyx_RefNannyDeclarations
  8192. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  8193. /* "fontTools/qu2cu/qu2cu.py":229
  8194. * costs.append(cost)
  8195. * costs.append(cost)
  8196. * qq = add_implicit_on_curves(p)[1:] # <<<<<<<<<<<<<<
  8197. * costs.pop()
  8198. * q.extend(qq)
  8199. */
  8200. __pyx_slice_ = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 229, __pyx_L1_error)
  8201. __Pyx_GOTREF(__pyx_slice_);
  8202. __Pyx_GIVEREF(__pyx_slice_);
  8203. /* "fontTools/qu2cu/qu2cu.py":296
  8204. * # Dynamic-Programming to find the solution with fewest number of
  8205. * # cubic curves, and within those the one with smallest error.
  8206. * sols = [Solution(0, 0, 0, False)] # <<<<<<<<<<<<<<
  8207. * impossible = Solution(len(elevated_quadratics) * 3 + 1, 0, 1, False)
  8208. * start = 0
  8209. */
  8210. __pyx_tuple__2 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_0, Py_False); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 296, __pyx_L1_error)
  8211. __Pyx_GOTREF(__pyx_tuple__2);
  8212. __Pyx_GIVEREF(__pyx_tuple__2);
  8213. /* "fontTools/qu2cu/qu2cu.py":85
  8214. *
  8215. *
  8216. * @cython.locals( # <<<<<<<<<<<<<<
  8217. * p0=cython.complex,
  8218. * p1=cython.complex,
  8219. */
  8220. __pyx_tuple__5 = PyTuple_Pack(4, __pyx_n_s_p0, __pyx_n_s_p1, __pyx_n_s_p2, __pyx_n_s_p1_2_3); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 85, __pyx_L1_error)
  8221. __Pyx_GOTREF(__pyx_tuple__5);
  8222. __Pyx_GIVEREF(__pyx_tuple__5);
  8223. __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_n_s_elevate_quadratic, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 85, __pyx_L1_error)
  8224. /* "fontTools/qu2cu/qu2cu.py":157
  8225. *
  8226. *
  8227. * @cython.locals( # <<<<<<<<<<<<<<
  8228. * count=cython.int,
  8229. * num_offcurves=cython.int,
  8230. */
  8231. __pyx_tuple__7 = PyTuple_Pack(8, __pyx_n_s_p, __pyx_n_s_count, __pyx_n_s_num_offcurves, __pyx_n_s_i, __pyx_n_s_off1, __pyx_n_s_off2, __pyx_n_s_on, __pyx_n_s_q); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 157, __pyx_L1_error)
  8232. __Pyx_GOTREF(__pyx_tuple__7);
  8233. __Pyx_GIVEREF(__pyx_tuple__7);
  8234. __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_n_s_add_implicit_on_curves, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 157, __pyx_L1_error)
  8235. /* "fontTools/qu2cu/qu2cu.py":181
  8236. *
  8237. *
  8238. * @cython.locals( # <<<<<<<<<<<<<<
  8239. * cost=cython.int,
  8240. * is_complex=cython.int,
  8241. */
  8242. __pyx_tuple__9 = PyTuple_Pack(17, __pyx_n_s_quads, __pyx_n_s_max_err, __pyx_n_s_all_cubic, __pyx_n_s_cost, __pyx_n_s_is_complex, __pyx_n_s_q, __pyx_n_s_costs, __pyx_n_s_p, __pyx_n_s_i, __pyx_n_s_qq, __pyx_n_s_curves, __pyx_n_s_p, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_curve, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 181, __pyx_L1_error)
  8243. __Pyx_GOTREF(__pyx_tuple__9);
  8244. __Pyx_GIVEREF(__pyx_tuple__9);
  8245. __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_n_s_quadratic_to_curves, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 181, __pyx_L1_error)
  8246. /* "fontTools/qu2cu/qu2cu.py":245
  8247. *
  8248. *
  8249. * @cython.locals( # <<<<<<<<<<<<<<
  8250. * i=cython.int,
  8251. * j=cython.int,
  8252. */
  8253. __pyx_tuple__11 = PyTuple_Pack(42, __pyx_n_s_q, __pyx_n_s_costs, __pyx_n_s_tolerance, __pyx_n_s_all_cubic, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_i_sol_count, __pyx_n_s_j_sol_count, __pyx_n_s_this_sol_count, __pyx_n_s_err, __pyx_n_s_error, __pyx_n_s_i_sol_error, __pyx_n_s_j_sol_error, __pyx_n_s_is_cubic, __pyx_n_s_count, __pyx_n_s_p0, __pyx_n_s_p1, __pyx_n_s_p2, __pyx_n_s_p3, __pyx_n_s_v, __pyx_n_s_u, __pyx_n_s_elevated_quadratics, __pyx_n_s_forced, __pyx_n_s_sols, __pyx_n_s_impossible, __pyx_n_s_best_sol, __pyx_n_s_this_count, __pyx_n_s_i_sol, __pyx_n_s_curve, __pyx_n_s_ts, __pyx_n_s_reconstructed_iter, __pyx_n_s_reconstructed, __pyx_n_s_reconst, __pyx_n_s_orig, __pyx_n_s_splits, __pyx_n_s_cubic, __pyx_n_s_curves, __pyx_n_s_i, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 245, __pyx_L1_error)
  8254. __Pyx_GOTREF(__pyx_tuple__11);
  8255. __Pyx_GIVEREF(__pyx_tuple__11);
  8256. __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_n_s_spline_to_curves, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 245, __pyx_L1_error)
  8257. /* "fontTools/qu2cu/qu2cu.py":389
  8258. *
  8259. *
  8260. * def main(): # <<<<<<<<<<<<<<
  8261. * from fontTools.cu2qu.benchmark import generate_curve
  8262. * from fontTools.cu2qu import curve_to_quadratic
  8263. */
  8264. __pyx_tuple__13 = PyTuple_Pack(7, __pyx_n_s_generate_curve, __pyx_n_s_curve_to_quadratic, __pyx_n_s_tolerance, __pyx_n_s_reconstruct_tolerance, __pyx_n_s_curve, __pyx_n_s_quadratics, __pyx_n_s_curves); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 389, __pyx_L1_error)
  8265. __Pyx_GOTREF(__pyx_tuple__13);
  8266. __Pyx_GIVEREF(__pyx_tuple__13);
  8267. __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_qu2cu_qu2cu_py, __pyx_n_s_main_2, 389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 389, __pyx_L1_error)
  8268. __Pyx_RefNannyFinishContext();
  8269. return 0;
  8270. __pyx_L1_error:;
  8271. __Pyx_RefNannyFinishContext();
  8272. return -1;
  8273. }
  8274. /* #### Code section: init_constants ### */
  8275. static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
  8276. __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
  8277. __pyx_umethod_PyList_Type_pop.method_name = &__pyx_n_s_pop;
  8278. if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  8279. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  8280. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  8281. __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  8282. return 0;
  8283. __pyx_L1_error:;
  8284. return -1;
  8285. }
  8286. /* #### Code section: init_globals ### */
  8287. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  8288. /* AssertionsEnabled.init */
  8289. if (likely(__Pyx_init_assertions_enabled() == 0)); else
  8290. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  8291. return 0;
  8292. __pyx_L1_error:;
  8293. return -1;
  8294. }
  8295. /* #### Code section: init_module ### */
  8296. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  8297. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  8298. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  8299. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  8300. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  8301. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  8302. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  8303. static int __Pyx_modinit_global_init_code(void) {
  8304. __Pyx_RefNannyDeclarations
  8305. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  8306. /*--- Global init code ---*/
  8307. __Pyx_RefNannyFinishContext();
  8308. return 0;
  8309. }
  8310. static int __Pyx_modinit_variable_export_code(void) {
  8311. __Pyx_RefNannyDeclarations
  8312. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  8313. /*--- Variable export code ---*/
  8314. __Pyx_RefNannyFinishContext();
  8315. return 0;
  8316. }
  8317. static int __Pyx_modinit_function_export_code(void) {
  8318. __Pyx_RefNannyDeclarations
  8319. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  8320. /*--- Function export code ---*/
  8321. __Pyx_RefNannyFinishContext();
  8322. return 0;
  8323. }
  8324. static int __Pyx_modinit_type_init_code(void) {
  8325. __Pyx_RefNannyDeclarations
  8326. int __pyx_lineno = 0;
  8327. const char *__pyx_filename = NULL;
  8328. int __pyx_clineno = 0;
  8329. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  8330. /*--- Type init code ---*/
  8331. #if CYTHON_USE_TYPE_SPECS
  8332. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr_spec, NULL); if (unlikely(!__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr)) __PYX_ERR(0, 238, __pyx_L1_error)
  8333. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr_spec, __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
  8334. #else
  8335. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr = &__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr;
  8336. #endif
  8337. #if !CYTHON_COMPILING_IN_LIMITED_API
  8338. #endif
  8339. #if !CYTHON_USE_TYPE_SPECS
  8340. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
  8341. #endif
  8342. #if PY_MAJOR_VERSION < 3
  8343. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr->tp_print = 0;
  8344. #endif
  8345. #if !CYTHON_COMPILING_IN_LIMITED_API
  8346. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr->tp_dictoffset && __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  8347. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct__genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  8348. }
  8349. #endif
  8350. #if CYTHON_USE_TYPE_SPECS
  8351. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 343, __pyx_L1_error)
  8352. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr_spec, __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
  8353. #else
  8354. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr;
  8355. #endif
  8356. #if !CYTHON_COMPILING_IN_LIMITED_API
  8357. #endif
  8358. #if !CYTHON_USE_TYPE_SPECS
  8359. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
  8360. #endif
  8361. #if PY_MAJOR_VERSION < 3
  8362. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr->tp_print = 0;
  8363. #endif
  8364. #if !CYTHON_COMPILING_IN_LIMITED_API
  8365. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  8366. __pyx_ptype_9fontTools_5qu2cu_5qu2cu___pyx_scope_struct_1_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  8367. }
  8368. #endif
  8369. __Pyx_RefNannyFinishContext();
  8370. return 0;
  8371. __pyx_L1_error:;
  8372. __Pyx_RefNannyFinishContext();
  8373. return -1;
  8374. }
  8375. static int __Pyx_modinit_type_import_code(void) {
  8376. __Pyx_RefNannyDeclarations
  8377. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  8378. /*--- Type import code ---*/
  8379. __Pyx_RefNannyFinishContext();
  8380. return 0;
  8381. }
  8382. static int __Pyx_modinit_variable_import_code(void) {
  8383. __Pyx_RefNannyDeclarations
  8384. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  8385. /*--- Variable import code ---*/
  8386. __Pyx_RefNannyFinishContext();
  8387. return 0;
  8388. }
  8389. static int __Pyx_modinit_function_import_code(void) {
  8390. __Pyx_RefNannyDeclarations
  8391. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  8392. /*--- Function import code ---*/
  8393. __Pyx_RefNannyFinishContext();
  8394. return 0;
  8395. }
  8396. #if PY_MAJOR_VERSION >= 3
  8397. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8398. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  8399. static int __pyx_pymod_exec_qu2cu(PyObject* module); /*proto*/
  8400. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  8401. {Py_mod_create, (void*)__pyx_pymod_create},
  8402. {Py_mod_exec, (void*)__pyx_pymod_exec_qu2cu},
  8403. {0, NULL}
  8404. };
  8405. #endif
  8406. #ifdef __cplusplus
  8407. namespace {
  8408. struct PyModuleDef __pyx_moduledef =
  8409. #else
  8410. static struct PyModuleDef __pyx_moduledef =
  8411. #endif
  8412. {
  8413. PyModuleDef_HEAD_INIT,
  8414. "qu2cu",
  8415. 0, /* m_doc */
  8416. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8417. 0, /* m_size */
  8418. #elif CYTHON_USE_MODULE_STATE
  8419. sizeof(__pyx_mstate), /* m_size */
  8420. #else
  8421. -1, /* m_size */
  8422. #endif
  8423. __pyx_methods /* m_methods */,
  8424. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8425. __pyx_moduledef_slots, /* m_slots */
  8426. #else
  8427. NULL, /* m_reload */
  8428. #endif
  8429. #if CYTHON_USE_MODULE_STATE
  8430. __pyx_m_traverse, /* m_traverse */
  8431. __pyx_m_clear, /* m_clear */
  8432. NULL /* m_free */
  8433. #else
  8434. NULL, /* m_traverse */
  8435. NULL, /* m_clear */
  8436. NULL /* m_free */
  8437. #endif
  8438. };
  8439. #ifdef __cplusplus
  8440. } /* anonymous namespace */
  8441. #endif
  8442. #endif
  8443. #ifndef CYTHON_NO_PYINIT_EXPORT
  8444. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  8445. #elif PY_MAJOR_VERSION < 3
  8446. #ifdef __cplusplus
  8447. #define __Pyx_PyMODINIT_FUNC extern "C" void
  8448. #else
  8449. #define __Pyx_PyMODINIT_FUNC void
  8450. #endif
  8451. #else
  8452. #ifdef __cplusplus
  8453. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  8454. #else
  8455. #define __Pyx_PyMODINIT_FUNC PyObject *
  8456. #endif
  8457. #endif
  8458. #if PY_MAJOR_VERSION < 3
  8459. __Pyx_PyMODINIT_FUNC initqu2cu(void) CYTHON_SMALL_CODE; /*proto*/
  8460. __Pyx_PyMODINIT_FUNC initqu2cu(void)
  8461. #else
  8462. __Pyx_PyMODINIT_FUNC PyInit_qu2cu(void) CYTHON_SMALL_CODE; /*proto*/
  8463. __Pyx_PyMODINIT_FUNC PyInit_qu2cu(void)
  8464. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8465. {
  8466. return PyModuleDef_Init(&__pyx_moduledef);
  8467. }
  8468. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  8469. #if PY_VERSION_HEX >= 0x030700A1
  8470. static PY_INT64_T main_interpreter_id = -1;
  8471. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  8472. if (main_interpreter_id == -1) {
  8473. main_interpreter_id = current_id;
  8474. return (unlikely(current_id == -1)) ? -1 : 0;
  8475. } else if (unlikely(main_interpreter_id != current_id))
  8476. #else
  8477. static PyInterpreterState *main_interpreter = NULL;
  8478. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  8479. if (!main_interpreter) {
  8480. main_interpreter = current_interpreter;
  8481. } else if (unlikely(main_interpreter != current_interpreter))
  8482. #endif
  8483. {
  8484. PyErr_SetString(
  8485. PyExc_ImportError,
  8486. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  8487. return -1;
  8488. }
  8489. return 0;
  8490. }
  8491. #if CYTHON_COMPILING_IN_LIMITED_API
  8492. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
  8493. #else
  8494. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
  8495. #endif
  8496. {
  8497. PyObject *value = PyObject_GetAttrString(spec, from_name);
  8498. int result = 0;
  8499. if (likely(value)) {
  8500. if (allow_none || value != Py_None) {
  8501. #if CYTHON_COMPILING_IN_LIMITED_API
  8502. result = PyModule_AddObject(module, to_name, value);
  8503. #else
  8504. result = PyDict_SetItemString(moddict, to_name, value);
  8505. #endif
  8506. }
  8507. Py_DECREF(value);
  8508. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  8509. PyErr_Clear();
  8510. } else {
  8511. result = -1;
  8512. }
  8513. return result;
  8514. }
  8515. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  8516. PyObject *module = NULL, *moddict, *modname;
  8517. CYTHON_UNUSED_VAR(def);
  8518. if (__Pyx_check_single_interpreter())
  8519. return NULL;
  8520. if (__pyx_m)
  8521. return __Pyx_NewRef(__pyx_m);
  8522. modname = PyObject_GetAttrString(spec, "name");
  8523. if (unlikely(!modname)) goto bad;
  8524. module = PyModule_NewObject(modname);
  8525. Py_DECREF(modname);
  8526. if (unlikely(!module)) goto bad;
  8527. #if CYTHON_COMPILING_IN_LIMITED_API
  8528. moddict = module;
  8529. #else
  8530. moddict = PyModule_GetDict(module);
  8531. if (unlikely(!moddict)) goto bad;
  8532. #endif
  8533. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  8534. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  8535. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  8536. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  8537. return module;
  8538. bad:
  8539. Py_XDECREF(module);
  8540. return NULL;
  8541. }
  8542. static CYTHON_SMALL_CODE int __pyx_pymod_exec_qu2cu(PyObject *__pyx_pyinit_module)
  8543. #endif
  8544. #endif
  8545. {
  8546. int stringtab_initialized = 0;
  8547. #if CYTHON_USE_MODULE_STATE
  8548. int pystate_addmodule_run = 0;
  8549. #endif
  8550. PyObject *__pyx_t_1 = NULL;
  8551. PyObject *__pyx_t_2 = NULL;
  8552. PyObject *__pyx_t_3 = NULL;
  8553. int __pyx_t_4;
  8554. PyObject *__pyx_t_5 = NULL;
  8555. PyObject *__pyx_t_6 = NULL;
  8556. PyObject *__pyx_t_7 = NULL;
  8557. PyObject *__pyx_t_8 = NULL;
  8558. PyObject *__pyx_t_9 = NULL;
  8559. int __pyx_t_10;
  8560. int __pyx_lineno = 0;
  8561. const char *__pyx_filename = NULL;
  8562. int __pyx_clineno = 0;
  8563. __Pyx_RefNannyDeclarations
  8564. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8565. if (__pyx_m) {
  8566. if (__pyx_m == __pyx_pyinit_module) return 0;
  8567. PyErr_SetString(PyExc_RuntimeError, "Module 'qu2cu' has already been imported. Re-initialisation is not supported.");
  8568. return -1;
  8569. }
  8570. #elif PY_MAJOR_VERSION >= 3
  8571. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  8572. #endif
  8573. /*--- Module creation code ---*/
  8574. #if CYTHON_PEP489_MULTI_PHASE_INIT
  8575. __pyx_m = __pyx_pyinit_module;
  8576. Py_INCREF(__pyx_m);
  8577. #else
  8578. #if PY_MAJOR_VERSION < 3
  8579. __pyx_m = Py_InitModule4("qu2cu", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  8580. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  8581. #elif CYTHON_USE_MODULE_STATE
  8582. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  8583. {
  8584. int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
  8585. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to qu2cu pseudovariable */
  8586. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  8587. pystate_addmodule_run = 1;
  8588. }
  8589. #else
  8590. __pyx_m = PyModule_Create(&__pyx_moduledef);
  8591. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  8592. #endif
  8593. #endif
  8594. CYTHON_UNUSED_VAR(__pyx_t_1);
  8595. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  8596. Py_INCREF(__pyx_d);
  8597. __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  8598. __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  8599. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8600. #if CYTHON_REFNANNY
  8601. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  8602. if (!__Pyx_RefNanny) {
  8603. PyErr_Clear();
  8604. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  8605. if (!__Pyx_RefNanny)
  8606. Py_FatalError("failed to import 'refnanny' module");
  8607. }
  8608. #endif
  8609. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_qu2cu(void)", 0);
  8610. if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8611. #ifdef __Pxy_PyFrame_Initialize_Offsets
  8612. __Pxy_PyFrame_Initialize_Offsets();
  8613. #endif
  8614. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  8615. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  8616. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  8617. #ifdef __Pyx_CyFunction_USED
  8618. if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8619. #endif
  8620. #ifdef __Pyx_FusedFunction_USED
  8621. if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8622. #endif
  8623. #ifdef __Pyx_Coroutine_USED
  8624. if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8625. #endif
  8626. #ifdef __Pyx_Generator_USED
  8627. if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8628. #endif
  8629. #ifdef __Pyx_AsyncGen_USED
  8630. if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8631. #endif
  8632. #ifdef __Pyx_StopAsyncIteration_USED
  8633. if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8634. #endif
  8635. /*--- Library function declarations ---*/
  8636. /*--- Threads initialization code ---*/
  8637. #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  8638. PyEval_InitThreads();
  8639. #endif
  8640. /*--- Initialize various global constants etc. ---*/
  8641. if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8642. stringtab_initialized = 1;
  8643. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8644. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  8645. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8646. #endif
  8647. if (__pyx_module_is_main_fontTools__qu2cu__qu2cu) {
  8648. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8649. }
  8650. #if PY_MAJOR_VERSION >= 3
  8651. {
  8652. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  8653. if (!PyDict_GetItemString(modules, "fontTools.qu2cu.qu2cu")) {
  8654. if (unlikely((PyDict_SetItemString(modules, "fontTools.qu2cu.qu2cu", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  8655. }
  8656. }
  8657. #endif
  8658. /*--- Builtin init code ---*/
  8659. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8660. /*--- Constants init code ---*/
  8661. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8662. /*--- Global type/function init code ---*/
  8663. (void)__Pyx_modinit_global_init_code();
  8664. (void)__Pyx_modinit_variable_export_code();
  8665. (void)__Pyx_modinit_function_export_code();
  8666. if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  8667. (void)__Pyx_modinit_type_import_code();
  8668. (void)__Pyx_modinit_variable_import_code();
  8669. (void)__Pyx_modinit_function_import_code();
  8670. /*--- Execution code ---*/
  8671. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  8672. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  8673. #endif
  8674. /* "fontTools/qu2cu/qu2cu.py":19
  8675. * # limitations under the License.
  8676. *
  8677. * try: # <<<<<<<<<<<<<<
  8678. * import cython
  8679. *
  8680. */
  8681. {
  8682. __Pyx_PyThreadState_declare
  8683. __Pyx_PyThreadState_assign
  8684. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  8685. __Pyx_XGOTREF(__pyx_t_1);
  8686. __Pyx_XGOTREF(__pyx_t_2);
  8687. __Pyx_XGOTREF(__pyx_t_3);
  8688. /*try:*/ {
  8689. /* "fontTools/qu2cu/qu2cu.py":22
  8690. * import cython
  8691. *
  8692. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  8693. * except (AttributeError, ImportError):
  8694. * # if cython not installed, use mock module with no-op decorators and types
  8695. */
  8696. if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED, Py_True) < 0) __PYX_ERR(0, 22, __pyx_L2_error)
  8697. /* "fontTools/qu2cu/qu2cu.py":19
  8698. * # limitations under the License.
  8699. *
  8700. * try: # <<<<<<<<<<<<<<
  8701. * import cython
  8702. *
  8703. */
  8704. }
  8705. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  8706. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8707. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8708. goto __pyx_L7_try_end;
  8709. __pyx_L2_error:;
  8710. /* "fontTools/qu2cu/qu2cu.py":23
  8711. *
  8712. * COMPILED = cython.compiled
  8713. * except (AttributeError, ImportError): # <<<<<<<<<<<<<<
  8714. * # if cython not installed, use mock module with no-op decorators and types
  8715. * from fontTools.misc import cython
  8716. */
  8717. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_AttributeError, __pyx_builtin_ImportError);
  8718. if (__pyx_t_4) {
  8719. __Pyx_AddTraceback("fontTools.qu2cu.qu2cu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8720. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 23, __pyx_L4_except_error)
  8721. __Pyx_XGOTREF(__pyx_t_5);
  8722. __Pyx_XGOTREF(__pyx_t_6);
  8723. __Pyx_XGOTREF(__pyx_t_7);
  8724. /* "fontTools/qu2cu/qu2cu.py":25
  8725. * except (AttributeError, ImportError):
  8726. * # if cython not installed, use mock module with no-op decorators and types
  8727. * from fontTools.misc import cython # <<<<<<<<<<<<<<
  8728. *
  8729. * COMPILED = False
  8730. */
  8731. __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 25, __pyx_L4_except_error)
  8732. __Pyx_GOTREF(__pyx_t_8);
  8733. __Pyx_INCREF(__pyx_n_s_cython);
  8734. __Pyx_GIVEREF(__pyx_n_s_cython);
  8735. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_cython)) __PYX_ERR(0, 25, __pyx_L4_except_error);
  8736. __pyx_t_9 = __Pyx_Import(__pyx_n_s_fontTools_misc, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L4_except_error)
  8737. __Pyx_GOTREF(__pyx_t_9);
  8738. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  8739. __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_cython); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 25, __pyx_L4_except_error)
  8740. __Pyx_GOTREF(__pyx_t_8);
  8741. if (PyDict_SetItem(__pyx_d, __pyx_n_s_cython, __pyx_t_8) < 0) __PYX_ERR(0, 25, __pyx_L4_except_error)
  8742. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  8743. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8744. /* "fontTools/qu2cu/qu2cu.py":27
  8745. * from fontTools.misc import cython
  8746. *
  8747. * COMPILED = False # <<<<<<<<<<<<<<
  8748. *
  8749. * from fontTools.misc.bezierTools import splitCubicAtTC
  8750. */
  8751. if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED, Py_False) < 0) __PYX_ERR(0, 27, __pyx_L4_except_error)
  8752. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  8753. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  8754. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  8755. goto __pyx_L3_exception_handled;
  8756. }
  8757. goto __pyx_L4_except_error;
  8758. /* "fontTools/qu2cu/qu2cu.py":19
  8759. * # limitations under the License.
  8760. *
  8761. * try: # <<<<<<<<<<<<<<
  8762. * import cython
  8763. *
  8764. */
  8765. __pyx_L4_except_error:;
  8766. __Pyx_XGIVEREF(__pyx_t_1);
  8767. __Pyx_XGIVEREF(__pyx_t_2);
  8768. __Pyx_XGIVEREF(__pyx_t_3);
  8769. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  8770. goto __pyx_L1_error;
  8771. __pyx_L3_exception_handled:;
  8772. __Pyx_XGIVEREF(__pyx_t_1);
  8773. __Pyx_XGIVEREF(__pyx_t_2);
  8774. __Pyx_XGIVEREF(__pyx_t_3);
  8775. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  8776. __pyx_L7_try_end:;
  8777. }
  8778. /* "fontTools/qu2cu/qu2cu.py":29
  8779. * COMPILED = False
  8780. *
  8781. * from fontTools.misc.bezierTools import splitCubicAtTC # <<<<<<<<<<<<<<
  8782. * from collections import namedtuple
  8783. * import math
  8784. */
  8785. __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 29, __pyx_L1_error)
  8786. __Pyx_GOTREF(__pyx_t_7);
  8787. __Pyx_INCREF(__pyx_n_s_splitCubicAtTC);
  8788. __Pyx_GIVEREF(__pyx_n_s_splitCubicAtTC);
  8789. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_splitCubicAtTC)) __PYX_ERR(0, 29, __pyx_L1_error);
  8790. __pyx_t_6 = __Pyx_Import(__pyx_n_s_fontTools_misc_bezierTools, __pyx_t_7, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error)
  8791. __Pyx_GOTREF(__pyx_t_6);
  8792. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8793. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_splitCubicAtTC); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 29, __pyx_L1_error)
  8794. __Pyx_GOTREF(__pyx_t_7);
  8795. if (PyDict_SetItem(__pyx_d, __pyx_n_s_splitCubicAtTC, __pyx_t_7) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  8796. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8797. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8798. /* "fontTools/qu2cu/qu2cu.py":30
  8799. *
  8800. * from fontTools.misc.bezierTools import splitCubicAtTC
  8801. * from collections import namedtuple # <<<<<<<<<<<<<<
  8802. * import math
  8803. * from typing import (
  8804. */
  8805. __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error)
  8806. __Pyx_GOTREF(__pyx_t_6);
  8807. __Pyx_INCREF(__pyx_n_s_namedtuple);
  8808. __Pyx_GIVEREF(__pyx_n_s_namedtuple);
  8809. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_namedtuple)) __PYX_ERR(0, 30, __pyx_L1_error);
  8810. __pyx_t_7 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_6, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 30, __pyx_L1_error)
  8811. __Pyx_GOTREF(__pyx_t_7);
  8812. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8813. __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error)
  8814. __Pyx_GOTREF(__pyx_t_6);
  8815. if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_6) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  8816. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8817. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8818. /* "fontTools/qu2cu/qu2cu.py":31
  8819. * from fontTools.misc.bezierTools import splitCubicAtTC
  8820. * from collections import namedtuple
  8821. * import math # <<<<<<<<<<<<<<
  8822. * from typing import (
  8823. * List,
  8824. */
  8825. __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_math, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
  8826. __Pyx_GOTREF(__pyx_t_7);
  8827. if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_7) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  8828. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8829. /* "fontTools/qu2cu/qu2cu.py":33
  8830. * import math
  8831. * from typing import (
  8832. * List, # <<<<<<<<<<<<<<
  8833. * Tuple,
  8834. * Union,
  8835. */
  8836. __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error)
  8837. __Pyx_GOTREF(__pyx_t_7);
  8838. __Pyx_INCREF(__pyx_n_s_List);
  8839. __Pyx_GIVEREF(__pyx_n_s_List);
  8840. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_List)) __PYX_ERR(0, 33, __pyx_L1_error);
  8841. __Pyx_INCREF(__pyx_n_s_Tuple);
  8842. __Pyx_GIVEREF(__pyx_n_s_Tuple);
  8843. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_Tuple)) __PYX_ERR(0, 33, __pyx_L1_error);
  8844. __Pyx_INCREF(__pyx_n_s_Union);
  8845. __Pyx_GIVEREF(__pyx_n_s_Union);
  8846. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_Union)) __PYX_ERR(0, 33, __pyx_L1_error);
  8847. /* "fontTools/qu2cu/qu2cu.py":32
  8848. * from collections import namedtuple
  8849. * import math
  8850. * from typing import ( # <<<<<<<<<<<<<<
  8851. * List,
  8852. * Tuple,
  8853. */
  8854. __pyx_t_6 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_7, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 32, __pyx_L1_error)
  8855. __Pyx_GOTREF(__pyx_t_6);
  8856. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8857. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_List); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 32, __pyx_L1_error)
  8858. __Pyx_GOTREF(__pyx_t_7);
  8859. if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_7) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  8860. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8861. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 32, __pyx_L1_error)
  8862. __Pyx_GOTREF(__pyx_t_7);
  8863. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_7) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  8864. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8865. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_Union); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 32, __pyx_L1_error)
  8866. __Pyx_GOTREF(__pyx_t_7);
  8867. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  8868. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8869. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8870. /* "fontTools/qu2cu/qu2cu.py":39
  8871. *
  8872. *
  8873. * __all__ = ["quadratic_to_curves"] # <<<<<<<<<<<<<<
  8874. *
  8875. *
  8876. */
  8877. __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error)
  8878. __Pyx_GOTREF(__pyx_t_6);
  8879. __Pyx_INCREF(__pyx_n_u_quadratic_to_curves);
  8880. __Pyx_GIVEREF(__pyx_n_u_quadratic_to_curves);
  8881. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_quadratic_to_curves)) __PYX_ERR(0, 39, __pyx_L1_error);
  8882. if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_6) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  8883. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8884. /* "fontTools/qu2cu/qu2cu.py":85
  8885. *
  8886. *
  8887. * @cython.locals( # <<<<<<<<<<<<<<
  8888. * p0=cython.complex,
  8889. * p1=cython.complex,
  8890. */
  8891. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_5qu2cu_5qu2cu_1elevate_quadratic, 0, __pyx_n_s_elevate_quadratic, NULL, __pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
  8892. __Pyx_GOTREF(__pyx_t_6);
  8893. if (PyDict_SetItem(__pyx_d, __pyx_n_s_elevate_quadratic, __pyx_t_6) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  8894. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8895. /* "fontTools/qu2cu/qu2cu.py":157
  8896. *
  8897. *
  8898. * @cython.locals( # <<<<<<<<<<<<<<
  8899. * count=cython.int,
  8900. * num_offcurves=cython.int,
  8901. */
  8902. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_5qu2cu_5qu2cu_3add_implicit_on_curves, 0, __pyx_n_s_add_implicit_on_curves, NULL, __pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
  8903. __Pyx_GOTREF(__pyx_t_6);
  8904. if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_implicit_on_curves, __pyx_t_6) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  8905. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8906. /* "fontTools/qu2cu/qu2cu.py":178
  8907. *
  8908. *
  8909. * Point = Union[Tuple[float, float], complex] # <<<<<<<<<<<<<<
  8910. *
  8911. *
  8912. */
  8913. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Union); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
  8914. __Pyx_GOTREF(__pyx_t_6);
  8915. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error)
  8916. __Pyx_GOTREF(__pyx_t_7);
  8917. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
  8918. __Pyx_GOTREF(__pyx_t_5);
  8919. __Pyx_INCREF((PyObject *)(&PyFloat_Type));
  8920. __Pyx_GIVEREF((PyObject *)(&PyFloat_Type));
  8921. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyFloat_Type)))) __PYX_ERR(0, 178, __pyx_L1_error);
  8922. __Pyx_INCREF((PyObject *)(&PyFloat_Type));
  8923. __Pyx_GIVEREF((PyObject *)(&PyFloat_Type));
  8924. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyFloat_Type)))) __PYX_ERR(0, 178, __pyx_L1_error);
  8925. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
  8926. __Pyx_GOTREF(__pyx_t_9);
  8927. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8928. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8929. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
  8930. __Pyx_GOTREF(__pyx_t_5);
  8931. __Pyx_GIVEREF(__pyx_t_9);
  8932. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error);
  8933. __Pyx_INCREF((PyObject *)(&PyComplex_Type));
  8934. __Pyx_GIVEREF((PyObject *)(&PyComplex_Type));
  8935. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)(&PyComplex_Type)))) __PYX_ERR(0, 178, __pyx_L1_error);
  8936. __pyx_t_9 = 0;
  8937. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
  8938. __Pyx_GOTREF(__pyx_t_9);
  8939. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8940. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8941. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Point, __pyx_t_9) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
  8942. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8943. /* "fontTools/qu2cu/qu2cu.py":187
  8944. * def quadratic_to_curves(
  8945. * quads: List[List[Point]],
  8946. * max_err: float = 0.5, # <<<<<<<<<<<<<<
  8947. * all_cubic: bool = False,
  8948. * ) -> List[Tuple[Point, ...]]:
  8949. */
  8950. __pyx_t_9 = PyFloat_FromDouble(((double)0.5)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 187, __pyx_L1_error)
  8951. __Pyx_GOTREF(__pyx_t_9);
  8952. /* "fontTools/qu2cu/qu2cu.py":181
  8953. *
  8954. *
  8955. * @cython.locals( # <<<<<<<<<<<<<<
  8956. * cost=cython.int,
  8957. * is_complex=cython.int,
  8958. */
  8959. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 181, __pyx_L1_error)
  8960. __Pyx_GOTREF(__pyx_t_5);
  8961. __Pyx_GIVEREF(__pyx_t_9);
  8962. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error);
  8963. __Pyx_INCREF(((PyObject *)Py_False));
  8964. __Pyx_GIVEREF(((PyObject *)Py_False));
  8965. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)Py_False))) __PYX_ERR(0, 181, __pyx_L1_error);
  8966. __pyx_t_9 = 0;
  8967. __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
  8968. __Pyx_GOTREF(__pyx_t_9);
  8969. if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_quads, __pyx_kp_s_List_List_Point) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  8970. if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_max_err, __pyx_n_s_float) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  8971. if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_all_cubic, __pyx_n_s_bool) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  8972. if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_return, __pyx_kp_s_List_Tuple_Point) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  8973. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_5qu2cu_5qu2cu_5quadratic_to_curves, 0, __pyx_n_s_quadratic_to_curves, NULL, __pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error)
  8974. __Pyx_GOTREF(__pyx_t_6);
  8975. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_5);
  8976. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_9);
  8977. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8978. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8979. if (PyDict_SetItem(__pyx_d, __pyx_n_s_quadratic_to_curves, __pyx_t_6) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
  8980. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8981. /* "fontTools/qu2cu/qu2cu.py":242
  8982. *
  8983. *
  8984. * Solution = namedtuple("Solution", ["num_points", "error", "start_index", "is_cubic"]) # <<<<<<<<<<<<<<
  8985. *
  8986. *
  8987. */
  8988. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
  8989. __Pyx_GOTREF(__pyx_t_6);
  8990. __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 242, __pyx_L1_error)
  8991. __Pyx_GOTREF(__pyx_t_9);
  8992. __Pyx_INCREF(__pyx_n_u_num_points);
  8993. __Pyx_GIVEREF(__pyx_n_u_num_points);
  8994. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_n_u_num_points)) __PYX_ERR(0, 242, __pyx_L1_error);
  8995. __Pyx_INCREF(__pyx_n_u_error);
  8996. __Pyx_GIVEREF(__pyx_n_u_error);
  8997. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_n_u_error)) __PYX_ERR(0, 242, __pyx_L1_error);
  8998. __Pyx_INCREF(__pyx_n_u_start_index);
  8999. __Pyx_GIVEREF(__pyx_n_u_start_index);
  9000. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_n_u_start_index)) __PYX_ERR(0, 242, __pyx_L1_error);
  9001. __Pyx_INCREF(__pyx_n_u_is_cubic);
  9002. __Pyx_GIVEREF(__pyx_n_u_is_cubic);
  9003. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_n_u_is_cubic)) __PYX_ERR(0, 242, __pyx_L1_error);
  9004. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error)
  9005. __Pyx_GOTREF(__pyx_t_5);
  9006. __Pyx_INCREF(__pyx_n_u_Solution);
  9007. __Pyx_GIVEREF(__pyx_n_u_Solution);
  9008. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_Solution)) __PYX_ERR(0, 242, __pyx_L1_error);
  9009. __Pyx_GIVEREF(__pyx_t_9);
  9010. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_9)) __PYX_ERR(0, 242, __pyx_L1_error);
  9011. __pyx_t_9 = 0;
  9012. __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 242, __pyx_L1_error)
  9013. __Pyx_GOTREF(__pyx_t_9);
  9014. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9015. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9016. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Solution, __pyx_t_9) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
  9017. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9018. /* "fontTools/qu2cu/qu2cu.py":268
  9019. * u=cython.complex,
  9020. * )
  9021. * def spline_to_curves(q, costs, tolerance=0.5, all_cubic=False): # <<<<<<<<<<<<<<
  9022. * """
  9023. * q: quadratic spline with alternating on-curve / off-curve points.
  9024. */
  9025. __pyx_t_9 = PyFloat_FromDouble(((double)0.5)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 268, __pyx_L1_error)
  9026. __Pyx_GOTREF(__pyx_t_9);
  9027. __pyx_t_5 = __Pyx_PyBool_FromLong(((int)0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
  9028. __Pyx_GOTREF(__pyx_t_5);
  9029. /* "fontTools/qu2cu/qu2cu.py":245
  9030. *
  9031. *
  9032. * @cython.locals( # <<<<<<<<<<<<<<
  9033. * i=cython.int,
  9034. * j=cython.int,
  9035. */
  9036. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error)
  9037. __Pyx_GOTREF(__pyx_t_6);
  9038. __Pyx_GIVEREF(__pyx_t_9);
  9039. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9)) __PYX_ERR(0, 245, __pyx_L1_error);
  9040. __Pyx_GIVEREF(__pyx_t_5);
  9041. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error);
  9042. __pyx_t_9 = 0;
  9043. __pyx_t_5 = 0;
  9044. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_5qu2cu_5qu2cu_7spline_to_curves, 0, __pyx_n_s_spline_to_curves, NULL, __pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
  9045. __Pyx_GOTREF(__pyx_t_5);
  9046. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_6);
  9047. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9048. if (PyDict_SetItem(__pyx_d, __pyx_n_s_spline_to_curves, __pyx_t_5) < 0) __PYX_ERR(0, 245, __pyx_L1_error)
  9049. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9050. /* "fontTools/qu2cu/qu2cu.py":389
  9051. *
  9052. *
  9053. * def main(): # <<<<<<<<<<<<<<
  9054. * from fontTools.cu2qu.benchmark import generate_curve
  9055. * from fontTools.cu2qu import curve_to_quadratic
  9056. */
  9057. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_5qu2cu_5qu2cu_9main, 0, __pyx_n_s_main_2, NULL, __pyx_n_s_fontTools_qu2cu_qu2cu, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 389, __pyx_L1_error)
  9058. __Pyx_GOTREF(__pyx_t_5);
  9059. if (PyDict_SetItem(__pyx_d, __pyx_n_s_main_2, __pyx_t_5) < 0) __PYX_ERR(0, 389, __pyx_L1_error)
  9060. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9061. /* "fontTools/qu2cu/qu2cu.py":407
  9062. *
  9063. *
  9064. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  9065. * main()
  9066. */
  9067. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L1_error)
  9068. __Pyx_GOTREF(__pyx_t_5);
  9069. __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_main, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 407, __pyx_L1_error)
  9070. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9071. if (__pyx_t_10) {
  9072. /* "fontTools/qu2cu/qu2cu.py":408
  9073. *
  9074. * if __name__ == "__main__":
  9075. * main() # <<<<<<<<<<<<<<
  9076. */
  9077. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_main_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error)
  9078. __Pyx_GOTREF(__pyx_t_5);
  9079. __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 408, __pyx_L1_error)
  9080. __Pyx_GOTREF(__pyx_t_6);
  9081. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9082. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9083. /* "fontTools/qu2cu/qu2cu.py":407
  9084. *
  9085. *
  9086. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  9087. * main()
  9088. */
  9089. }
  9090. /* "fontTools/qu2cu/qu2cu.py":1
  9091. * # cython: language_level=3 # <<<<<<<<<<<<<<
  9092. * # distutils: define_macros=CYTHON_TRACE_NOGIL=1
  9093. *
  9094. */
  9095. __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  9096. __Pyx_GOTREF(__pyx_t_6);
  9097. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_6) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  9098. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9099. /*--- Wrapped vars code ---*/
  9100. goto __pyx_L0;
  9101. __pyx_L1_error:;
  9102. __Pyx_XDECREF(__pyx_t_5);
  9103. __Pyx_XDECREF(__pyx_t_6);
  9104. __Pyx_XDECREF(__pyx_t_7);
  9105. __Pyx_XDECREF(__pyx_t_8);
  9106. __Pyx_XDECREF(__pyx_t_9);
  9107. if (__pyx_m) {
  9108. if (__pyx_d && stringtab_initialized) {
  9109. __Pyx_AddTraceback("init fontTools.qu2cu.qu2cu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9110. }
  9111. #if !CYTHON_USE_MODULE_STATE
  9112. Py_CLEAR(__pyx_m);
  9113. #else
  9114. Py_DECREF(__pyx_m);
  9115. if (pystate_addmodule_run) {
  9116. PyObject *tp, *value, *tb;
  9117. PyErr_Fetch(&tp, &value, &tb);
  9118. PyState_RemoveModule(&__pyx_moduledef);
  9119. PyErr_Restore(tp, value, tb);
  9120. }
  9121. #endif
  9122. } else if (!PyErr_Occurred()) {
  9123. PyErr_SetString(PyExc_ImportError, "init fontTools.qu2cu.qu2cu");
  9124. }
  9125. __pyx_L0:;
  9126. __Pyx_RefNannyFinishContext();
  9127. #if CYTHON_PEP489_MULTI_PHASE_INIT
  9128. return (__pyx_m != NULL) ? 0 : -1;
  9129. #elif PY_MAJOR_VERSION >= 3
  9130. return __pyx_m;
  9131. #else
  9132. return;
  9133. #endif
  9134. }
  9135. /* #### Code section: cleanup_globals ### */
  9136. /* #### Code section: cleanup_module ### */
  9137. /* #### Code section: main_method ### */
  9138. /* #### Code section: utility_code_pragmas ### */
  9139. #ifdef _MSC_VER
  9140. #pragma warning( push )
  9141. /* Warning 4127: conditional expression is constant
  9142. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  9143. * compile-time, so this warning is not useful
  9144. */
  9145. #pragma warning( disable : 4127 )
  9146. #endif
  9147. /* #### Code section: utility_code_def ### */
  9148. /* --- Runtime support code --- */
  9149. /* Refnanny */
  9150. #if CYTHON_REFNANNY
  9151. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  9152. PyObject *m = NULL, *p = NULL;
  9153. void *r = NULL;
  9154. m = PyImport_ImportModule(modname);
  9155. if (!m) goto end;
  9156. p = PyObject_GetAttrString(m, "RefNannyAPI");
  9157. if (!p) goto end;
  9158. r = PyLong_AsVoidPtr(p);
  9159. end:
  9160. Py_XDECREF(p);
  9161. Py_XDECREF(m);
  9162. return (__Pyx_RefNannyAPIStruct *)r;
  9163. }
  9164. #endif
  9165. /* PyErrExceptionMatches */
  9166. #if CYTHON_FAST_THREAD_STATE
  9167. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  9168. Py_ssize_t i, n;
  9169. n = PyTuple_GET_SIZE(tuple);
  9170. #if PY_MAJOR_VERSION >= 3
  9171. for (i=0; i<n; i++) {
  9172. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  9173. }
  9174. #endif
  9175. for (i=0; i<n; i++) {
  9176. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  9177. }
  9178. return 0;
  9179. }
  9180. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  9181. int result;
  9182. PyObject *exc_type;
  9183. #if PY_VERSION_HEX >= 0x030C00A6
  9184. PyObject *current_exception = tstate->current_exception;
  9185. if (unlikely(!current_exception)) return 0;
  9186. exc_type = (PyObject*) Py_TYPE(current_exception);
  9187. if (exc_type == err) return 1;
  9188. #else
  9189. exc_type = tstate->curexc_type;
  9190. if (exc_type == err) return 1;
  9191. if (unlikely(!exc_type)) return 0;
  9192. #endif
  9193. #if CYTHON_AVOID_BORROWED_REFS
  9194. Py_INCREF(exc_type);
  9195. #endif
  9196. if (unlikely(PyTuple_Check(err))) {
  9197. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  9198. } else {
  9199. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  9200. }
  9201. #if CYTHON_AVOID_BORROWED_REFS
  9202. Py_DECREF(exc_type);
  9203. #endif
  9204. return result;
  9205. }
  9206. #endif
  9207. /* PyErrFetchRestore */
  9208. #if CYTHON_FAST_THREAD_STATE
  9209. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  9210. #if PY_VERSION_HEX >= 0x030C00A6
  9211. PyObject *tmp_value;
  9212. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  9213. if (value) {
  9214. #if CYTHON_COMPILING_IN_CPYTHON
  9215. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  9216. #endif
  9217. PyException_SetTraceback(value, tb);
  9218. }
  9219. tmp_value = tstate->current_exception;
  9220. tstate->current_exception = value;
  9221. Py_XDECREF(tmp_value);
  9222. Py_XDECREF(type);
  9223. Py_XDECREF(tb);
  9224. #else
  9225. PyObject *tmp_type, *tmp_value, *tmp_tb;
  9226. tmp_type = tstate->curexc_type;
  9227. tmp_value = tstate->curexc_value;
  9228. tmp_tb = tstate->curexc_traceback;
  9229. tstate->curexc_type = type;
  9230. tstate->curexc_value = value;
  9231. tstate->curexc_traceback = tb;
  9232. Py_XDECREF(tmp_type);
  9233. Py_XDECREF(tmp_value);
  9234. Py_XDECREF(tmp_tb);
  9235. #endif
  9236. }
  9237. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  9238. #if PY_VERSION_HEX >= 0x030C00A6
  9239. PyObject* exc_value;
  9240. exc_value = tstate->current_exception;
  9241. tstate->current_exception = 0;
  9242. *value = exc_value;
  9243. *type = NULL;
  9244. *tb = NULL;
  9245. if (exc_value) {
  9246. *type = (PyObject*) Py_TYPE(exc_value);
  9247. Py_INCREF(*type);
  9248. #if CYTHON_COMPILING_IN_CPYTHON
  9249. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  9250. Py_XINCREF(*tb);
  9251. #else
  9252. *tb = PyException_GetTraceback(exc_value);
  9253. #endif
  9254. }
  9255. #else
  9256. *type = tstate->curexc_type;
  9257. *value = tstate->curexc_value;
  9258. *tb = tstate->curexc_traceback;
  9259. tstate->curexc_type = 0;
  9260. tstate->curexc_value = 0;
  9261. tstate->curexc_traceback = 0;
  9262. #endif
  9263. }
  9264. #endif
  9265. /* PyObjectGetAttrStr */
  9266. #if CYTHON_USE_TYPE_SLOTS
  9267. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  9268. PyTypeObject* tp = Py_TYPE(obj);
  9269. if (likely(tp->tp_getattro))
  9270. return tp->tp_getattro(obj, attr_name);
  9271. #if PY_MAJOR_VERSION < 3
  9272. if (likely(tp->tp_getattr))
  9273. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  9274. #endif
  9275. return PyObject_GetAttr(obj, attr_name);
  9276. }
  9277. #endif
  9278. /* PyObjectGetAttrStrNoError */
  9279. #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
  9280. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  9281. __Pyx_PyThreadState_declare
  9282. __Pyx_PyThreadState_assign
  9283. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  9284. __Pyx_PyErr_Clear();
  9285. }
  9286. #endif
  9287. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  9288. PyObject *result;
  9289. #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
  9290. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  9291. return result;
  9292. #else
  9293. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
  9294. PyTypeObject* tp = Py_TYPE(obj);
  9295. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  9296. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  9297. }
  9298. #endif
  9299. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  9300. if (unlikely(!result)) {
  9301. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  9302. }
  9303. return result;
  9304. #endif
  9305. }
  9306. /* GetBuiltinName */
  9307. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  9308. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
  9309. if (unlikely(!result) && !PyErr_Occurred()) {
  9310. PyErr_Format(PyExc_NameError,
  9311. #if PY_MAJOR_VERSION >= 3
  9312. "name '%U' is not defined", name);
  9313. #else
  9314. "name '%.200s' is not defined", PyString_AS_STRING(name));
  9315. #endif
  9316. }
  9317. return result;
  9318. }
  9319. /* TupleAndListFromArray */
  9320. #if CYTHON_COMPILING_IN_CPYTHON
  9321. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  9322. PyObject *v;
  9323. Py_ssize_t i;
  9324. for (i = 0; i < length; i++) {
  9325. v = dest[i] = src[i];
  9326. Py_INCREF(v);
  9327. }
  9328. }
  9329. static CYTHON_INLINE PyObject *
  9330. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  9331. {
  9332. PyObject *res;
  9333. if (n <= 0) {
  9334. Py_INCREF(__pyx_empty_tuple);
  9335. return __pyx_empty_tuple;
  9336. }
  9337. res = PyTuple_New(n);
  9338. if (unlikely(res == NULL)) return NULL;
  9339. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  9340. return res;
  9341. }
  9342. static CYTHON_INLINE PyObject *
  9343. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  9344. {
  9345. PyObject *res;
  9346. if (n <= 0) {
  9347. return PyList_New(0);
  9348. }
  9349. res = PyList_New(n);
  9350. if (unlikely(res == NULL)) return NULL;
  9351. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  9352. return res;
  9353. }
  9354. #endif
  9355. /* BytesEquals */
  9356. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  9357. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  9358. return PyObject_RichCompareBool(s1, s2, equals);
  9359. #else
  9360. if (s1 == s2) {
  9361. return (equals == Py_EQ);
  9362. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  9363. const char *ps1, *ps2;
  9364. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  9365. if (length != PyBytes_GET_SIZE(s2))
  9366. return (equals == Py_NE);
  9367. ps1 = PyBytes_AS_STRING(s1);
  9368. ps2 = PyBytes_AS_STRING(s2);
  9369. if (ps1[0] != ps2[0]) {
  9370. return (equals == Py_NE);
  9371. } else if (length == 1) {
  9372. return (equals == Py_EQ);
  9373. } else {
  9374. int result;
  9375. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  9376. Py_hash_t hash1, hash2;
  9377. hash1 = ((PyBytesObject*)s1)->ob_shash;
  9378. hash2 = ((PyBytesObject*)s2)->ob_shash;
  9379. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  9380. return (equals == Py_NE);
  9381. }
  9382. #endif
  9383. result = memcmp(ps1, ps2, (size_t)length);
  9384. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  9385. }
  9386. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  9387. return (equals == Py_NE);
  9388. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  9389. return (equals == Py_NE);
  9390. } else {
  9391. int result;
  9392. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  9393. if (!py_result)
  9394. return -1;
  9395. result = __Pyx_PyObject_IsTrue(py_result);
  9396. Py_DECREF(py_result);
  9397. return result;
  9398. }
  9399. #endif
  9400. }
  9401. /* UnicodeEquals */
  9402. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  9403. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  9404. return PyObject_RichCompareBool(s1, s2, equals);
  9405. #else
  9406. #if PY_MAJOR_VERSION < 3
  9407. PyObject* owned_ref = NULL;
  9408. #endif
  9409. int s1_is_unicode, s2_is_unicode;
  9410. if (s1 == s2) {
  9411. goto return_eq;
  9412. }
  9413. s1_is_unicode = PyUnicode_CheckExact(s1);
  9414. s2_is_unicode = PyUnicode_CheckExact(s2);
  9415. #if PY_MAJOR_VERSION < 3
  9416. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  9417. owned_ref = PyUnicode_FromObject(s2);
  9418. if (unlikely(!owned_ref))
  9419. return -1;
  9420. s2 = owned_ref;
  9421. s2_is_unicode = 1;
  9422. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  9423. owned_ref = PyUnicode_FromObject(s1);
  9424. if (unlikely(!owned_ref))
  9425. return -1;
  9426. s1 = owned_ref;
  9427. s1_is_unicode = 1;
  9428. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  9429. return __Pyx_PyBytes_Equals(s1, s2, equals);
  9430. }
  9431. #endif
  9432. if (s1_is_unicode & s2_is_unicode) {
  9433. Py_ssize_t length;
  9434. int kind;
  9435. void *data1, *data2;
  9436. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  9437. return -1;
  9438. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  9439. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  9440. goto return_ne;
  9441. }
  9442. #if CYTHON_USE_UNICODE_INTERNALS
  9443. {
  9444. Py_hash_t hash1, hash2;
  9445. #if CYTHON_PEP393_ENABLED
  9446. hash1 = ((PyASCIIObject*)s1)->hash;
  9447. hash2 = ((PyASCIIObject*)s2)->hash;
  9448. #else
  9449. hash1 = ((PyUnicodeObject*)s1)->hash;
  9450. hash2 = ((PyUnicodeObject*)s2)->hash;
  9451. #endif
  9452. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  9453. goto return_ne;
  9454. }
  9455. }
  9456. #endif
  9457. kind = __Pyx_PyUnicode_KIND(s1);
  9458. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  9459. goto return_ne;
  9460. }
  9461. data1 = __Pyx_PyUnicode_DATA(s1);
  9462. data2 = __Pyx_PyUnicode_DATA(s2);
  9463. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  9464. goto return_ne;
  9465. } else if (length == 1) {
  9466. goto return_eq;
  9467. } else {
  9468. int result = memcmp(data1, data2, (size_t)(length * kind));
  9469. #if PY_MAJOR_VERSION < 3
  9470. Py_XDECREF(owned_ref);
  9471. #endif
  9472. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  9473. }
  9474. } else if ((s1 == Py_None) & s2_is_unicode) {
  9475. goto return_ne;
  9476. } else if ((s2 == Py_None) & s1_is_unicode) {
  9477. goto return_ne;
  9478. } else {
  9479. int result;
  9480. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  9481. #if PY_MAJOR_VERSION < 3
  9482. Py_XDECREF(owned_ref);
  9483. #endif
  9484. if (!py_result)
  9485. return -1;
  9486. result = __Pyx_PyObject_IsTrue(py_result);
  9487. Py_DECREF(py_result);
  9488. return result;
  9489. }
  9490. return_eq:
  9491. #if PY_MAJOR_VERSION < 3
  9492. Py_XDECREF(owned_ref);
  9493. #endif
  9494. return (equals == Py_EQ);
  9495. return_ne:
  9496. #if PY_MAJOR_VERSION < 3
  9497. Py_XDECREF(owned_ref);
  9498. #endif
  9499. return (equals == Py_NE);
  9500. #endif
  9501. }
  9502. /* fastcall */
  9503. #if CYTHON_METH_FASTCALL
  9504. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  9505. {
  9506. Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
  9507. for (i = 0; i < n; i++)
  9508. {
  9509. if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
  9510. }
  9511. for (i = 0; i < n; i++)
  9512. {
  9513. int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
  9514. if (unlikely(eq != 0)) {
  9515. if (unlikely(eq < 0)) return NULL; // error
  9516. return kwvalues[i];
  9517. }
  9518. }
  9519. return NULL; // not found (no exception set)
  9520. }
  9521. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  9522. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  9523. Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
  9524. PyObject *dict;
  9525. dict = PyDict_New();
  9526. if (unlikely(!dict))
  9527. return NULL;
  9528. for (i=0; i<nkwargs; i++) {
  9529. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  9530. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  9531. goto bad;
  9532. }
  9533. return dict;
  9534. bad:
  9535. Py_DECREF(dict);
  9536. return NULL;
  9537. }
  9538. #endif
  9539. #endif
  9540. /* RaiseArgTupleInvalid */
  9541. static void __Pyx_RaiseArgtupleInvalid(
  9542. const char* func_name,
  9543. int exact,
  9544. Py_ssize_t num_min,
  9545. Py_ssize_t num_max,
  9546. Py_ssize_t num_found)
  9547. {
  9548. Py_ssize_t num_expected;
  9549. const char *more_or_less;
  9550. if (num_found < num_min) {
  9551. num_expected = num_min;
  9552. more_or_less = "at least";
  9553. } else {
  9554. num_expected = num_max;
  9555. more_or_less = "at most";
  9556. }
  9557. if (exact) {
  9558. more_or_less = "exactly";
  9559. }
  9560. PyErr_Format(PyExc_TypeError,
  9561. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  9562. func_name, more_or_less, num_expected,
  9563. (num_expected == 1) ? "" : "s", num_found);
  9564. }
  9565. /* RaiseDoubleKeywords */
  9566. static void __Pyx_RaiseDoubleKeywordsError(
  9567. const char* func_name,
  9568. PyObject* kw_name)
  9569. {
  9570. PyErr_Format(PyExc_TypeError,
  9571. #if PY_MAJOR_VERSION >= 3
  9572. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  9573. #else
  9574. "%s() got multiple values for keyword argument '%s'", func_name,
  9575. PyString_AsString(kw_name));
  9576. #endif
  9577. }
  9578. /* ParseKeywords */
  9579. static int __Pyx_ParseOptionalKeywords(
  9580. PyObject *kwds,
  9581. PyObject *const *kwvalues,
  9582. PyObject **argnames[],
  9583. PyObject *kwds2,
  9584. PyObject *values[],
  9585. Py_ssize_t num_pos_args,
  9586. const char* function_name)
  9587. {
  9588. PyObject *key = 0, *value = 0;
  9589. Py_ssize_t pos = 0;
  9590. PyObject*** name;
  9591. PyObject*** first_kw_arg = argnames + num_pos_args;
  9592. int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
  9593. while (1) {
  9594. Py_XDECREF(key); key = NULL;
  9595. Py_XDECREF(value); value = NULL;
  9596. if (kwds_is_tuple) {
  9597. Py_ssize_t size;
  9598. #if CYTHON_ASSUME_SAFE_MACROS
  9599. size = PyTuple_GET_SIZE(kwds);
  9600. #else
  9601. size = PyTuple_Size(kwds);
  9602. if (size < 0) goto bad;
  9603. #endif
  9604. if (pos >= size) break;
  9605. #if CYTHON_AVOID_BORROWED_REFS
  9606. key = __Pyx_PySequence_ITEM(kwds, pos);
  9607. if (!key) goto bad;
  9608. #elif CYTHON_ASSUME_SAFE_MACROS
  9609. key = PyTuple_GET_ITEM(kwds, pos);
  9610. #else
  9611. key = PyTuple_GetItem(kwds, pos);
  9612. if (!key) goto bad;
  9613. #endif
  9614. value = kwvalues[pos];
  9615. pos++;
  9616. }
  9617. else
  9618. {
  9619. if (!PyDict_Next(kwds, &pos, &key, &value)) break;
  9620. #if CYTHON_AVOID_BORROWED_REFS
  9621. Py_INCREF(key);
  9622. #endif
  9623. }
  9624. name = first_kw_arg;
  9625. while (*name && (**name != key)) name++;
  9626. if (*name) {
  9627. values[name-argnames] = value;
  9628. #if CYTHON_AVOID_BORROWED_REFS
  9629. Py_INCREF(value); // transfer ownership of value to values
  9630. Py_DECREF(key);
  9631. #endif
  9632. key = NULL;
  9633. value = NULL;
  9634. continue;
  9635. }
  9636. #if !CYTHON_AVOID_BORROWED_REFS
  9637. Py_INCREF(key);
  9638. #endif
  9639. Py_INCREF(value);
  9640. name = first_kw_arg;
  9641. #if PY_MAJOR_VERSION < 3
  9642. if (likely(PyString_Check(key))) {
  9643. while (*name) {
  9644. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  9645. && _PyString_Eq(**name, key)) {
  9646. values[name-argnames] = value;
  9647. #if CYTHON_AVOID_BORROWED_REFS
  9648. value = NULL; // ownership transferred to values
  9649. #endif
  9650. break;
  9651. }
  9652. name++;
  9653. }
  9654. if (*name) continue;
  9655. else {
  9656. PyObject*** argname = argnames;
  9657. while (argname != first_kw_arg) {
  9658. if ((**argname == key) || (
  9659. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  9660. && _PyString_Eq(**argname, key))) {
  9661. goto arg_passed_twice;
  9662. }
  9663. argname++;
  9664. }
  9665. }
  9666. } else
  9667. #endif
  9668. if (likely(PyUnicode_Check(key))) {
  9669. while (*name) {
  9670. int cmp = (
  9671. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  9672. (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  9673. #endif
  9674. PyUnicode_Compare(**name, key)
  9675. );
  9676. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  9677. if (cmp == 0) {
  9678. values[name-argnames] = value;
  9679. #if CYTHON_AVOID_BORROWED_REFS
  9680. value = NULL; // ownership transferred to values
  9681. #endif
  9682. break;
  9683. }
  9684. name++;
  9685. }
  9686. if (*name) continue;
  9687. else {
  9688. PyObject*** argname = argnames;
  9689. while (argname != first_kw_arg) {
  9690. int cmp = (**argname == key) ? 0 :
  9691. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  9692. (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  9693. #endif
  9694. PyUnicode_Compare(**argname, key);
  9695. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  9696. if (cmp == 0) goto arg_passed_twice;
  9697. argname++;
  9698. }
  9699. }
  9700. } else
  9701. goto invalid_keyword_type;
  9702. if (kwds2) {
  9703. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  9704. } else {
  9705. goto invalid_keyword;
  9706. }
  9707. }
  9708. Py_XDECREF(key);
  9709. Py_XDECREF(value);
  9710. return 0;
  9711. arg_passed_twice:
  9712. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  9713. goto bad;
  9714. invalid_keyword_type:
  9715. PyErr_Format(PyExc_TypeError,
  9716. "%.200s() keywords must be strings", function_name);
  9717. goto bad;
  9718. invalid_keyword:
  9719. #if PY_MAJOR_VERSION < 3
  9720. PyErr_Format(PyExc_TypeError,
  9721. "%.200s() got an unexpected keyword argument '%.200s'",
  9722. function_name, PyString_AsString(key));
  9723. #else
  9724. PyErr_Format(PyExc_TypeError,
  9725. "%s() got an unexpected keyword argument '%U'",
  9726. function_name, key);
  9727. #endif
  9728. bad:
  9729. Py_XDECREF(key);
  9730. Py_XDECREF(value);
  9731. return -1;
  9732. }
  9733. /* GetItemInt */
  9734. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  9735. PyObject *r;
  9736. if (unlikely(!j)) return NULL;
  9737. r = PyObject_GetItem(o, j);
  9738. Py_DECREF(j);
  9739. return r;
  9740. }
  9741. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  9742. CYTHON_NCP_UNUSED int wraparound,
  9743. CYTHON_NCP_UNUSED int boundscheck) {
  9744. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9745. Py_ssize_t wrapped_i = i;
  9746. if (wraparound & unlikely(i < 0)) {
  9747. wrapped_i += PyList_GET_SIZE(o);
  9748. }
  9749. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  9750. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  9751. Py_INCREF(r);
  9752. return r;
  9753. }
  9754. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9755. #else
  9756. return PySequence_GetItem(o, i);
  9757. #endif
  9758. }
  9759. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  9760. CYTHON_NCP_UNUSED int wraparound,
  9761. CYTHON_NCP_UNUSED int boundscheck) {
  9762. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9763. Py_ssize_t wrapped_i = i;
  9764. if (wraparound & unlikely(i < 0)) {
  9765. wrapped_i += PyTuple_GET_SIZE(o);
  9766. }
  9767. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  9768. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  9769. Py_INCREF(r);
  9770. return r;
  9771. }
  9772. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9773. #else
  9774. return PySequence_GetItem(o, i);
  9775. #endif
  9776. }
  9777. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  9778. CYTHON_NCP_UNUSED int wraparound,
  9779. CYTHON_NCP_UNUSED int boundscheck) {
  9780. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  9781. if (is_list || PyList_CheckExact(o)) {
  9782. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  9783. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  9784. PyObject *r = PyList_GET_ITEM(o, n);
  9785. Py_INCREF(r);
  9786. return r;
  9787. }
  9788. }
  9789. else if (PyTuple_CheckExact(o)) {
  9790. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  9791. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  9792. PyObject *r = PyTuple_GET_ITEM(o, n);
  9793. Py_INCREF(r);
  9794. return r;
  9795. }
  9796. } else {
  9797. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  9798. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  9799. if (mm && mm->mp_subscript) {
  9800. PyObject *r, *key = PyInt_FromSsize_t(i);
  9801. if (unlikely(!key)) return NULL;
  9802. r = mm->mp_subscript(o, key);
  9803. Py_DECREF(key);
  9804. return r;
  9805. }
  9806. if (likely(sm && sm->sq_item)) {
  9807. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  9808. Py_ssize_t l = sm->sq_length(o);
  9809. if (likely(l >= 0)) {
  9810. i += l;
  9811. } else {
  9812. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  9813. return NULL;
  9814. PyErr_Clear();
  9815. }
  9816. }
  9817. return sm->sq_item(o, i);
  9818. }
  9819. }
  9820. #else
  9821. if (is_list || !PyMapping_Check(o)) {
  9822. return PySequence_GetItem(o, i);
  9823. }
  9824. #endif
  9825. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  9826. }
  9827. /* RaiseException */
  9828. #if PY_MAJOR_VERSION < 3
  9829. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  9830. __Pyx_PyThreadState_declare
  9831. CYTHON_UNUSED_VAR(cause);
  9832. Py_XINCREF(type);
  9833. if (!value || value == Py_None)
  9834. value = NULL;
  9835. else
  9836. Py_INCREF(value);
  9837. if (!tb || tb == Py_None)
  9838. tb = NULL;
  9839. else {
  9840. Py_INCREF(tb);
  9841. if (!PyTraceBack_Check(tb)) {
  9842. PyErr_SetString(PyExc_TypeError,
  9843. "raise: arg 3 must be a traceback or None");
  9844. goto raise_error;
  9845. }
  9846. }
  9847. if (PyType_Check(type)) {
  9848. #if CYTHON_COMPILING_IN_PYPY
  9849. if (!value) {
  9850. Py_INCREF(Py_None);
  9851. value = Py_None;
  9852. }
  9853. #endif
  9854. PyErr_NormalizeException(&type, &value, &tb);
  9855. } else {
  9856. if (value) {
  9857. PyErr_SetString(PyExc_TypeError,
  9858. "instance exception may not have a separate value");
  9859. goto raise_error;
  9860. }
  9861. value = type;
  9862. type = (PyObject*) Py_TYPE(type);
  9863. Py_INCREF(type);
  9864. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  9865. PyErr_SetString(PyExc_TypeError,
  9866. "raise: exception class must be a subclass of BaseException");
  9867. goto raise_error;
  9868. }
  9869. }
  9870. __Pyx_PyThreadState_assign
  9871. __Pyx_ErrRestore(type, value, tb);
  9872. return;
  9873. raise_error:
  9874. Py_XDECREF(value);
  9875. Py_XDECREF(type);
  9876. Py_XDECREF(tb);
  9877. return;
  9878. }
  9879. #else
  9880. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  9881. PyObject* owned_instance = NULL;
  9882. if (tb == Py_None) {
  9883. tb = 0;
  9884. } else if (tb && !PyTraceBack_Check(tb)) {
  9885. PyErr_SetString(PyExc_TypeError,
  9886. "raise: arg 3 must be a traceback or None");
  9887. goto bad;
  9888. }
  9889. if (value == Py_None)
  9890. value = 0;
  9891. if (PyExceptionInstance_Check(type)) {
  9892. if (value) {
  9893. PyErr_SetString(PyExc_TypeError,
  9894. "instance exception may not have a separate value");
  9895. goto bad;
  9896. }
  9897. value = type;
  9898. type = (PyObject*) Py_TYPE(value);
  9899. } else if (PyExceptionClass_Check(type)) {
  9900. PyObject *instance_class = NULL;
  9901. if (value && PyExceptionInstance_Check(value)) {
  9902. instance_class = (PyObject*) Py_TYPE(value);
  9903. if (instance_class != type) {
  9904. int is_subclass = PyObject_IsSubclass(instance_class, type);
  9905. if (!is_subclass) {
  9906. instance_class = NULL;
  9907. } else if (unlikely(is_subclass == -1)) {
  9908. goto bad;
  9909. } else {
  9910. type = instance_class;
  9911. }
  9912. }
  9913. }
  9914. if (!instance_class) {
  9915. PyObject *args;
  9916. if (!value)
  9917. args = PyTuple_New(0);
  9918. else if (PyTuple_Check(value)) {
  9919. Py_INCREF(value);
  9920. args = value;
  9921. } else
  9922. args = PyTuple_Pack(1, value);
  9923. if (!args)
  9924. goto bad;
  9925. owned_instance = PyObject_Call(type, args, NULL);
  9926. Py_DECREF(args);
  9927. if (!owned_instance)
  9928. goto bad;
  9929. value = owned_instance;
  9930. if (!PyExceptionInstance_Check(value)) {
  9931. PyErr_Format(PyExc_TypeError,
  9932. "calling %R should have returned an instance of "
  9933. "BaseException, not %R",
  9934. type, Py_TYPE(value));
  9935. goto bad;
  9936. }
  9937. }
  9938. } else {
  9939. PyErr_SetString(PyExc_TypeError,
  9940. "raise: exception class must be a subclass of BaseException");
  9941. goto bad;
  9942. }
  9943. if (cause) {
  9944. PyObject *fixed_cause;
  9945. if (cause == Py_None) {
  9946. fixed_cause = NULL;
  9947. } else if (PyExceptionClass_Check(cause)) {
  9948. fixed_cause = PyObject_CallObject(cause, NULL);
  9949. if (fixed_cause == NULL)
  9950. goto bad;
  9951. } else if (PyExceptionInstance_Check(cause)) {
  9952. fixed_cause = cause;
  9953. Py_INCREF(fixed_cause);
  9954. } else {
  9955. PyErr_SetString(PyExc_TypeError,
  9956. "exception causes must derive from "
  9957. "BaseException");
  9958. goto bad;
  9959. }
  9960. PyException_SetCause(value, fixed_cause);
  9961. }
  9962. PyErr_SetObject(type, value);
  9963. if (tb) {
  9964. #if PY_VERSION_HEX >= 0x030C00A6
  9965. PyException_SetTraceback(value, tb);
  9966. #elif CYTHON_FAST_THREAD_STATE
  9967. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  9968. PyObject* tmp_tb = tstate->curexc_traceback;
  9969. if (tb != tmp_tb) {
  9970. Py_INCREF(tb);
  9971. tstate->curexc_traceback = tb;
  9972. Py_XDECREF(tmp_tb);
  9973. }
  9974. #else
  9975. PyObject *tmp_type, *tmp_value, *tmp_tb;
  9976. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  9977. Py_INCREF(tb);
  9978. PyErr_Restore(tmp_type, tmp_value, tb);
  9979. Py_XDECREF(tmp_tb);
  9980. #endif
  9981. }
  9982. bad:
  9983. Py_XDECREF(owned_instance);
  9984. return;
  9985. }
  9986. #endif
  9987. /* py_abs */
  9988. #if CYTHON_USE_PYLONG_INTERNALS
  9989. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  9990. #if PY_VERSION_HEX >= 0x030C00A7
  9991. if (likely(__Pyx_PyLong_IsCompact(n))) {
  9992. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  9993. }
  9994. #else
  9995. if (likely(Py_SIZE(n) == -1)) {
  9996. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  9997. }
  9998. #endif
  9999. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  10000. {
  10001. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  10002. if (likely(copy)) {
  10003. #if PY_VERSION_HEX >= 0x030C00A7
  10004. ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
  10005. #else
  10006. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  10007. #endif
  10008. }
  10009. return copy;
  10010. }
  10011. #else
  10012. return PyNumber_Negative(n);
  10013. #endif
  10014. }
  10015. #endif
  10016. /* SliceTupleAndList */
  10017. #if CYTHON_COMPILING_IN_CPYTHON
  10018. static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
  10019. Py_ssize_t start = *_start, stop = *_stop, length = *_length;
  10020. if (start < 0) {
  10021. start += length;
  10022. if (start < 0)
  10023. start = 0;
  10024. }
  10025. if (stop < 0)
  10026. stop += length;
  10027. else if (stop > length)
  10028. stop = length;
  10029. *_length = stop - start;
  10030. *_start = start;
  10031. *_stop = stop;
  10032. }
  10033. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
  10034. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  10035. Py_ssize_t length = PyList_GET_SIZE(src);
  10036. __Pyx_crop_slice(&start, &stop, &length);
  10037. if (length <= 0) {
  10038. return PyList_New(0);
  10039. }
  10040. return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
  10041. }
  10042. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
  10043. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  10044. Py_ssize_t length = PyTuple_GET_SIZE(src);
  10045. __Pyx_crop_slice(&start, &stop, &length);
  10046. return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
  10047. }
  10048. #endif
  10049. /* PyIntBinop */
  10050. #if !CYTHON_COMPILING_IN_PYPY
  10051. static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  10052. CYTHON_MAYBE_UNUSED_VAR(intval);
  10053. CYTHON_MAYBE_UNUSED_VAR(inplace);
  10054. CYTHON_UNUSED_VAR(zerodivision_check);
  10055. #if PY_MAJOR_VERSION < 3
  10056. if (likely(PyInt_CheckExact(op2))) {
  10057. const long a = intval;
  10058. long x;
  10059. long b = PyInt_AS_LONG(op2);
  10060. x = (long)((unsigned long)a - (unsigned long)b);
  10061. if (likely((x^a) >= 0 || (x^~b) >= 0))
  10062. return PyInt_FromLong(x);
  10063. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  10064. }
  10065. #endif
  10066. #if CYTHON_USE_PYLONG_INTERNALS
  10067. if (likely(PyLong_CheckExact(op2))) {
  10068. const long a = intval;
  10069. long b, x;
  10070. #ifdef HAVE_LONG_LONG
  10071. const PY_LONG_LONG lla = intval;
  10072. PY_LONG_LONG llb, llx;
  10073. #endif
  10074. if (unlikely(__Pyx_PyLong_IsZero(op2))) {
  10075. return __Pyx_NewRef(op1);
  10076. }
  10077. if (likely(__Pyx_PyLong_IsCompact(op2))) {
  10078. b = __Pyx_PyLong_CompactValue(op2);
  10079. } else {
  10080. const digit* digits = __Pyx_PyLong_Digits(op2);
  10081. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op2);
  10082. switch (size) {
  10083. case -2:
  10084. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10085. b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10086. break;
  10087. #ifdef HAVE_LONG_LONG
  10088. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  10089. llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10090. goto long_long;
  10091. #endif
  10092. }
  10093. CYTHON_FALLTHROUGH;
  10094. case 2:
  10095. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10096. b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10097. break;
  10098. #ifdef HAVE_LONG_LONG
  10099. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  10100. llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10101. goto long_long;
  10102. #endif
  10103. }
  10104. CYTHON_FALLTHROUGH;
  10105. case -3:
  10106. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10107. b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10108. break;
  10109. #ifdef HAVE_LONG_LONG
  10110. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  10111. llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10112. goto long_long;
  10113. #endif
  10114. }
  10115. CYTHON_FALLTHROUGH;
  10116. case 3:
  10117. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10118. b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10119. break;
  10120. #ifdef HAVE_LONG_LONG
  10121. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  10122. llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10123. goto long_long;
  10124. #endif
  10125. }
  10126. CYTHON_FALLTHROUGH;
  10127. case -4:
  10128. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10129. b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10130. break;
  10131. #ifdef HAVE_LONG_LONG
  10132. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  10133. llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10134. goto long_long;
  10135. #endif
  10136. }
  10137. CYTHON_FALLTHROUGH;
  10138. case 4:
  10139. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10140. b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  10141. break;
  10142. #ifdef HAVE_LONG_LONG
  10143. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  10144. llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  10145. goto long_long;
  10146. #endif
  10147. }
  10148. CYTHON_FALLTHROUGH;
  10149. default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  10150. }
  10151. }
  10152. x = a - b;
  10153. return PyLong_FromLong(x);
  10154. #ifdef HAVE_LONG_LONG
  10155. long_long:
  10156. llx = lla - llb;
  10157. return PyLong_FromLongLong(llx);
  10158. #endif
  10159. }
  10160. #endif
  10161. if (PyFloat_CheckExact(op2)) {
  10162. const long a = intval;
  10163. #if CYTHON_COMPILING_IN_LIMITED_API
  10164. double b = __pyx_PyFloat_AsDouble(op2);
  10165. #else
  10166. double b = PyFloat_AS_DOUBLE(op2);
  10167. #endif
  10168. double result;
  10169. PyFPE_START_PROTECT("subtract", return NULL)
  10170. result = ((double)a) - (double)b;
  10171. PyFPE_END_PROTECT(result)
  10172. return PyFloat_FromDouble(result);
  10173. }
  10174. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  10175. }
  10176. #endif
  10177. /* ArgTypeTest */
  10178. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  10179. {
  10180. __Pyx_TypeName type_name;
  10181. __Pyx_TypeName obj_type_name;
  10182. if (unlikely(!type)) {
  10183. PyErr_SetString(PyExc_SystemError, "Missing type object");
  10184. return 0;
  10185. }
  10186. else if (exact) {
  10187. #if PY_MAJOR_VERSION == 2
  10188. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  10189. #endif
  10190. }
  10191. else {
  10192. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  10193. }
  10194. type_name = __Pyx_PyType_GetName(type);
  10195. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  10196. PyErr_Format(PyExc_TypeError,
  10197. "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
  10198. ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
  10199. __Pyx_DECREF_TypeName(type_name);
  10200. __Pyx_DECREF_TypeName(obj_type_name);
  10201. return 0;
  10202. }
  10203. /* RaiseUnboundLocalError */
  10204. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  10205. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  10206. }
  10207. /* GetException */
  10208. #if CYTHON_FAST_THREAD_STATE
  10209. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  10210. #else
  10211. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  10212. #endif
  10213. {
  10214. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  10215. #if CYTHON_FAST_THREAD_STATE
  10216. PyObject *tmp_type, *tmp_value, *tmp_tb;
  10217. #if PY_VERSION_HEX >= 0x030C00A6
  10218. local_value = tstate->current_exception;
  10219. tstate->current_exception = 0;
  10220. if (likely(local_value)) {
  10221. local_type = (PyObject*) Py_TYPE(local_value);
  10222. Py_INCREF(local_type);
  10223. local_tb = PyException_GetTraceback(local_value);
  10224. }
  10225. #else
  10226. local_type = tstate->curexc_type;
  10227. local_value = tstate->curexc_value;
  10228. local_tb = tstate->curexc_traceback;
  10229. tstate->curexc_type = 0;
  10230. tstate->curexc_value = 0;
  10231. tstate->curexc_traceback = 0;
  10232. #endif
  10233. #else
  10234. PyErr_Fetch(&local_type, &local_value, &local_tb);
  10235. #endif
  10236. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  10237. #if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
  10238. if (unlikely(tstate->current_exception))
  10239. #elif CYTHON_FAST_THREAD_STATE
  10240. if (unlikely(tstate->curexc_type))
  10241. #else
  10242. if (unlikely(PyErr_Occurred()))
  10243. #endif
  10244. goto bad;
  10245. #if PY_MAJOR_VERSION >= 3
  10246. if (local_tb) {
  10247. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  10248. goto bad;
  10249. }
  10250. #endif
  10251. Py_XINCREF(local_tb);
  10252. Py_XINCREF(local_type);
  10253. Py_XINCREF(local_value);
  10254. *type = local_type;
  10255. *value = local_value;
  10256. *tb = local_tb;
  10257. #if CYTHON_FAST_THREAD_STATE
  10258. #if CYTHON_USE_EXC_INFO_STACK
  10259. {
  10260. _PyErr_StackItem *exc_info = tstate->exc_info;
  10261. #if PY_VERSION_HEX >= 0x030B00a4
  10262. tmp_value = exc_info->exc_value;
  10263. exc_info->exc_value = local_value;
  10264. tmp_type = NULL;
  10265. tmp_tb = NULL;
  10266. Py_XDECREF(local_type);
  10267. Py_XDECREF(local_tb);
  10268. #else
  10269. tmp_type = exc_info->exc_type;
  10270. tmp_value = exc_info->exc_value;
  10271. tmp_tb = exc_info->exc_traceback;
  10272. exc_info->exc_type = local_type;
  10273. exc_info->exc_value = local_value;
  10274. exc_info->exc_traceback = local_tb;
  10275. #endif
  10276. }
  10277. #else
  10278. tmp_type = tstate->exc_type;
  10279. tmp_value = tstate->exc_value;
  10280. tmp_tb = tstate->exc_traceback;
  10281. tstate->exc_type = local_type;
  10282. tstate->exc_value = local_value;
  10283. tstate->exc_traceback = local_tb;
  10284. #endif
  10285. Py_XDECREF(tmp_type);
  10286. Py_XDECREF(tmp_value);
  10287. Py_XDECREF(tmp_tb);
  10288. #else
  10289. PyErr_SetExcInfo(local_type, local_value, local_tb);
  10290. #endif
  10291. return 0;
  10292. bad:
  10293. *type = 0;
  10294. *value = 0;
  10295. *tb = 0;
  10296. Py_XDECREF(local_type);
  10297. Py_XDECREF(local_value);
  10298. Py_XDECREF(local_tb);
  10299. return -1;
  10300. }
  10301. /* pep479 */
  10302. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  10303. PyObject *exc, *val, *tb, *cur_exc;
  10304. __Pyx_PyThreadState_declare
  10305. #ifdef __Pyx_StopAsyncIteration_USED
  10306. int is_async_stopiteration = 0;
  10307. #endif
  10308. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  10309. cur_exc = PyErr_Occurred();
  10310. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  10311. #ifdef __Pyx_StopAsyncIteration_USED
  10312. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) {
  10313. is_async_stopiteration = 1;
  10314. } else
  10315. #endif
  10316. return;
  10317. }
  10318. __Pyx_PyThreadState_assign
  10319. __Pyx_GetException(&exc, &val, &tb);
  10320. Py_XDECREF(exc);
  10321. Py_XDECREF(val);
  10322. Py_XDECREF(tb);
  10323. PyErr_SetString(PyExc_RuntimeError,
  10324. #ifdef __Pyx_StopAsyncIteration_USED
  10325. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  10326. in_async_gen ? "async generator raised StopIteration" :
  10327. #endif
  10328. "generator raised StopIteration");
  10329. }
  10330. /* RaiseTooManyValuesToUnpack */
  10331. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  10332. PyErr_Format(PyExc_ValueError,
  10333. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  10334. }
  10335. /* RaiseNeedMoreValuesToUnpack */
  10336. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  10337. PyErr_Format(PyExc_ValueError,
  10338. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  10339. index, (index == 1) ? "" : "s");
  10340. }
  10341. /* IterFinish */
  10342. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  10343. __Pyx_PyThreadState_declare
  10344. __Pyx_PyThreadState_assign
  10345. PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
  10346. if (unlikely(exc_type)) {
  10347. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  10348. return -1;
  10349. __Pyx_PyErr_Clear();
  10350. return 0;
  10351. }
  10352. return 0;
  10353. }
  10354. /* UnpackItemEndCheck */
  10355. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  10356. if (unlikely(retval)) {
  10357. Py_DECREF(retval);
  10358. __Pyx_RaiseTooManyValuesError(expected);
  10359. return -1;
  10360. }
  10361. return __Pyx_IterFinish();
  10362. }
  10363. /* PyObjectCall */
  10364. #if CYTHON_COMPILING_IN_CPYTHON
  10365. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  10366. PyObject *result;
  10367. ternaryfunc call = Py_TYPE(func)->tp_call;
  10368. if (unlikely(!call))
  10369. return PyObject_Call(func, arg, kw);
  10370. #if PY_MAJOR_VERSION < 3
  10371. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  10372. return NULL;
  10373. #else
  10374. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  10375. return NULL;
  10376. #endif
  10377. result = (*call)(func, arg, kw);
  10378. Py_LeaveRecursiveCall();
  10379. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  10380. PyErr_SetString(
  10381. PyExc_SystemError,
  10382. "NULL result without error in PyObject_Call");
  10383. }
  10384. return result;
  10385. }
  10386. #endif
  10387. /* PyDictVersioning */
  10388. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  10389. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  10390. PyObject *dict = Py_TYPE(obj)->tp_dict;
  10391. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  10392. }
  10393. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  10394. PyObject **dictptr = NULL;
  10395. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  10396. if (offset) {
  10397. #if CYTHON_COMPILING_IN_CPYTHON
  10398. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  10399. #else
  10400. dictptr = _PyObject_GetDictPtr(obj);
  10401. #endif
  10402. }
  10403. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  10404. }
  10405. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  10406. PyObject *dict = Py_TYPE(obj)->tp_dict;
  10407. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  10408. return 0;
  10409. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  10410. }
  10411. #endif
  10412. /* GetModuleGlobalName */
  10413. #if CYTHON_USE_DICT_VERSIONS
  10414. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  10415. #else
  10416. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  10417. #endif
  10418. {
  10419. PyObject *result;
  10420. #if !CYTHON_AVOID_BORROWED_REFS
  10421. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
  10422. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  10423. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  10424. if (likely(result)) {
  10425. return __Pyx_NewRef(result);
  10426. } else if (unlikely(PyErr_Occurred())) {
  10427. return NULL;
  10428. }
  10429. #elif CYTHON_COMPILING_IN_LIMITED_API
  10430. if (unlikely(!__pyx_m)) {
  10431. return NULL;
  10432. }
  10433. result = PyObject_GetAttr(__pyx_m, name);
  10434. if (likely(result)) {
  10435. return result;
  10436. }
  10437. #else
  10438. result = PyDict_GetItem(__pyx_d, name);
  10439. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  10440. if (likely(result)) {
  10441. return __Pyx_NewRef(result);
  10442. }
  10443. #endif
  10444. #else
  10445. result = PyObject_GetItem(__pyx_d, name);
  10446. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  10447. if (likely(result)) {
  10448. return __Pyx_NewRef(result);
  10449. }
  10450. PyErr_Clear();
  10451. #endif
  10452. return __Pyx_GetBuiltinName(name);
  10453. }
  10454. /* PyFunctionFastCall */
  10455. #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
  10456. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  10457. PyObject *globals) {
  10458. PyFrameObject *f;
  10459. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  10460. PyObject **fastlocals;
  10461. Py_ssize_t i;
  10462. PyObject *result;
  10463. assert(globals != NULL);
  10464. /* XXX Perhaps we should create a specialized
  10465. PyFrame_New() that doesn't take locals, but does
  10466. take builtins without sanity checking them.
  10467. */
  10468. assert(tstate != NULL);
  10469. f = PyFrame_New(tstate, co, globals, NULL);
  10470. if (f == NULL) {
  10471. return NULL;
  10472. }
  10473. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  10474. for (i = 0; i < na; i++) {
  10475. Py_INCREF(*args);
  10476. fastlocals[i] = *args++;
  10477. }
  10478. result = PyEval_EvalFrameEx(f,0);
  10479. ++tstate->recursion_depth;
  10480. Py_DECREF(f);
  10481. --tstate->recursion_depth;
  10482. return result;
  10483. }
  10484. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
  10485. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  10486. PyObject *globals = PyFunction_GET_GLOBALS(func);
  10487. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  10488. PyObject *closure;
  10489. #if PY_MAJOR_VERSION >= 3
  10490. PyObject *kwdefs;
  10491. #endif
  10492. PyObject *kwtuple, **k;
  10493. PyObject **d;
  10494. Py_ssize_t nd;
  10495. Py_ssize_t nk;
  10496. PyObject *result;
  10497. assert(kwargs == NULL || PyDict_Check(kwargs));
  10498. nk = kwargs ? PyDict_Size(kwargs) : 0;
  10499. #if PY_MAJOR_VERSION < 3
  10500. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
  10501. return NULL;
  10502. }
  10503. #else
  10504. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
  10505. return NULL;
  10506. }
  10507. #endif
  10508. if (
  10509. #if PY_MAJOR_VERSION >= 3
  10510. co->co_kwonlyargcount == 0 &&
  10511. #endif
  10512. likely(kwargs == NULL || nk == 0) &&
  10513. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  10514. if (argdefs == NULL && co->co_argcount == nargs) {
  10515. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  10516. goto done;
  10517. }
  10518. else if (nargs == 0 && argdefs != NULL
  10519. && co->co_argcount == Py_SIZE(argdefs)) {
  10520. /* function called with no arguments, but all parameters have
  10521. a default value: use default values as arguments .*/
  10522. args = &PyTuple_GET_ITEM(argdefs, 0);
  10523. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  10524. goto done;
  10525. }
  10526. }
  10527. if (kwargs != NULL) {
  10528. Py_ssize_t pos, i;
  10529. kwtuple = PyTuple_New(2 * nk);
  10530. if (kwtuple == NULL) {
  10531. result = NULL;
  10532. goto done;
  10533. }
  10534. k = &PyTuple_GET_ITEM(kwtuple, 0);
  10535. pos = i = 0;
  10536. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  10537. Py_INCREF(k[i]);
  10538. Py_INCREF(k[i+1]);
  10539. i += 2;
  10540. }
  10541. nk = i / 2;
  10542. }
  10543. else {
  10544. kwtuple = NULL;
  10545. k = NULL;
  10546. }
  10547. closure = PyFunction_GET_CLOSURE(func);
  10548. #if PY_MAJOR_VERSION >= 3
  10549. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  10550. #endif
  10551. if (argdefs != NULL) {
  10552. d = &PyTuple_GET_ITEM(argdefs, 0);
  10553. nd = Py_SIZE(argdefs);
  10554. }
  10555. else {
  10556. d = NULL;
  10557. nd = 0;
  10558. }
  10559. #if PY_MAJOR_VERSION >= 3
  10560. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  10561. args, (int)nargs,
  10562. k, (int)nk,
  10563. d, (int)nd, kwdefs, closure);
  10564. #else
  10565. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  10566. args, (int)nargs,
  10567. k, (int)nk,
  10568. d, (int)nd, closure);
  10569. #endif
  10570. Py_XDECREF(kwtuple);
  10571. done:
  10572. Py_LeaveRecursiveCall();
  10573. return result;
  10574. }
  10575. #endif
  10576. /* PyObjectCallMethO */
  10577. #if CYTHON_COMPILING_IN_CPYTHON
  10578. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  10579. PyObject *self, *result;
  10580. PyCFunction cfunc;
  10581. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  10582. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  10583. #if PY_MAJOR_VERSION < 3
  10584. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  10585. return NULL;
  10586. #else
  10587. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  10588. return NULL;
  10589. #endif
  10590. result = cfunc(self, arg);
  10591. Py_LeaveRecursiveCall();
  10592. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  10593. PyErr_SetString(
  10594. PyExc_SystemError,
  10595. "NULL result without error in PyObject_Call");
  10596. }
  10597. return result;
  10598. }
  10599. #endif
  10600. /* PyObjectFastCall */
  10601. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  10602. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
  10603. PyObject *argstuple;
  10604. PyObject *result = 0;
  10605. size_t i;
  10606. argstuple = PyTuple_New((Py_ssize_t)nargs);
  10607. if (unlikely(!argstuple)) return NULL;
  10608. for (i = 0; i < nargs; i++) {
  10609. Py_INCREF(args[i]);
  10610. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
  10611. }
  10612. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  10613. bad:
  10614. Py_DECREF(argstuple);
  10615. return result;
  10616. }
  10617. #endif
  10618. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
  10619. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  10620. #if CYTHON_COMPILING_IN_CPYTHON
  10621. if (nargs == 0 && kwargs == NULL) {
  10622. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  10623. return __Pyx_PyObject_CallMethO(func, NULL);
  10624. }
  10625. else if (nargs == 1 && kwargs == NULL) {
  10626. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  10627. return __Pyx_PyObject_CallMethO(func, args[0]);
  10628. }
  10629. #endif
  10630. #if PY_VERSION_HEX < 0x030800B1
  10631. #if CYTHON_FAST_PYCCALL
  10632. if (PyCFunction_Check(func)) {
  10633. if (kwargs) {
  10634. return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
  10635. } else {
  10636. return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
  10637. }
  10638. }
  10639. #if PY_VERSION_HEX >= 0x030700A1
  10640. if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
  10641. return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
  10642. }
  10643. #endif
  10644. #endif
  10645. #if CYTHON_FAST_PYCALL
  10646. if (PyFunction_Check(func)) {
  10647. return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
  10648. }
  10649. #endif
  10650. #endif
  10651. if (kwargs == NULL) {
  10652. #if CYTHON_VECTORCALL
  10653. #if PY_VERSION_HEX < 0x03090000
  10654. vectorcallfunc f = _PyVectorcall_Function(func);
  10655. #else
  10656. vectorcallfunc f = PyVectorcall_Function(func);
  10657. #endif
  10658. if (f) {
  10659. return f(func, args, (size_t)nargs, NULL);
  10660. }
  10661. #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
  10662. if (__Pyx_CyFunction_CheckExact(func)) {
  10663. __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
  10664. if (f) return f(func, args, (size_t)nargs, NULL);
  10665. }
  10666. #endif
  10667. }
  10668. if (nargs == 0) {
  10669. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
  10670. }
  10671. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  10672. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  10673. #else
  10674. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  10675. #endif
  10676. }
  10677. /* SliceObject */
  10678. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  10679. Py_ssize_t cstart, Py_ssize_t cstop,
  10680. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  10681. int has_cstart, int has_cstop, int wraparound) {
  10682. __Pyx_TypeName obj_type_name;
  10683. #if CYTHON_USE_TYPE_SLOTS
  10684. PyMappingMethods* mp;
  10685. #if PY_MAJOR_VERSION < 3
  10686. PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
  10687. if (likely(ms && ms->sq_slice)) {
  10688. if (!has_cstart) {
  10689. if (_py_start && (*_py_start != Py_None)) {
  10690. cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
  10691. if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  10692. } else
  10693. cstart = 0;
  10694. }
  10695. if (!has_cstop) {
  10696. if (_py_stop && (*_py_stop != Py_None)) {
  10697. cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
  10698. if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  10699. } else
  10700. cstop = PY_SSIZE_T_MAX;
  10701. }
  10702. if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
  10703. Py_ssize_t l = ms->sq_length(obj);
  10704. if (likely(l >= 0)) {
  10705. if (cstop < 0) {
  10706. cstop += l;
  10707. if (cstop < 0) cstop = 0;
  10708. }
  10709. if (cstart < 0) {
  10710. cstart += l;
  10711. if (cstart < 0) cstart = 0;
  10712. }
  10713. } else {
  10714. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  10715. goto bad;
  10716. PyErr_Clear();
  10717. }
  10718. }
  10719. return ms->sq_slice(obj, cstart, cstop);
  10720. }
  10721. #else
  10722. CYTHON_UNUSED_VAR(wraparound);
  10723. #endif
  10724. mp = Py_TYPE(obj)->tp_as_mapping;
  10725. if (likely(mp && mp->mp_subscript))
  10726. #else
  10727. CYTHON_UNUSED_VAR(wraparound);
  10728. #endif
  10729. {
  10730. PyObject* result;
  10731. PyObject *py_slice, *py_start, *py_stop;
  10732. if (_py_slice) {
  10733. py_slice = *_py_slice;
  10734. } else {
  10735. PyObject* owned_start = NULL;
  10736. PyObject* owned_stop = NULL;
  10737. if (_py_start) {
  10738. py_start = *_py_start;
  10739. } else {
  10740. if (has_cstart) {
  10741. owned_start = py_start = PyInt_FromSsize_t(cstart);
  10742. if (unlikely(!py_start)) goto bad;
  10743. } else
  10744. py_start = Py_None;
  10745. }
  10746. if (_py_stop) {
  10747. py_stop = *_py_stop;
  10748. } else {
  10749. if (has_cstop) {
  10750. owned_stop = py_stop = PyInt_FromSsize_t(cstop);
  10751. if (unlikely(!py_stop)) {
  10752. Py_XDECREF(owned_start);
  10753. goto bad;
  10754. }
  10755. } else
  10756. py_stop = Py_None;
  10757. }
  10758. py_slice = PySlice_New(py_start, py_stop, Py_None);
  10759. Py_XDECREF(owned_start);
  10760. Py_XDECREF(owned_stop);
  10761. if (unlikely(!py_slice)) goto bad;
  10762. }
  10763. #if CYTHON_USE_TYPE_SLOTS
  10764. result = mp->mp_subscript(obj, py_slice);
  10765. #else
  10766. result = PyObject_GetItem(obj, py_slice);
  10767. #endif
  10768. if (!_py_slice) {
  10769. Py_DECREF(py_slice);
  10770. }
  10771. return result;
  10772. }
  10773. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  10774. PyErr_Format(PyExc_TypeError,
  10775. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  10776. __Pyx_DECREF_TypeName(obj_type_name);
  10777. bad:
  10778. return NULL;
  10779. }
  10780. /* PyObjectCallNoArg */
  10781. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  10782. PyObject *arg[2] = {NULL, NULL};
  10783. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  10784. }
  10785. /* PyObjectCallOneArg */
  10786. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  10787. PyObject *args[2] = {NULL, arg};
  10788. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  10789. }
  10790. /* PyObjectGetMethod */
  10791. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  10792. PyObject *attr;
  10793. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  10794. __Pyx_TypeName type_name;
  10795. PyTypeObject *tp = Py_TYPE(obj);
  10796. PyObject *descr;
  10797. descrgetfunc f = NULL;
  10798. PyObject **dictptr, *dict;
  10799. int meth_found = 0;
  10800. assert (*method == NULL);
  10801. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  10802. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  10803. goto try_unpack;
  10804. }
  10805. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  10806. return 0;
  10807. }
  10808. descr = _PyType_Lookup(tp, name);
  10809. if (likely(descr != NULL)) {
  10810. Py_INCREF(descr);
  10811. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  10812. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  10813. #elif PY_MAJOR_VERSION >= 3
  10814. #ifdef __Pyx_CyFunction_USED
  10815. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  10816. #else
  10817. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  10818. #endif
  10819. #else
  10820. #ifdef __Pyx_CyFunction_USED
  10821. if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
  10822. #else
  10823. if (likely(PyFunction_Check(descr)))
  10824. #endif
  10825. #endif
  10826. {
  10827. meth_found = 1;
  10828. } else {
  10829. f = Py_TYPE(descr)->tp_descr_get;
  10830. if (f != NULL && PyDescr_IsData(descr)) {
  10831. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  10832. Py_DECREF(descr);
  10833. goto try_unpack;
  10834. }
  10835. }
  10836. }
  10837. dictptr = _PyObject_GetDictPtr(obj);
  10838. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  10839. Py_INCREF(dict);
  10840. attr = __Pyx_PyDict_GetItemStr(dict, name);
  10841. if (attr != NULL) {
  10842. Py_INCREF(attr);
  10843. Py_DECREF(dict);
  10844. Py_XDECREF(descr);
  10845. goto try_unpack;
  10846. }
  10847. Py_DECREF(dict);
  10848. }
  10849. if (meth_found) {
  10850. *method = descr;
  10851. return 1;
  10852. }
  10853. if (f != NULL) {
  10854. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  10855. Py_DECREF(descr);
  10856. goto try_unpack;
  10857. }
  10858. if (likely(descr != NULL)) {
  10859. *method = descr;
  10860. return 0;
  10861. }
  10862. type_name = __Pyx_PyType_GetName(tp);
  10863. PyErr_Format(PyExc_AttributeError,
  10864. #if PY_MAJOR_VERSION >= 3
  10865. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  10866. type_name, name);
  10867. #else
  10868. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
  10869. type_name, PyString_AS_STRING(name));
  10870. #endif
  10871. __Pyx_DECREF_TypeName(type_name);
  10872. return 0;
  10873. #else
  10874. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  10875. goto try_unpack;
  10876. #endif
  10877. try_unpack:
  10878. #if CYTHON_UNPACK_METHODS
  10879. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  10880. PyObject *function = PyMethod_GET_FUNCTION(attr);
  10881. Py_INCREF(function);
  10882. Py_DECREF(attr);
  10883. *method = function;
  10884. return 1;
  10885. }
  10886. #endif
  10887. *method = attr;
  10888. return 0;
  10889. }
  10890. /* PyObjectCallMethod0 */
  10891. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  10892. PyObject *method = NULL, *result = NULL;
  10893. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  10894. if (likely(is_method)) {
  10895. result = __Pyx_PyObject_CallOneArg(method, obj);
  10896. Py_DECREF(method);
  10897. return result;
  10898. }
  10899. if (unlikely(!method)) goto bad;
  10900. result = __Pyx_PyObject_CallNoArg(method);
  10901. Py_DECREF(method);
  10902. bad:
  10903. return result;
  10904. }
  10905. /* UnpackUnboundCMethod */
  10906. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
  10907. PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
  10908. if (unlikely(!selfless_args)) return NULL;
  10909. PyObject *result = PyObject_Call(method, selfless_args, kwargs);
  10910. Py_DECREF(selfless_args);
  10911. return result;
  10912. }
  10913. static PyMethodDef __Pyx_UnboundCMethod_Def = {
  10914. "CythonUnboundCMethod",
  10915. __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
  10916. METH_VARARGS | METH_KEYWORDS,
  10917. NULL
  10918. };
  10919. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  10920. PyObject *method;
  10921. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  10922. if (unlikely(!method))
  10923. return -1;
  10924. target->method = method;
  10925. #if CYTHON_COMPILING_IN_CPYTHON
  10926. #if PY_MAJOR_VERSION >= 3
  10927. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  10928. #else
  10929. if (likely(!__Pyx_CyOrPyCFunction_Check(method)))
  10930. #endif
  10931. {
  10932. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  10933. target->func = descr->d_method->ml_meth;
  10934. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  10935. } else
  10936. #endif
  10937. #if CYTHON_COMPILING_IN_PYPY
  10938. #else
  10939. if (PyCFunction_Check(method))
  10940. #endif
  10941. {
  10942. PyObject *self;
  10943. int self_found;
  10944. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  10945. self = PyObject_GetAttrString(method, "__self__");
  10946. if (!self) {
  10947. PyErr_Clear();
  10948. }
  10949. #else
  10950. self = PyCFunction_GET_SELF(method);
  10951. #endif
  10952. self_found = (self && self != Py_None);
  10953. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  10954. Py_XDECREF(self);
  10955. #endif
  10956. if (self_found) {
  10957. PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
  10958. if (unlikely(!unbound_method)) return -1;
  10959. Py_DECREF(method);
  10960. target->method = unbound_method;
  10961. }
  10962. }
  10963. return 0;
  10964. }
  10965. /* CallUnboundCMethod0 */
  10966. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  10967. PyObject *args, *result = NULL;
  10968. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  10969. #if CYTHON_ASSUME_SAFE_MACROS
  10970. args = PyTuple_New(1);
  10971. if (unlikely(!args)) goto bad;
  10972. Py_INCREF(self);
  10973. PyTuple_SET_ITEM(args, 0, self);
  10974. #else
  10975. args = PyTuple_Pack(1, self);
  10976. if (unlikely(!args)) goto bad;
  10977. #endif
  10978. result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
  10979. Py_DECREF(args);
  10980. bad:
  10981. return result;
  10982. }
  10983. /* pop */
  10984. static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
  10985. if (__Pyx_IS_TYPE(L, &PySet_Type)) {
  10986. return PySet_Pop(L);
  10987. }
  10988. return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
  10989. }
  10990. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  10991. static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
  10992. if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
  10993. __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
  10994. return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
  10995. }
  10996. return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
  10997. }
  10998. #endif
  10999. /* RaiseUnexpectedTypeError */
  11000. static int
  11001. __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
  11002. {
  11003. __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  11004. PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
  11005. expected, obj_type_name);
  11006. __Pyx_DECREF_TypeName(obj_type_name);
  11007. return 0;
  11008. }
  11009. /* PyIntBinop */
  11010. #if !CYTHON_COMPILING_IN_PYPY
  11011. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  11012. CYTHON_MAYBE_UNUSED_VAR(intval);
  11013. CYTHON_MAYBE_UNUSED_VAR(inplace);
  11014. CYTHON_UNUSED_VAR(zerodivision_check);
  11015. #if PY_MAJOR_VERSION < 3
  11016. if (likely(PyInt_CheckExact(op1))) {
  11017. const long b = intval;
  11018. long x;
  11019. long a = PyInt_AS_LONG(op1);
  11020. x = (long)((unsigned long)a + (unsigned long)b);
  11021. if (likely((x^a) >= 0 || (x^b) >= 0))
  11022. return PyInt_FromLong(x);
  11023. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  11024. }
  11025. #endif
  11026. #if CYTHON_USE_PYLONG_INTERNALS
  11027. if (likely(PyLong_CheckExact(op1))) {
  11028. const long b = intval;
  11029. long a, x;
  11030. #ifdef HAVE_LONG_LONG
  11031. const PY_LONG_LONG llb = intval;
  11032. PY_LONG_LONG lla, llx;
  11033. #endif
  11034. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  11035. return __Pyx_NewRef(op2);
  11036. }
  11037. if (likely(__Pyx_PyLong_IsCompact(op1))) {
  11038. a = __Pyx_PyLong_CompactValue(op1);
  11039. } else {
  11040. const digit* digits = __Pyx_PyLong_Digits(op1);
  11041. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  11042. switch (size) {
  11043. case -2:
  11044. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  11045. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11046. break;
  11047. #ifdef HAVE_LONG_LONG
  11048. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  11049. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11050. goto long_long;
  11051. #endif
  11052. }
  11053. CYTHON_FALLTHROUGH;
  11054. case 2:
  11055. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  11056. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11057. break;
  11058. #ifdef HAVE_LONG_LONG
  11059. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  11060. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11061. goto long_long;
  11062. #endif
  11063. }
  11064. CYTHON_FALLTHROUGH;
  11065. case -3:
  11066. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  11067. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11068. break;
  11069. #ifdef HAVE_LONG_LONG
  11070. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  11071. lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11072. goto long_long;
  11073. #endif
  11074. }
  11075. CYTHON_FALLTHROUGH;
  11076. case 3:
  11077. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  11078. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11079. break;
  11080. #ifdef HAVE_LONG_LONG
  11081. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  11082. lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11083. goto long_long;
  11084. #endif
  11085. }
  11086. CYTHON_FALLTHROUGH;
  11087. case -4:
  11088. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  11089. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11090. break;
  11091. #ifdef HAVE_LONG_LONG
  11092. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  11093. lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11094. goto long_long;
  11095. #endif
  11096. }
  11097. CYTHON_FALLTHROUGH;
  11098. case 4:
  11099. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  11100. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  11101. break;
  11102. #ifdef HAVE_LONG_LONG
  11103. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  11104. lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  11105. goto long_long;
  11106. #endif
  11107. }
  11108. CYTHON_FALLTHROUGH;
  11109. default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  11110. }
  11111. }
  11112. x = a + b;
  11113. return PyLong_FromLong(x);
  11114. #ifdef HAVE_LONG_LONG
  11115. long_long:
  11116. llx = lla + llb;
  11117. return PyLong_FromLongLong(llx);
  11118. #endif
  11119. }
  11120. #endif
  11121. if (PyFloat_CheckExact(op1)) {
  11122. const long b = intval;
  11123. #if CYTHON_COMPILING_IN_LIMITED_API
  11124. double a = __pyx_PyFloat_AsDouble(op1);
  11125. #else
  11126. double a = PyFloat_AS_DOUBLE(op1);
  11127. #endif
  11128. double result;
  11129. PyFPE_START_PROTECT("add", return NULL)
  11130. result = ((double)a) + (double)b;
  11131. PyFPE_END_PROTECT(result)
  11132. return PyFloat_FromDouble(result);
  11133. }
  11134. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  11135. }
  11136. #endif
  11137. /* GetTopmostException */
  11138. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  11139. static _PyErr_StackItem *
  11140. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  11141. {
  11142. _PyErr_StackItem *exc_info = tstate->exc_info;
  11143. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  11144. exc_info->previous_item != NULL)
  11145. {
  11146. exc_info = exc_info->previous_item;
  11147. }
  11148. return exc_info;
  11149. }
  11150. #endif
  11151. /* SaveResetException */
  11152. #if CYTHON_FAST_THREAD_STATE
  11153. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  11154. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  11155. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  11156. PyObject *exc_value = exc_info->exc_value;
  11157. if (exc_value == NULL || exc_value == Py_None) {
  11158. *value = NULL;
  11159. *type = NULL;
  11160. *tb = NULL;
  11161. } else {
  11162. *value = exc_value;
  11163. Py_INCREF(*value);
  11164. *type = (PyObject*) Py_TYPE(exc_value);
  11165. Py_INCREF(*type);
  11166. *tb = PyException_GetTraceback(exc_value);
  11167. }
  11168. #elif CYTHON_USE_EXC_INFO_STACK
  11169. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  11170. *type = exc_info->exc_type;
  11171. *value = exc_info->exc_value;
  11172. *tb = exc_info->exc_traceback;
  11173. Py_XINCREF(*type);
  11174. Py_XINCREF(*value);
  11175. Py_XINCREF(*tb);
  11176. #else
  11177. *type = tstate->exc_type;
  11178. *value = tstate->exc_value;
  11179. *tb = tstate->exc_traceback;
  11180. Py_XINCREF(*type);
  11181. Py_XINCREF(*value);
  11182. Py_XINCREF(*tb);
  11183. #endif
  11184. }
  11185. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  11186. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  11187. _PyErr_StackItem *exc_info = tstate->exc_info;
  11188. PyObject *tmp_value = exc_info->exc_value;
  11189. exc_info->exc_value = value;
  11190. Py_XDECREF(tmp_value);
  11191. Py_XDECREF(type);
  11192. Py_XDECREF(tb);
  11193. #else
  11194. PyObject *tmp_type, *tmp_value, *tmp_tb;
  11195. #if CYTHON_USE_EXC_INFO_STACK
  11196. _PyErr_StackItem *exc_info = tstate->exc_info;
  11197. tmp_type = exc_info->exc_type;
  11198. tmp_value = exc_info->exc_value;
  11199. tmp_tb = exc_info->exc_traceback;
  11200. exc_info->exc_type = type;
  11201. exc_info->exc_value = value;
  11202. exc_info->exc_traceback = tb;
  11203. #else
  11204. tmp_type = tstate->exc_type;
  11205. tmp_value = tstate->exc_value;
  11206. tmp_tb = tstate->exc_traceback;
  11207. tstate->exc_type = type;
  11208. tstate->exc_value = value;
  11209. tstate->exc_traceback = tb;
  11210. #endif
  11211. Py_XDECREF(tmp_type);
  11212. Py_XDECREF(tmp_value);
  11213. Py_XDECREF(tmp_tb);
  11214. #endif
  11215. }
  11216. #endif
  11217. /* pyfrozenset_new */
  11218. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  11219. if (it) {
  11220. PyObject* result;
  11221. #if CYTHON_COMPILING_IN_PYPY
  11222. PyObject* args;
  11223. args = PyTuple_Pack(1, it);
  11224. if (unlikely(!args))
  11225. return NULL;
  11226. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  11227. Py_DECREF(args);
  11228. return result;
  11229. #else
  11230. if (PyFrozenSet_CheckExact(it)) {
  11231. Py_INCREF(it);
  11232. return it;
  11233. }
  11234. result = PyFrozenSet_New(it);
  11235. if (unlikely(!result))
  11236. return NULL;
  11237. if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result)))
  11238. return result;
  11239. Py_DECREF(result);
  11240. #endif
  11241. }
  11242. #if CYTHON_USE_TYPE_SLOTS
  11243. return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  11244. #else
  11245. return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  11246. #endif
  11247. }
  11248. /* PySetContains */
  11249. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  11250. int result = -1;
  11251. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  11252. PyObject *tmpkey;
  11253. PyErr_Clear();
  11254. tmpkey = __Pyx_PyFrozenSet_New(key);
  11255. if (tmpkey != NULL) {
  11256. result = PySet_Contains(set, tmpkey);
  11257. Py_DECREF(tmpkey);
  11258. }
  11259. }
  11260. return result;
  11261. }
  11262. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  11263. int result = PySet_Contains(set, key);
  11264. if (unlikely(result < 0)) {
  11265. result = __Pyx_PySet_ContainsUnhashable(set, key);
  11266. }
  11267. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  11268. }
  11269. /* Import */
  11270. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  11271. PyObject *module = 0;
  11272. PyObject *empty_dict = 0;
  11273. PyObject *empty_list = 0;
  11274. #if PY_MAJOR_VERSION < 3
  11275. PyObject *py_import;
  11276. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  11277. if (unlikely(!py_import))
  11278. goto bad;
  11279. if (!from_list) {
  11280. empty_list = PyList_New(0);
  11281. if (unlikely(!empty_list))
  11282. goto bad;
  11283. from_list = empty_list;
  11284. }
  11285. #endif
  11286. empty_dict = PyDict_New();
  11287. if (unlikely(!empty_dict))
  11288. goto bad;
  11289. {
  11290. #if PY_MAJOR_VERSION >= 3
  11291. if (level == -1) {
  11292. if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
  11293. module = PyImport_ImportModuleLevelObject(
  11294. name, __pyx_d, empty_dict, from_list, 1);
  11295. if (unlikely(!module)) {
  11296. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  11297. goto bad;
  11298. PyErr_Clear();
  11299. }
  11300. }
  11301. level = 0;
  11302. }
  11303. #endif
  11304. if (!module) {
  11305. #if PY_MAJOR_VERSION < 3
  11306. PyObject *py_level = PyInt_FromLong(level);
  11307. if (unlikely(!py_level))
  11308. goto bad;
  11309. module = PyObject_CallFunctionObjArgs(py_import,
  11310. name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
  11311. Py_DECREF(py_level);
  11312. #else
  11313. module = PyImport_ImportModuleLevelObject(
  11314. name, __pyx_d, empty_dict, from_list, level);
  11315. #endif
  11316. }
  11317. }
  11318. bad:
  11319. Py_XDECREF(empty_dict);
  11320. Py_XDECREF(empty_list);
  11321. #if PY_MAJOR_VERSION < 3
  11322. Py_XDECREF(py_import);
  11323. #endif
  11324. return module;
  11325. }
  11326. /* ImportFrom */
  11327. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  11328. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  11329. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  11330. const char* module_name_str = 0;
  11331. PyObject* module_name = 0;
  11332. PyObject* module_dot = 0;
  11333. PyObject* full_name = 0;
  11334. PyErr_Clear();
  11335. module_name_str = PyModule_GetName(module);
  11336. if (unlikely(!module_name_str)) { goto modbad; }
  11337. module_name = PyUnicode_FromString(module_name_str);
  11338. if (unlikely(!module_name)) { goto modbad; }
  11339. module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__3);
  11340. if (unlikely(!module_dot)) { goto modbad; }
  11341. full_name = PyUnicode_Concat(module_dot, name);
  11342. if (unlikely(!full_name)) { goto modbad; }
  11343. #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
  11344. {
  11345. PyObject *modules = PyImport_GetModuleDict();
  11346. if (unlikely(!modules))
  11347. goto modbad;
  11348. value = PyObject_GetItem(modules, full_name);
  11349. }
  11350. #else
  11351. value = PyImport_GetModule(full_name);
  11352. #endif
  11353. modbad:
  11354. Py_XDECREF(full_name);
  11355. Py_XDECREF(module_dot);
  11356. Py_XDECREF(module_name);
  11357. }
  11358. if (unlikely(!value)) {
  11359. PyErr_Format(PyExc_ImportError,
  11360. #if PY_MAJOR_VERSION < 3
  11361. "cannot import name %.230s", PyString_AS_STRING(name));
  11362. #else
  11363. "cannot import name %S", name);
  11364. #endif
  11365. }
  11366. return value;
  11367. }
  11368. /* FixUpExtensionType */
  11369. #if CYTHON_USE_TYPE_SPECS
  11370. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  11371. #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  11372. CYTHON_UNUSED_VAR(spec);
  11373. CYTHON_UNUSED_VAR(type);
  11374. #else
  11375. const PyType_Slot *slot = spec->slots;
  11376. while (slot && slot->slot && slot->slot != Py_tp_members)
  11377. slot++;
  11378. if (slot && slot->slot == Py_tp_members) {
  11379. int changed = 0;
  11380. #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
  11381. const
  11382. #endif
  11383. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  11384. while (memb && memb->name) {
  11385. if (memb->name[0] == '_' && memb->name[1] == '_') {
  11386. #if PY_VERSION_HEX < 0x030900b1
  11387. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  11388. assert(memb->type == T_PYSSIZET);
  11389. assert(memb->flags == READONLY);
  11390. type->tp_weaklistoffset = memb->offset;
  11391. changed = 1;
  11392. }
  11393. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  11394. assert(memb->type == T_PYSSIZET);
  11395. assert(memb->flags == READONLY);
  11396. type->tp_dictoffset = memb->offset;
  11397. changed = 1;
  11398. }
  11399. #if CYTHON_METH_FASTCALL
  11400. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  11401. assert(memb->type == T_PYSSIZET);
  11402. assert(memb->flags == READONLY);
  11403. #if PY_VERSION_HEX >= 0x030800b4
  11404. type->tp_vectorcall_offset = memb->offset;
  11405. #else
  11406. type->tp_print = (printfunc) memb->offset;
  11407. #endif
  11408. changed = 1;
  11409. }
  11410. #endif
  11411. #else
  11412. if ((0));
  11413. #endif
  11414. #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
  11415. else if (strcmp(memb->name, "__module__") == 0) {
  11416. PyObject *descr;
  11417. assert(memb->type == T_OBJECT);
  11418. assert(memb->flags == 0 || memb->flags == READONLY);
  11419. descr = PyDescr_NewMember(type, memb);
  11420. if (unlikely(!descr))
  11421. return -1;
  11422. if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
  11423. Py_DECREF(descr);
  11424. return -1;
  11425. }
  11426. Py_DECREF(descr);
  11427. changed = 1;
  11428. }
  11429. #endif
  11430. }
  11431. memb++;
  11432. }
  11433. if (changed)
  11434. PyType_Modified(type);
  11435. }
  11436. #endif
  11437. return 0;
  11438. }
  11439. #endif
  11440. /* ValidateBasesTuple */
  11441. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  11442. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  11443. Py_ssize_t i, n;
  11444. #if CYTHON_ASSUME_SAFE_MACROS
  11445. n = PyTuple_GET_SIZE(bases);
  11446. #else
  11447. n = PyTuple_Size(bases);
  11448. if (n < 0) return -1;
  11449. #endif
  11450. for (i = 1; i < n; i++)
  11451. {
  11452. #if CYTHON_AVOID_BORROWED_REFS
  11453. PyObject *b0 = PySequence_GetItem(bases, i);
  11454. if (!b0) return -1;
  11455. #elif CYTHON_ASSUME_SAFE_MACROS
  11456. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  11457. #else
  11458. PyObject *b0 = PyTuple_GetItem(bases, i);
  11459. if (!b0) return -1;
  11460. #endif
  11461. PyTypeObject *b;
  11462. #if PY_MAJOR_VERSION < 3
  11463. if (PyClass_Check(b0))
  11464. {
  11465. PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
  11466. PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
  11467. #if CYTHON_AVOID_BORROWED_REFS
  11468. Py_DECREF(b0);
  11469. #endif
  11470. return -1;
  11471. }
  11472. #endif
  11473. b = (PyTypeObject*) b0;
  11474. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  11475. {
  11476. __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
  11477. PyErr_Format(PyExc_TypeError,
  11478. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  11479. __Pyx_DECREF_TypeName(b_name);
  11480. #if CYTHON_AVOID_BORROWED_REFS
  11481. Py_DECREF(b0);
  11482. #endif
  11483. return -1;
  11484. }
  11485. if (dictoffset == 0)
  11486. {
  11487. Py_ssize_t b_dictoffset = 0;
  11488. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  11489. b_dictoffset = b->tp_dictoffset;
  11490. #else
  11491. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  11492. if (!py_b_dictoffset) goto dictoffset_return;
  11493. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  11494. Py_DECREF(py_b_dictoffset);
  11495. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  11496. #endif
  11497. if (b_dictoffset) {
  11498. {
  11499. __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
  11500. PyErr_Format(PyExc_TypeError,
  11501. "extension type '%.200s' has no __dict__ slot, "
  11502. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  11503. "either add 'cdef dict __dict__' to the extension type "
  11504. "or add '__slots__ = [...]' to the base type",
  11505. type_name, b_name);
  11506. __Pyx_DECREF_TypeName(b_name);
  11507. }
  11508. #if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY)
  11509. dictoffset_return:
  11510. #endif
  11511. #if CYTHON_AVOID_BORROWED_REFS
  11512. Py_DECREF(b0);
  11513. #endif
  11514. return -1;
  11515. }
  11516. }
  11517. #if CYTHON_AVOID_BORROWED_REFS
  11518. Py_DECREF(b0);
  11519. #endif
  11520. }
  11521. return 0;
  11522. }
  11523. #endif
  11524. /* PyType_Ready */
  11525. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  11526. #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
  11527. (void)__Pyx_PyObject_CallMethod0;
  11528. #if CYTHON_USE_TYPE_SPECS
  11529. (void)__Pyx_validate_bases_tuple;
  11530. #endif
  11531. return PyType_Ready(t);
  11532. #else
  11533. int r;
  11534. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  11535. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  11536. return -1;
  11537. #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
  11538. {
  11539. int gc_was_enabled;
  11540. #if PY_VERSION_HEX >= 0x030A00b1
  11541. gc_was_enabled = PyGC_Disable();
  11542. (void)__Pyx_PyObject_CallMethod0;
  11543. #else
  11544. PyObject *ret, *py_status;
  11545. PyObject *gc = NULL;
  11546. #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
  11547. gc = PyImport_GetModule(__pyx_kp_u_gc);
  11548. #endif
  11549. if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
  11550. if (unlikely(!gc)) return -1;
  11551. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
  11552. if (unlikely(!py_status)) {
  11553. Py_DECREF(gc);
  11554. return -1;
  11555. }
  11556. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  11557. Py_DECREF(py_status);
  11558. if (gc_was_enabled > 0) {
  11559. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
  11560. if (unlikely(!ret)) {
  11561. Py_DECREF(gc);
  11562. return -1;
  11563. }
  11564. Py_DECREF(ret);
  11565. } else if (unlikely(gc_was_enabled == -1)) {
  11566. Py_DECREF(gc);
  11567. return -1;
  11568. }
  11569. #endif
  11570. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  11571. #if PY_VERSION_HEX >= 0x030A0000
  11572. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  11573. #endif
  11574. #else
  11575. (void)__Pyx_PyObject_CallMethod0;
  11576. #endif
  11577. r = PyType_Ready(t);
  11578. #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
  11579. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  11580. #if PY_VERSION_HEX >= 0x030A00b1
  11581. if (gc_was_enabled)
  11582. PyGC_Enable();
  11583. #else
  11584. if (gc_was_enabled) {
  11585. PyObject *tp, *v, *tb;
  11586. PyErr_Fetch(&tp, &v, &tb);
  11587. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
  11588. if (likely(ret || r == -1)) {
  11589. Py_XDECREF(ret);
  11590. PyErr_Restore(tp, v, tb);
  11591. } else {
  11592. Py_XDECREF(tp);
  11593. Py_XDECREF(v);
  11594. Py_XDECREF(tb);
  11595. r = -1;
  11596. }
  11597. }
  11598. Py_DECREF(gc);
  11599. #endif
  11600. }
  11601. #endif
  11602. return r;
  11603. #endif
  11604. }
  11605. /* PyObject_GenericGetAttrNoDict */
  11606. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  11607. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  11608. __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
  11609. PyErr_Format(PyExc_AttributeError,
  11610. #if PY_MAJOR_VERSION >= 3
  11611. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  11612. type_name, attr_name);
  11613. #else
  11614. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
  11615. type_name, PyString_AS_STRING(attr_name));
  11616. #endif
  11617. __Pyx_DECREF_TypeName(type_name);
  11618. return NULL;
  11619. }
  11620. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  11621. PyObject *descr;
  11622. PyTypeObject *tp = Py_TYPE(obj);
  11623. if (unlikely(!PyString_Check(attr_name))) {
  11624. return PyObject_GenericGetAttr(obj, attr_name);
  11625. }
  11626. assert(!tp->tp_dictoffset);
  11627. descr = _PyType_Lookup(tp, attr_name);
  11628. if (unlikely(!descr)) {
  11629. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  11630. }
  11631. Py_INCREF(descr);
  11632. #if PY_MAJOR_VERSION < 3
  11633. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  11634. #endif
  11635. {
  11636. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  11637. if (unlikely(f)) {
  11638. PyObject *res = f(descr, obj, (PyObject *)tp);
  11639. Py_DECREF(descr);
  11640. return res;
  11641. }
  11642. }
  11643. return descr;
  11644. }
  11645. #endif
  11646. /* FastTypeChecks */
  11647. #if CYTHON_COMPILING_IN_CPYTHON
  11648. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  11649. while (a) {
  11650. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  11651. if (a == b)
  11652. return 1;
  11653. }
  11654. return b == &PyBaseObject_Type;
  11655. }
  11656. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  11657. PyObject *mro;
  11658. if (a == b) return 1;
  11659. mro = a->tp_mro;
  11660. if (likely(mro)) {
  11661. Py_ssize_t i, n;
  11662. n = PyTuple_GET_SIZE(mro);
  11663. for (i = 0; i < n; i++) {
  11664. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  11665. return 1;
  11666. }
  11667. return 0;
  11668. }
  11669. return __Pyx_InBases(a, b);
  11670. }
  11671. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  11672. PyObject *mro;
  11673. if (cls == a || cls == b) return 1;
  11674. mro = cls->tp_mro;
  11675. if (likely(mro)) {
  11676. Py_ssize_t i, n;
  11677. n = PyTuple_GET_SIZE(mro);
  11678. for (i = 0; i < n; i++) {
  11679. PyObject *base = PyTuple_GET_ITEM(mro, i);
  11680. if (base == (PyObject *)a || base == (PyObject *)b)
  11681. return 1;
  11682. }
  11683. return 0;
  11684. }
  11685. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  11686. }
  11687. #if PY_MAJOR_VERSION == 2
  11688. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  11689. PyObject *exception, *value, *tb;
  11690. int res;
  11691. __Pyx_PyThreadState_declare
  11692. __Pyx_PyThreadState_assign
  11693. __Pyx_ErrFetch(&exception, &value, &tb);
  11694. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  11695. if (unlikely(res == -1)) {
  11696. PyErr_WriteUnraisable(err);
  11697. res = 0;
  11698. }
  11699. if (!res) {
  11700. res = PyObject_IsSubclass(err, exc_type2);
  11701. if (unlikely(res == -1)) {
  11702. PyErr_WriteUnraisable(err);
  11703. res = 0;
  11704. }
  11705. }
  11706. __Pyx_ErrRestore(exception, value, tb);
  11707. return res;
  11708. }
  11709. #else
  11710. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  11711. if (exc_type1) {
  11712. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  11713. } else {
  11714. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  11715. }
  11716. }
  11717. #endif
  11718. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  11719. Py_ssize_t i, n;
  11720. assert(PyExceptionClass_Check(exc_type));
  11721. n = PyTuple_GET_SIZE(tuple);
  11722. #if PY_MAJOR_VERSION >= 3
  11723. for (i=0; i<n; i++) {
  11724. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  11725. }
  11726. #endif
  11727. for (i=0; i<n; i++) {
  11728. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  11729. #if PY_MAJOR_VERSION < 3
  11730. if (likely(exc_type == t)) return 1;
  11731. #endif
  11732. if (likely(PyExceptionClass_Check(t))) {
  11733. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  11734. } else {
  11735. }
  11736. }
  11737. return 0;
  11738. }
  11739. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  11740. if (likely(err == exc_type)) return 1;
  11741. if (likely(PyExceptionClass_Check(err))) {
  11742. if (likely(PyExceptionClass_Check(exc_type))) {
  11743. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  11744. } else if (likely(PyTuple_Check(exc_type))) {
  11745. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  11746. } else {
  11747. }
  11748. }
  11749. return PyErr_GivenExceptionMatches(err, exc_type);
  11750. }
  11751. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  11752. assert(PyExceptionClass_Check(exc_type1));
  11753. assert(PyExceptionClass_Check(exc_type2));
  11754. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  11755. if (likely(PyExceptionClass_Check(err))) {
  11756. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  11757. }
  11758. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  11759. }
  11760. #endif
  11761. /* ImportDottedModule */
  11762. #if PY_MAJOR_VERSION >= 3
  11763. static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
  11764. PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
  11765. if (unlikely(PyErr_Occurred())) {
  11766. PyErr_Clear();
  11767. }
  11768. if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
  11769. partial_name = name;
  11770. } else {
  11771. slice = PySequence_GetSlice(parts_tuple, 0, count);
  11772. if (unlikely(!slice))
  11773. goto bad;
  11774. sep = PyUnicode_FromStringAndSize(".", 1);
  11775. if (unlikely(!sep))
  11776. goto bad;
  11777. partial_name = PyUnicode_Join(sep, slice);
  11778. }
  11779. PyErr_Format(
  11780. #if PY_MAJOR_VERSION < 3
  11781. PyExc_ImportError,
  11782. "No module named '%s'", PyString_AS_STRING(partial_name));
  11783. #else
  11784. #if PY_VERSION_HEX >= 0x030600B1
  11785. PyExc_ModuleNotFoundError,
  11786. #else
  11787. PyExc_ImportError,
  11788. #endif
  11789. "No module named '%U'", partial_name);
  11790. #endif
  11791. bad:
  11792. Py_XDECREF(sep);
  11793. Py_XDECREF(slice);
  11794. Py_XDECREF(partial_name);
  11795. return NULL;
  11796. }
  11797. #endif
  11798. #if PY_MAJOR_VERSION >= 3
  11799. static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
  11800. PyObject *imported_module;
  11801. #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
  11802. PyObject *modules = PyImport_GetModuleDict();
  11803. if (unlikely(!modules))
  11804. return NULL;
  11805. imported_module = __Pyx_PyDict_GetItemStr(modules, name);
  11806. Py_XINCREF(imported_module);
  11807. #else
  11808. imported_module = PyImport_GetModule(name);
  11809. #endif
  11810. return imported_module;
  11811. }
  11812. #endif
  11813. #if PY_MAJOR_VERSION >= 3
  11814. static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
  11815. Py_ssize_t i, nparts;
  11816. nparts = PyTuple_GET_SIZE(parts_tuple);
  11817. for (i=1; i < nparts && module; i++) {
  11818. PyObject *part, *submodule;
  11819. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11820. part = PyTuple_GET_ITEM(parts_tuple, i);
  11821. #else
  11822. part = PySequence_ITEM(parts_tuple, i);
  11823. #endif
  11824. submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
  11825. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  11826. Py_DECREF(part);
  11827. #endif
  11828. Py_DECREF(module);
  11829. module = submodule;
  11830. }
  11831. if (unlikely(!module)) {
  11832. return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
  11833. }
  11834. return module;
  11835. }
  11836. #endif
  11837. static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
  11838. #if PY_MAJOR_VERSION < 3
  11839. PyObject *module, *from_list, *star = __pyx_n_s__4;
  11840. CYTHON_UNUSED_VAR(parts_tuple);
  11841. from_list = PyList_New(1);
  11842. if (unlikely(!from_list))
  11843. return NULL;
  11844. Py_INCREF(star);
  11845. PyList_SET_ITEM(from_list, 0, star);
  11846. module = __Pyx_Import(name, from_list, 0);
  11847. Py_DECREF(from_list);
  11848. return module;
  11849. #else
  11850. PyObject *imported_module;
  11851. PyObject *module = __Pyx_Import(name, NULL, 0);
  11852. if (!parts_tuple || unlikely(!module))
  11853. return module;
  11854. imported_module = __Pyx__ImportDottedModule_Lookup(name);
  11855. if (likely(imported_module)) {
  11856. Py_DECREF(module);
  11857. return imported_module;
  11858. }
  11859. PyErr_Clear();
  11860. return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
  11861. #endif
  11862. }
  11863. static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
  11864. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
  11865. PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
  11866. if (likely(module)) {
  11867. PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
  11868. if (likely(spec)) {
  11869. PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
  11870. if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
  11871. Py_DECREF(spec);
  11872. spec = NULL;
  11873. }
  11874. Py_XDECREF(unsafe);
  11875. }
  11876. if (likely(!spec)) {
  11877. PyErr_Clear();
  11878. return module;
  11879. }
  11880. Py_DECREF(spec);
  11881. Py_DECREF(module);
  11882. } else if (PyErr_Occurred()) {
  11883. PyErr_Clear();
  11884. }
  11885. #endif
  11886. return __Pyx__ImportDottedModule(name, parts_tuple);
  11887. }
  11888. /* FetchSharedCythonModule */
  11889. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  11890. return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
  11891. }
  11892. /* FetchCommonType */
  11893. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  11894. const char *name,
  11895. Py_ssize_t basicsize,
  11896. Py_ssize_t expected_basicsize) {
  11897. if (!PyType_Check(cached_type)) {
  11898. PyErr_Format(PyExc_TypeError,
  11899. "Shared Cython type %.200s is not a type object", name);
  11900. return -1;
  11901. }
  11902. if (basicsize != expected_basicsize) {
  11903. PyErr_Format(PyExc_TypeError,
  11904. "Shared Cython type %.200s has the wrong size, try recompiling",
  11905. name);
  11906. return -1;
  11907. }
  11908. return 0;
  11909. }
  11910. #if !CYTHON_USE_TYPE_SPECS
  11911. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  11912. PyObject* abi_module;
  11913. const char* object_name;
  11914. PyTypeObject *cached_type = NULL;
  11915. abi_module = __Pyx_FetchSharedCythonABIModule();
  11916. if (!abi_module) return NULL;
  11917. object_name = strrchr(type->tp_name, '.');
  11918. object_name = object_name ? object_name+1 : type->tp_name;
  11919. cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
  11920. if (cached_type) {
  11921. if (__Pyx_VerifyCachedType(
  11922. (PyObject *)cached_type,
  11923. object_name,
  11924. cached_type->tp_basicsize,
  11925. type->tp_basicsize) < 0) {
  11926. goto bad;
  11927. }
  11928. goto done;
  11929. }
  11930. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  11931. PyErr_Clear();
  11932. if (PyType_Ready(type) < 0) goto bad;
  11933. if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
  11934. goto bad;
  11935. Py_INCREF(type);
  11936. cached_type = type;
  11937. done:
  11938. Py_DECREF(abi_module);
  11939. return cached_type;
  11940. bad:
  11941. Py_XDECREF(cached_type);
  11942. cached_type = NULL;
  11943. goto done;
  11944. }
  11945. #else
  11946. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
  11947. PyObject *abi_module, *cached_type = NULL;
  11948. const char* object_name = strrchr(spec->name, '.');
  11949. object_name = object_name ? object_name+1 : spec->name;
  11950. abi_module = __Pyx_FetchSharedCythonABIModule();
  11951. if (!abi_module) return NULL;
  11952. cached_type = PyObject_GetAttrString(abi_module, object_name);
  11953. if (cached_type) {
  11954. Py_ssize_t basicsize;
  11955. #if CYTHON_COMPILING_IN_LIMITED_API
  11956. PyObject *py_basicsize;
  11957. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  11958. if (unlikely(!py_basicsize)) goto bad;
  11959. basicsize = PyLong_AsSsize_t(py_basicsize);
  11960. Py_DECREF(py_basicsize);
  11961. py_basicsize = 0;
  11962. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  11963. #else
  11964. basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
  11965. #endif
  11966. if (__Pyx_VerifyCachedType(
  11967. cached_type,
  11968. object_name,
  11969. basicsize,
  11970. spec->basicsize) < 0) {
  11971. goto bad;
  11972. }
  11973. goto done;
  11974. }
  11975. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  11976. PyErr_Clear();
  11977. CYTHON_UNUSED_VAR(module);
  11978. cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
  11979. if (unlikely(!cached_type)) goto bad;
  11980. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  11981. if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
  11982. done:
  11983. Py_DECREF(abi_module);
  11984. assert(cached_type == NULL || PyType_Check(cached_type));
  11985. return (PyTypeObject *) cached_type;
  11986. bad:
  11987. Py_XDECREF(cached_type);
  11988. cached_type = NULL;
  11989. goto done;
  11990. }
  11991. #endif
  11992. /* PyVectorcallFastCallDict */
  11993. #if CYTHON_METH_FASTCALL
  11994. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  11995. {
  11996. PyObject *res = NULL;
  11997. PyObject *kwnames;
  11998. PyObject **newargs;
  11999. PyObject **kwvalues;
  12000. Py_ssize_t i, pos;
  12001. size_t j;
  12002. PyObject *key, *value;
  12003. unsigned long keys_are_strings;
  12004. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  12005. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  12006. if (unlikely(newargs == NULL)) {
  12007. PyErr_NoMemory();
  12008. return NULL;
  12009. }
  12010. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  12011. kwnames = PyTuple_New(nkw);
  12012. if (unlikely(kwnames == NULL)) {
  12013. PyMem_Free(newargs);
  12014. return NULL;
  12015. }
  12016. kwvalues = newargs + nargs;
  12017. pos = i = 0;
  12018. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  12019. while (PyDict_Next(kw, &pos, &key, &value)) {
  12020. keys_are_strings &= Py_TYPE(key)->tp_flags;
  12021. Py_INCREF(key);
  12022. Py_INCREF(value);
  12023. PyTuple_SET_ITEM(kwnames, i, key);
  12024. kwvalues[i] = value;
  12025. i++;
  12026. }
  12027. if (unlikely(!keys_are_strings)) {
  12028. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  12029. goto cleanup;
  12030. }
  12031. res = vc(func, newargs, nargs, kwnames);
  12032. cleanup:
  12033. Py_DECREF(kwnames);
  12034. for (i = 0; i < nkw; i++)
  12035. Py_DECREF(kwvalues[i]);
  12036. PyMem_Free(newargs);
  12037. return res;
  12038. }
  12039. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  12040. {
  12041. if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
  12042. return vc(func, args, nargs, NULL);
  12043. }
  12044. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  12045. }
  12046. #endif
  12047. /* CythonFunctionShared */
  12048. #if CYTHON_COMPILING_IN_LIMITED_API
  12049. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
  12050. if (__Pyx_CyFunction_Check(func)) {
  12051. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  12052. } else if (PyCFunction_Check(func)) {
  12053. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  12054. }
  12055. return 0;
  12056. }
  12057. #else
  12058. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
  12059. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  12060. }
  12061. #endif
  12062. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  12063. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  12064. __Pyx_Py_XDECREF_SET(
  12065. __Pyx_CyFunction_GetClassObj(f),
  12066. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  12067. #else
  12068. __Pyx_Py_XDECREF_SET(
  12069. ((PyCMethodObject *) (f))->mm_class,
  12070. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  12071. #endif
  12072. }
  12073. static PyObject *
  12074. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
  12075. {
  12076. CYTHON_UNUSED_VAR(closure);
  12077. if (unlikely(op->func_doc == NULL)) {
  12078. #if CYTHON_COMPILING_IN_LIMITED_API
  12079. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  12080. if (unlikely(!op->func_doc)) return NULL;
  12081. #else
  12082. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  12083. #if PY_MAJOR_VERSION >= 3
  12084. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  12085. #else
  12086. op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  12087. #endif
  12088. if (unlikely(op->func_doc == NULL))
  12089. return NULL;
  12090. } else {
  12091. Py_INCREF(Py_None);
  12092. return Py_None;
  12093. }
  12094. #endif
  12095. }
  12096. Py_INCREF(op->func_doc);
  12097. return op->func_doc;
  12098. }
  12099. static int
  12100. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  12101. {
  12102. CYTHON_UNUSED_VAR(context);
  12103. if (value == NULL) {
  12104. value = Py_None;
  12105. }
  12106. Py_INCREF(value);
  12107. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  12108. return 0;
  12109. }
  12110. static PyObject *
  12111. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  12112. {
  12113. CYTHON_UNUSED_VAR(context);
  12114. if (unlikely(op->func_name == NULL)) {
  12115. #if CYTHON_COMPILING_IN_LIMITED_API
  12116. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  12117. #elif PY_MAJOR_VERSION >= 3
  12118. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  12119. #else
  12120. op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  12121. #endif
  12122. if (unlikely(op->func_name == NULL))
  12123. return NULL;
  12124. }
  12125. Py_INCREF(op->func_name);
  12126. return op->func_name;
  12127. }
  12128. static int
  12129. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  12130. {
  12131. CYTHON_UNUSED_VAR(context);
  12132. #if PY_MAJOR_VERSION >= 3
  12133. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  12134. #else
  12135. if (unlikely(value == NULL || !PyString_Check(value)))
  12136. #endif
  12137. {
  12138. PyErr_SetString(PyExc_TypeError,
  12139. "__name__ must be set to a string object");
  12140. return -1;
  12141. }
  12142. Py_INCREF(value);
  12143. __Pyx_Py_XDECREF_SET(op->func_name, value);
  12144. return 0;
  12145. }
  12146. static PyObject *
  12147. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  12148. {
  12149. CYTHON_UNUSED_VAR(context);
  12150. Py_INCREF(op->func_qualname);
  12151. return op->func_qualname;
  12152. }
  12153. static int
  12154. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  12155. {
  12156. CYTHON_UNUSED_VAR(context);
  12157. #if PY_MAJOR_VERSION >= 3
  12158. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  12159. #else
  12160. if (unlikely(value == NULL || !PyString_Check(value)))
  12161. #endif
  12162. {
  12163. PyErr_SetString(PyExc_TypeError,
  12164. "__qualname__ must be set to a string object");
  12165. return -1;
  12166. }
  12167. Py_INCREF(value);
  12168. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  12169. return 0;
  12170. }
  12171. static PyObject *
  12172. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  12173. {
  12174. CYTHON_UNUSED_VAR(context);
  12175. if (unlikely(op->func_dict == NULL)) {
  12176. op->func_dict = PyDict_New();
  12177. if (unlikely(op->func_dict == NULL))
  12178. return NULL;
  12179. }
  12180. Py_INCREF(op->func_dict);
  12181. return op->func_dict;
  12182. }
  12183. static int
  12184. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  12185. {
  12186. CYTHON_UNUSED_VAR(context);
  12187. if (unlikely(value == NULL)) {
  12188. PyErr_SetString(PyExc_TypeError,
  12189. "function's dictionary may not be deleted");
  12190. return -1;
  12191. }
  12192. if (unlikely(!PyDict_Check(value))) {
  12193. PyErr_SetString(PyExc_TypeError,
  12194. "setting function's dictionary to a non-dict");
  12195. return -1;
  12196. }
  12197. Py_INCREF(value);
  12198. __Pyx_Py_XDECREF_SET(op->func_dict, value);
  12199. return 0;
  12200. }
  12201. static PyObject *
  12202. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  12203. {
  12204. CYTHON_UNUSED_VAR(context);
  12205. Py_INCREF(op->func_globals);
  12206. return op->func_globals;
  12207. }
  12208. static PyObject *
  12209. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  12210. {
  12211. CYTHON_UNUSED_VAR(op);
  12212. CYTHON_UNUSED_VAR(context);
  12213. Py_INCREF(Py_None);
  12214. return Py_None;
  12215. }
  12216. static PyObject *
  12217. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  12218. {
  12219. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  12220. CYTHON_UNUSED_VAR(context);
  12221. Py_INCREF(result);
  12222. return result;
  12223. }
  12224. static int
  12225. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  12226. int result = 0;
  12227. PyObject *res = op->defaults_getter((PyObject *) op);
  12228. if (unlikely(!res))
  12229. return -1;
  12230. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12231. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  12232. Py_INCREF(op->defaults_tuple);
  12233. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  12234. Py_INCREF(op->defaults_kwdict);
  12235. #else
  12236. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  12237. if (unlikely(!op->defaults_tuple)) result = -1;
  12238. else {
  12239. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  12240. if (unlikely(!op->defaults_kwdict)) result = -1;
  12241. }
  12242. #endif
  12243. Py_DECREF(res);
  12244. return result;
  12245. }
  12246. static int
  12247. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  12248. CYTHON_UNUSED_VAR(context);
  12249. if (!value) {
  12250. value = Py_None;
  12251. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  12252. PyErr_SetString(PyExc_TypeError,
  12253. "__defaults__ must be set to a tuple object");
  12254. return -1;
  12255. }
  12256. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  12257. "currently affect the values used in function calls", 1);
  12258. Py_INCREF(value);
  12259. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  12260. return 0;
  12261. }
  12262. static PyObject *
  12263. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  12264. PyObject* result = op->defaults_tuple;
  12265. CYTHON_UNUSED_VAR(context);
  12266. if (unlikely(!result)) {
  12267. if (op->defaults_getter) {
  12268. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  12269. result = op->defaults_tuple;
  12270. } else {
  12271. result = Py_None;
  12272. }
  12273. }
  12274. Py_INCREF(result);
  12275. return result;
  12276. }
  12277. static int
  12278. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  12279. CYTHON_UNUSED_VAR(context);
  12280. if (!value) {
  12281. value = Py_None;
  12282. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  12283. PyErr_SetString(PyExc_TypeError,
  12284. "__kwdefaults__ must be set to a dict object");
  12285. return -1;
  12286. }
  12287. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  12288. "currently affect the values used in function calls", 1);
  12289. Py_INCREF(value);
  12290. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  12291. return 0;
  12292. }
  12293. static PyObject *
  12294. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  12295. PyObject* result = op->defaults_kwdict;
  12296. CYTHON_UNUSED_VAR(context);
  12297. if (unlikely(!result)) {
  12298. if (op->defaults_getter) {
  12299. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  12300. result = op->defaults_kwdict;
  12301. } else {
  12302. result = Py_None;
  12303. }
  12304. }
  12305. Py_INCREF(result);
  12306. return result;
  12307. }
  12308. static int
  12309. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  12310. CYTHON_UNUSED_VAR(context);
  12311. if (!value || value == Py_None) {
  12312. value = NULL;
  12313. } else if (unlikely(!PyDict_Check(value))) {
  12314. PyErr_SetString(PyExc_TypeError,
  12315. "__annotations__ must be set to a dict object");
  12316. return -1;
  12317. }
  12318. Py_XINCREF(value);
  12319. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  12320. return 0;
  12321. }
  12322. static PyObject *
  12323. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  12324. PyObject* result = op->func_annotations;
  12325. CYTHON_UNUSED_VAR(context);
  12326. if (unlikely(!result)) {
  12327. result = PyDict_New();
  12328. if (unlikely(!result)) return NULL;
  12329. op->func_annotations = result;
  12330. }
  12331. Py_INCREF(result);
  12332. return result;
  12333. }
  12334. static PyObject *
  12335. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  12336. int is_coroutine;
  12337. CYTHON_UNUSED_VAR(context);
  12338. if (op->func_is_coroutine) {
  12339. return __Pyx_NewRef(op->func_is_coroutine);
  12340. }
  12341. is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  12342. #if PY_VERSION_HEX >= 0x03050000
  12343. if (is_coroutine) {
  12344. PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
  12345. fromlist = PyList_New(1);
  12346. if (unlikely(!fromlist)) return NULL;
  12347. Py_INCREF(marker);
  12348. #if CYTHON_ASSUME_SAFE_MACROS
  12349. PyList_SET_ITEM(fromlist, 0, marker);
  12350. #else
  12351. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  12352. Py_DECREF(marker);
  12353. Py_DECREF(fromlist);
  12354. return NULL;
  12355. }
  12356. #endif
  12357. module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
  12358. Py_DECREF(fromlist);
  12359. if (unlikely(!module)) goto ignore;
  12360. op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
  12361. Py_DECREF(module);
  12362. if (likely(op->func_is_coroutine)) {
  12363. return __Pyx_NewRef(op->func_is_coroutine);
  12364. }
  12365. ignore:
  12366. PyErr_Clear();
  12367. }
  12368. #endif
  12369. op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
  12370. return __Pyx_NewRef(op->func_is_coroutine);
  12371. }
  12372. #if CYTHON_COMPILING_IN_LIMITED_API
  12373. static PyObject *
  12374. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  12375. CYTHON_UNUSED_VAR(context);
  12376. return PyObject_GetAttrString(op->func, "__module__");
  12377. }
  12378. static int
  12379. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  12380. CYTHON_UNUSED_VAR(context);
  12381. return PyObject_SetAttrString(op->func, "__module__", value);
  12382. }
  12383. #endif
  12384. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  12385. {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  12386. {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  12387. {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  12388. {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  12389. {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  12390. {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  12391. {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  12392. {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  12393. {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  12394. {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  12395. {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  12396. {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  12397. {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  12398. {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  12399. {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  12400. {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  12401. {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  12402. {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  12403. #if CYTHON_COMPILING_IN_LIMITED_API
  12404. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  12405. #endif
  12406. {0, 0, 0, 0, 0}
  12407. };
  12408. static PyMemberDef __pyx_CyFunction_members[] = {
  12409. #if !CYTHON_COMPILING_IN_LIMITED_API
  12410. {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  12411. #endif
  12412. #if CYTHON_USE_TYPE_SPECS
  12413. {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  12414. #if CYTHON_METH_FASTCALL
  12415. #if CYTHON_BACKPORT_VECTORCALL
  12416. {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  12417. #else
  12418. #if !CYTHON_COMPILING_IN_LIMITED_API
  12419. {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  12420. #endif
  12421. #endif
  12422. #endif
  12423. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  12424. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  12425. #else
  12426. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  12427. #endif
  12428. #endif
  12429. {0, 0, 0, 0, 0}
  12430. };
  12431. static PyObject *
  12432. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  12433. {
  12434. CYTHON_UNUSED_VAR(args);
  12435. #if PY_MAJOR_VERSION >= 3
  12436. Py_INCREF(m->func_qualname);
  12437. return m->func_qualname;
  12438. #else
  12439. return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
  12440. #endif
  12441. }
  12442. static PyMethodDef __pyx_CyFunction_methods[] = {
  12443. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  12444. {0, 0, 0, 0}
  12445. };
  12446. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  12447. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  12448. #else
  12449. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  12450. #endif
  12451. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  12452. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  12453. #if !CYTHON_COMPILING_IN_LIMITED_API
  12454. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  12455. #endif
  12456. if (unlikely(op == NULL))
  12457. return NULL;
  12458. #if CYTHON_COMPILING_IN_LIMITED_API
  12459. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  12460. if (unlikely(!op->func)) return NULL;
  12461. #endif
  12462. op->flags = flags;
  12463. __Pyx_CyFunction_weakreflist(op) = NULL;
  12464. #if !CYTHON_COMPILING_IN_LIMITED_API
  12465. cf->m_ml = ml;
  12466. cf->m_self = (PyObject *) op;
  12467. #endif
  12468. Py_XINCREF(closure);
  12469. op->func_closure = closure;
  12470. #if !CYTHON_COMPILING_IN_LIMITED_API
  12471. Py_XINCREF(module);
  12472. cf->m_module = module;
  12473. #endif
  12474. op->func_dict = NULL;
  12475. op->func_name = NULL;
  12476. Py_INCREF(qualname);
  12477. op->func_qualname = qualname;
  12478. op->func_doc = NULL;
  12479. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  12480. op->func_classobj = NULL;
  12481. #else
  12482. ((PyCMethodObject*)op)->mm_class = NULL;
  12483. #endif
  12484. op->func_globals = globals;
  12485. Py_INCREF(op->func_globals);
  12486. Py_XINCREF(code);
  12487. op->func_code = code;
  12488. op->defaults_pyobjects = 0;
  12489. op->defaults_size = 0;
  12490. op->defaults = NULL;
  12491. op->defaults_tuple = NULL;
  12492. op->defaults_kwdict = NULL;
  12493. op->defaults_getter = NULL;
  12494. op->func_annotations = NULL;
  12495. op->func_is_coroutine = NULL;
  12496. #if CYTHON_METH_FASTCALL
  12497. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  12498. case METH_NOARGS:
  12499. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  12500. break;
  12501. case METH_O:
  12502. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  12503. break;
  12504. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  12505. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  12506. break;
  12507. case METH_FASTCALL | METH_KEYWORDS:
  12508. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  12509. break;
  12510. case METH_VARARGS | METH_KEYWORDS:
  12511. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  12512. break;
  12513. default:
  12514. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  12515. Py_DECREF(op);
  12516. return NULL;
  12517. }
  12518. #endif
  12519. return (PyObject *) op;
  12520. }
  12521. static int
  12522. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  12523. {
  12524. Py_CLEAR(m->func_closure);
  12525. #if CYTHON_COMPILING_IN_LIMITED_API
  12526. Py_CLEAR(m->func);
  12527. #else
  12528. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  12529. #endif
  12530. Py_CLEAR(m->func_dict);
  12531. Py_CLEAR(m->func_name);
  12532. Py_CLEAR(m->func_qualname);
  12533. Py_CLEAR(m->func_doc);
  12534. Py_CLEAR(m->func_globals);
  12535. Py_CLEAR(m->func_code);
  12536. #if !CYTHON_COMPILING_IN_LIMITED_API
  12537. #if PY_VERSION_HEX < 0x030900B1
  12538. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  12539. #else
  12540. {
  12541. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  12542. ((PyCMethodObject *) (m))->mm_class = NULL;
  12543. Py_XDECREF(cls);
  12544. }
  12545. #endif
  12546. #endif
  12547. Py_CLEAR(m->defaults_tuple);
  12548. Py_CLEAR(m->defaults_kwdict);
  12549. Py_CLEAR(m->func_annotations);
  12550. Py_CLEAR(m->func_is_coroutine);
  12551. if (m->defaults) {
  12552. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  12553. int i;
  12554. for (i = 0; i < m->defaults_pyobjects; i++)
  12555. Py_XDECREF(pydefaults[i]);
  12556. PyObject_Free(m->defaults);
  12557. m->defaults = NULL;
  12558. }
  12559. return 0;
  12560. }
  12561. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  12562. {
  12563. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  12564. PyObject_ClearWeakRefs((PyObject *) m);
  12565. __Pyx_CyFunction_clear(m);
  12566. __Pyx_PyHeapTypeObject_GC_Del(m);
  12567. }
  12568. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  12569. {
  12570. PyObject_GC_UnTrack(m);
  12571. __Pyx__CyFunction_dealloc(m);
  12572. }
  12573. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  12574. {
  12575. Py_VISIT(m->func_closure);
  12576. #if CYTHON_COMPILING_IN_LIMITED_API
  12577. Py_VISIT(m->func);
  12578. #else
  12579. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  12580. #endif
  12581. Py_VISIT(m->func_dict);
  12582. Py_VISIT(m->func_name);
  12583. Py_VISIT(m->func_qualname);
  12584. Py_VISIT(m->func_doc);
  12585. Py_VISIT(m->func_globals);
  12586. Py_VISIT(m->func_code);
  12587. #if !CYTHON_COMPILING_IN_LIMITED_API
  12588. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  12589. #endif
  12590. Py_VISIT(m->defaults_tuple);
  12591. Py_VISIT(m->defaults_kwdict);
  12592. Py_VISIT(m->func_is_coroutine);
  12593. if (m->defaults) {
  12594. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  12595. int i;
  12596. for (i = 0; i < m->defaults_pyobjects; i++)
  12597. Py_VISIT(pydefaults[i]);
  12598. }
  12599. return 0;
  12600. }
  12601. static PyObject*
  12602. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  12603. {
  12604. #if PY_MAJOR_VERSION >= 3
  12605. return PyUnicode_FromFormat("<cyfunction %U at %p>",
  12606. op->func_qualname, (void *)op);
  12607. #else
  12608. return PyString_FromFormat("<cyfunction %s at %p>",
  12609. PyString_AsString(op->func_qualname), (void *)op);
  12610. #endif
  12611. }
  12612. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  12613. #if CYTHON_COMPILING_IN_LIMITED_API
  12614. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  12615. PyObject *py_name = NULL;
  12616. PyCFunction meth;
  12617. int flags;
  12618. meth = PyCFunction_GetFunction(f);
  12619. if (unlikely(!meth)) return NULL;
  12620. flags = PyCFunction_GetFlags(f);
  12621. if (unlikely(flags < 0)) return NULL;
  12622. #else
  12623. PyCFunctionObject* f = (PyCFunctionObject*)func;
  12624. PyCFunction meth = f->m_ml->ml_meth;
  12625. int flags = f->m_ml->ml_flags;
  12626. #endif
  12627. Py_ssize_t size;
  12628. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  12629. case METH_VARARGS:
  12630. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  12631. return (*meth)(self, arg);
  12632. break;
  12633. case METH_VARARGS | METH_KEYWORDS:
  12634. return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
  12635. case METH_NOARGS:
  12636. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  12637. #if CYTHON_ASSUME_SAFE_MACROS
  12638. size = PyTuple_GET_SIZE(arg);
  12639. #else
  12640. size = PyTuple_Size(arg);
  12641. if (unlikely(size < 0)) return NULL;
  12642. #endif
  12643. if (likely(size == 0))
  12644. return (*meth)(self, NULL);
  12645. #if CYTHON_COMPILING_IN_LIMITED_API
  12646. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  12647. if (!py_name) return NULL;
  12648. PyErr_Format(PyExc_TypeError,
  12649. "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12650. py_name, size);
  12651. Py_DECREF(py_name);
  12652. #else
  12653. PyErr_Format(PyExc_TypeError,
  12654. "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12655. f->m_ml->ml_name, size);
  12656. #endif
  12657. return NULL;
  12658. }
  12659. break;
  12660. case METH_O:
  12661. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  12662. #if CYTHON_ASSUME_SAFE_MACROS
  12663. size = PyTuple_GET_SIZE(arg);
  12664. #else
  12665. size = PyTuple_Size(arg);
  12666. if (unlikely(size < 0)) return NULL;
  12667. #endif
  12668. if (likely(size == 1)) {
  12669. PyObject *result, *arg0;
  12670. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12671. arg0 = PyTuple_GET_ITEM(arg, 0);
  12672. #else
  12673. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  12674. #endif
  12675. result = (*meth)(self, arg0);
  12676. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  12677. Py_DECREF(arg0);
  12678. #endif
  12679. return result;
  12680. }
  12681. #if CYTHON_COMPILING_IN_LIMITED_API
  12682. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  12683. if (!py_name) return NULL;
  12684. PyErr_Format(PyExc_TypeError,
  12685. "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12686. py_name, size);
  12687. Py_DECREF(py_name);
  12688. #else
  12689. PyErr_Format(PyExc_TypeError,
  12690. "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12691. f->m_ml->ml_name, size);
  12692. #endif
  12693. return NULL;
  12694. }
  12695. break;
  12696. default:
  12697. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  12698. return NULL;
  12699. }
  12700. #if CYTHON_COMPILING_IN_LIMITED_API
  12701. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  12702. if (!py_name) return NULL;
  12703. PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
  12704. py_name);
  12705. Py_DECREF(py_name);
  12706. #else
  12707. PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  12708. f->m_ml->ml_name);
  12709. #endif
  12710. return NULL;
  12711. }
  12712. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  12713. PyObject *self, *result;
  12714. #if CYTHON_COMPILING_IN_LIMITED_API
  12715. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  12716. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  12717. #else
  12718. self = ((PyCFunctionObject*)func)->m_self;
  12719. #endif
  12720. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  12721. return result;
  12722. }
  12723. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  12724. PyObject *result;
  12725. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  12726. #if CYTHON_METH_FASTCALL
  12727. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  12728. if (vc) {
  12729. #if CYTHON_ASSUME_SAFE_MACROS
  12730. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  12731. #else
  12732. (void) &__Pyx_PyVectorcall_FastCallDict;
  12733. return PyVectorcall_Call(func, args, kw);
  12734. #endif
  12735. }
  12736. #endif
  12737. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  12738. Py_ssize_t argc;
  12739. PyObject *new_args;
  12740. PyObject *self;
  12741. #if CYTHON_ASSUME_SAFE_MACROS
  12742. argc = PyTuple_GET_SIZE(args);
  12743. #else
  12744. argc = PyTuple_Size(args);
  12745. if (unlikely(!argc) < 0) return NULL;
  12746. #endif
  12747. new_args = PyTuple_GetSlice(args, 1, argc);
  12748. if (unlikely(!new_args))
  12749. return NULL;
  12750. self = PyTuple_GetItem(args, 0);
  12751. if (unlikely(!self)) {
  12752. Py_DECREF(new_args);
  12753. #if PY_MAJOR_VERSION > 2
  12754. PyErr_Format(PyExc_TypeError,
  12755. "unbound method %.200S() needs an argument",
  12756. cyfunc->func_qualname);
  12757. #else
  12758. PyErr_SetString(PyExc_TypeError,
  12759. "unbound method needs an argument");
  12760. #endif
  12761. return NULL;
  12762. }
  12763. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  12764. Py_DECREF(new_args);
  12765. } else {
  12766. result = __Pyx_CyFunction_Call(func, args, kw);
  12767. }
  12768. return result;
  12769. }
  12770. #if CYTHON_METH_FASTCALL
  12771. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  12772. {
  12773. int ret = 0;
  12774. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  12775. if (unlikely(nargs < 1)) {
  12776. PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
  12777. ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
  12778. return -1;
  12779. }
  12780. ret = 1;
  12781. }
  12782. if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
  12783. PyErr_Format(PyExc_TypeError,
  12784. "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
  12785. return -1;
  12786. }
  12787. return ret;
  12788. }
  12789. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  12790. {
  12791. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  12792. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  12793. #if CYTHON_BACKPORT_VECTORCALL
  12794. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  12795. #else
  12796. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  12797. #endif
  12798. PyObject *self;
  12799. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  12800. case 1:
  12801. self = args[0];
  12802. args += 1;
  12803. nargs -= 1;
  12804. break;
  12805. case 0:
  12806. self = ((PyCFunctionObject*)cyfunc)->m_self;
  12807. break;
  12808. default:
  12809. return NULL;
  12810. }
  12811. if (unlikely(nargs != 0)) {
  12812. PyErr_Format(PyExc_TypeError,
  12813. "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12814. def->ml_name, nargs);
  12815. return NULL;
  12816. }
  12817. return def->ml_meth(self, NULL);
  12818. }
  12819. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  12820. {
  12821. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  12822. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  12823. #if CYTHON_BACKPORT_VECTORCALL
  12824. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  12825. #else
  12826. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  12827. #endif
  12828. PyObject *self;
  12829. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  12830. case 1:
  12831. self = args[0];
  12832. args += 1;
  12833. nargs -= 1;
  12834. break;
  12835. case 0:
  12836. self = ((PyCFunctionObject*)cyfunc)->m_self;
  12837. break;
  12838. default:
  12839. return NULL;
  12840. }
  12841. if (unlikely(nargs != 1)) {
  12842. PyErr_Format(PyExc_TypeError,
  12843. "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12844. def->ml_name, nargs);
  12845. return NULL;
  12846. }
  12847. return def->ml_meth(self, args[0]);
  12848. }
  12849. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  12850. {
  12851. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  12852. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  12853. #if CYTHON_BACKPORT_VECTORCALL
  12854. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  12855. #else
  12856. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  12857. #endif
  12858. PyObject *self;
  12859. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  12860. case 1:
  12861. self = args[0];
  12862. args += 1;
  12863. nargs -= 1;
  12864. break;
  12865. case 0:
  12866. self = ((PyCFunctionObject*)cyfunc)->m_self;
  12867. break;
  12868. default:
  12869. return NULL;
  12870. }
  12871. return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
  12872. }
  12873. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  12874. {
  12875. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  12876. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  12877. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  12878. #if CYTHON_BACKPORT_VECTORCALL
  12879. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  12880. #else
  12881. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  12882. #endif
  12883. PyObject *self;
  12884. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  12885. case 1:
  12886. self = args[0];
  12887. args += 1;
  12888. nargs -= 1;
  12889. break;
  12890. case 0:
  12891. self = ((PyCFunctionObject*)cyfunc)->m_self;
  12892. break;
  12893. default:
  12894. return NULL;
  12895. }
  12896. return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
  12897. }
  12898. #endif
  12899. #if CYTHON_USE_TYPE_SPECS
  12900. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  12901. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  12902. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  12903. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  12904. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  12905. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  12906. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  12907. {Py_tp_members, (void *)__pyx_CyFunction_members},
  12908. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  12909. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  12910. {0, 0},
  12911. };
  12912. static PyType_Spec __pyx_CyFunctionType_spec = {
  12913. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  12914. sizeof(__pyx_CyFunctionObject),
  12915. 0,
  12916. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  12917. Py_TPFLAGS_METHOD_DESCRIPTOR |
  12918. #endif
  12919. #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
  12920. _Py_TPFLAGS_HAVE_VECTORCALL |
  12921. #endif
  12922. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  12923. __pyx_CyFunctionType_slots
  12924. };
  12925. #else
  12926. static PyTypeObject __pyx_CyFunctionType_type = {
  12927. PyVarObject_HEAD_INIT(0, 0)
  12928. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  12929. sizeof(__pyx_CyFunctionObject),
  12930. 0,
  12931. (destructor) __Pyx_CyFunction_dealloc,
  12932. #if !CYTHON_METH_FASTCALL
  12933. 0,
  12934. #elif CYTHON_BACKPORT_VECTORCALL
  12935. (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
  12936. #else
  12937. offsetof(PyCFunctionObject, vectorcall),
  12938. #endif
  12939. 0,
  12940. 0,
  12941. #if PY_MAJOR_VERSION < 3
  12942. 0,
  12943. #else
  12944. 0,
  12945. #endif
  12946. (reprfunc) __Pyx_CyFunction_repr,
  12947. 0,
  12948. 0,
  12949. 0,
  12950. 0,
  12951. __Pyx_CyFunction_CallAsMethod,
  12952. 0,
  12953. 0,
  12954. 0,
  12955. 0,
  12956. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  12957. Py_TPFLAGS_METHOD_DESCRIPTOR |
  12958. #endif
  12959. #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
  12960. _Py_TPFLAGS_HAVE_VECTORCALL |
  12961. #endif
  12962. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  12963. 0,
  12964. (traverseproc) __Pyx_CyFunction_traverse,
  12965. (inquiry) __Pyx_CyFunction_clear,
  12966. 0,
  12967. #if PY_VERSION_HEX < 0x030500A0
  12968. offsetof(__pyx_CyFunctionObject, func_weakreflist),
  12969. #else
  12970. offsetof(PyCFunctionObject, m_weakreflist),
  12971. #endif
  12972. 0,
  12973. 0,
  12974. __pyx_CyFunction_methods,
  12975. __pyx_CyFunction_members,
  12976. __pyx_CyFunction_getsets,
  12977. 0,
  12978. 0,
  12979. __Pyx_PyMethod_New,
  12980. 0,
  12981. offsetof(__pyx_CyFunctionObject, func_dict),
  12982. 0,
  12983. 0,
  12984. 0,
  12985. 0,
  12986. 0,
  12987. 0,
  12988. 0,
  12989. 0,
  12990. 0,
  12991. 0,
  12992. 0,
  12993. 0,
  12994. #if PY_VERSION_HEX >= 0x030400a1
  12995. 0,
  12996. #endif
  12997. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  12998. 0,
  12999. #endif
  13000. #if __PYX_NEED_TP_PRINT_SLOT
  13001. 0,
  13002. #endif
  13003. #if PY_VERSION_HEX >= 0x030C0000
  13004. 0,
  13005. #endif
  13006. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  13007. 0,
  13008. #endif
  13009. };
  13010. #endif
  13011. static int __pyx_CyFunction_init(PyObject *module) {
  13012. #if CYTHON_USE_TYPE_SPECS
  13013. __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
  13014. #else
  13015. CYTHON_UNUSED_VAR(module);
  13016. __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  13017. #endif
  13018. if (unlikely(__pyx_CyFunctionType == NULL)) {
  13019. return -1;
  13020. }
  13021. return 0;
  13022. }
  13023. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  13024. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  13025. m->defaults = PyObject_Malloc(size);
  13026. if (unlikely(!m->defaults))
  13027. return PyErr_NoMemory();
  13028. memset(m->defaults, 0, size);
  13029. m->defaults_pyobjects = pyobjects;
  13030. m->defaults_size = size;
  13031. return m->defaults;
  13032. }
  13033. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  13034. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  13035. m->defaults_tuple = tuple;
  13036. Py_INCREF(tuple);
  13037. }
  13038. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  13039. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  13040. m->defaults_kwdict = dict;
  13041. Py_INCREF(dict);
  13042. }
  13043. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  13044. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  13045. m->func_annotations = dict;
  13046. Py_INCREF(dict);
  13047. }
  13048. /* CythonFunction */
  13049. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  13050. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  13051. PyObject *op = __Pyx_CyFunction_Init(
  13052. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
  13053. ml, flags, qualname, closure, module, globals, code
  13054. );
  13055. if (likely(op)) {
  13056. PyObject_GC_Track(op);
  13057. }
  13058. return op;
  13059. }
  13060. /* ObjectGetItem */
  13061. #if CYTHON_USE_TYPE_SLOTS
  13062. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  13063. PyObject *runerr = NULL;
  13064. Py_ssize_t key_value;
  13065. key_value = __Pyx_PyIndex_AsSsize_t(index);
  13066. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  13067. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  13068. }
  13069. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  13070. __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
  13071. PyErr_Clear();
  13072. PyErr_Format(PyExc_IndexError,
  13073. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  13074. __Pyx_DECREF_TypeName(index_type_name);
  13075. }
  13076. return NULL;
  13077. }
  13078. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  13079. __Pyx_TypeName obj_type_name;
  13080. if (likely(PyType_Check(obj))) {
  13081. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
  13082. if (!meth) {
  13083. PyErr_Clear();
  13084. } else {
  13085. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  13086. Py_DECREF(meth);
  13087. return result;
  13088. }
  13089. }
  13090. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  13091. PyErr_Format(PyExc_TypeError,
  13092. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  13093. __Pyx_DECREF_TypeName(obj_type_name);
  13094. return NULL;
  13095. }
  13096. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  13097. PyTypeObject *tp = Py_TYPE(obj);
  13098. PyMappingMethods *mm = tp->tp_as_mapping;
  13099. PySequenceMethods *sm = tp->tp_as_sequence;
  13100. if (likely(mm && mm->mp_subscript)) {
  13101. return mm->mp_subscript(obj, key);
  13102. }
  13103. if (likely(sm && sm->sq_item)) {
  13104. return __Pyx_PyObject_GetIndex(obj, key);
  13105. }
  13106. return __Pyx_PyObject_GetItem_Slow(obj, key);
  13107. }
  13108. #endif
  13109. /* CLineInTraceback */
  13110. #ifndef CYTHON_CLINE_IN_TRACEBACK
  13111. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  13112. PyObject *use_cline;
  13113. PyObject *ptype, *pvalue, *ptraceback;
  13114. #if CYTHON_COMPILING_IN_CPYTHON
  13115. PyObject **cython_runtime_dict;
  13116. #endif
  13117. CYTHON_MAYBE_UNUSED_VAR(tstate);
  13118. if (unlikely(!__pyx_cython_runtime)) {
  13119. return c_line;
  13120. }
  13121. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  13122. #if CYTHON_COMPILING_IN_CPYTHON
  13123. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  13124. if (likely(cython_runtime_dict)) {
  13125. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  13126. use_cline, *cython_runtime_dict,
  13127. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  13128. } else
  13129. #endif
  13130. {
  13131. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  13132. if (use_cline_obj) {
  13133. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  13134. Py_DECREF(use_cline_obj);
  13135. } else {
  13136. PyErr_Clear();
  13137. use_cline = NULL;
  13138. }
  13139. }
  13140. if (!use_cline) {
  13141. c_line = 0;
  13142. (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  13143. }
  13144. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  13145. c_line = 0;
  13146. }
  13147. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  13148. return c_line;
  13149. }
  13150. #endif
  13151. /* CodeObjectCache */
  13152. #if !CYTHON_COMPILING_IN_LIMITED_API
  13153. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  13154. int start = 0, mid = 0, end = count - 1;
  13155. if (end >= 0 && code_line > entries[end].code_line) {
  13156. return count;
  13157. }
  13158. while (start < end) {
  13159. mid = start + (end - start) / 2;
  13160. if (code_line < entries[mid].code_line) {
  13161. end = mid;
  13162. } else if (code_line > entries[mid].code_line) {
  13163. start = mid + 1;
  13164. } else {
  13165. return mid;
  13166. }
  13167. }
  13168. if (code_line <= entries[mid].code_line) {
  13169. return mid;
  13170. } else {
  13171. return mid + 1;
  13172. }
  13173. }
  13174. static PyCodeObject *__pyx_find_code_object(int code_line) {
  13175. PyCodeObject* code_object;
  13176. int pos;
  13177. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  13178. return NULL;
  13179. }
  13180. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  13181. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  13182. return NULL;
  13183. }
  13184. code_object = __pyx_code_cache.entries[pos].code_object;
  13185. Py_INCREF(code_object);
  13186. return code_object;
  13187. }
  13188. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  13189. int pos, i;
  13190. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  13191. if (unlikely(!code_line)) {
  13192. return;
  13193. }
  13194. if (unlikely(!entries)) {
  13195. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  13196. if (likely(entries)) {
  13197. __pyx_code_cache.entries = entries;
  13198. __pyx_code_cache.max_count = 64;
  13199. __pyx_code_cache.count = 1;
  13200. entries[0].code_line = code_line;
  13201. entries[0].code_object = code_object;
  13202. Py_INCREF(code_object);
  13203. }
  13204. return;
  13205. }
  13206. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  13207. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  13208. PyCodeObject* tmp = entries[pos].code_object;
  13209. entries[pos].code_object = code_object;
  13210. Py_DECREF(tmp);
  13211. return;
  13212. }
  13213. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  13214. int new_max = __pyx_code_cache.max_count + 64;
  13215. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  13216. __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  13217. if (unlikely(!entries)) {
  13218. return;
  13219. }
  13220. __pyx_code_cache.entries = entries;
  13221. __pyx_code_cache.max_count = new_max;
  13222. }
  13223. for (i=__pyx_code_cache.count; i>pos; i--) {
  13224. entries[i] = entries[i-1];
  13225. }
  13226. entries[pos].code_line = code_line;
  13227. entries[pos].code_object = code_object;
  13228. __pyx_code_cache.count++;
  13229. Py_INCREF(code_object);
  13230. }
  13231. #endif
  13232. /* AddTraceback */
  13233. #include "compile.h"
  13234. #include "frameobject.h"
  13235. #include "traceback.h"
  13236. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  13237. #ifndef Py_BUILD_CORE
  13238. #define Py_BUILD_CORE 1
  13239. #endif
  13240. #include "internal/pycore_frame.h"
  13241. #endif
  13242. #if CYTHON_COMPILING_IN_LIMITED_API
  13243. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  13244. PyObject *firstlineno, PyObject *name) {
  13245. PyObject *replace = NULL;
  13246. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  13247. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  13248. replace = PyObject_GetAttrString(code, "replace");
  13249. if (likely(replace)) {
  13250. PyObject *result;
  13251. result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
  13252. Py_DECREF(replace);
  13253. return result;
  13254. }
  13255. PyErr_Clear();
  13256. #if __PYX_LIMITED_VERSION_HEX < 0x030780000
  13257. {
  13258. PyObject *compiled = NULL, *result = NULL;
  13259. if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
  13260. if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
  13261. compiled = Py_CompileString(
  13262. "out = type(code)(\n"
  13263. " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
  13264. " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
  13265. " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
  13266. " code.co_lnotab)\n", "<dummy>", Py_file_input);
  13267. if (!compiled) return NULL;
  13268. result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
  13269. Py_DECREF(compiled);
  13270. if (!result) PyErr_Print();
  13271. Py_DECREF(result);
  13272. result = PyDict_GetItemString(scratch_dict, "out");
  13273. if (result) Py_INCREF(result);
  13274. return result;
  13275. }
  13276. #else
  13277. return NULL;
  13278. #endif
  13279. }
  13280. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  13281. int py_line, const char *filename) {
  13282. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  13283. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  13284. PyObject *exc_type, *exc_value, *exc_traceback;
  13285. int success = 0;
  13286. if (c_line) {
  13287. (void) __pyx_cfilenm;
  13288. (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  13289. }
  13290. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  13291. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  13292. if (unlikely(!code_object)) goto bad;
  13293. py_py_line = PyLong_FromLong(py_line);
  13294. if (unlikely(!py_py_line)) goto bad;
  13295. py_funcname = PyUnicode_FromString(funcname);
  13296. if (unlikely(!py_funcname)) goto bad;
  13297. dict = PyDict_New();
  13298. if (unlikely(!dict)) goto bad;
  13299. {
  13300. PyObject *old_code_object = code_object;
  13301. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  13302. Py_DECREF(old_code_object);
  13303. }
  13304. if (unlikely(!code_object)) goto bad;
  13305. getframe = PySys_GetObject("_getframe");
  13306. if (unlikely(!getframe)) goto bad;
  13307. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  13308. frame = PyEval_EvalCode(code_object, dict, dict);
  13309. if (unlikely(!frame) || frame == Py_None) goto bad;
  13310. success = 1;
  13311. bad:
  13312. PyErr_Restore(exc_type, exc_value, exc_traceback);
  13313. Py_XDECREF(code_object);
  13314. Py_XDECREF(py_py_line);
  13315. Py_XDECREF(py_funcname);
  13316. Py_XDECREF(dict);
  13317. Py_XDECREF(replace);
  13318. if (success) {
  13319. PyTraceBack_Here(
  13320. (struct _frame*)frame);
  13321. }
  13322. Py_XDECREF(frame);
  13323. }
  13324. #else
  13325. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  13326. const char *funcname, int c_line,
  13327. int py_line, const char *filename) {
  13328. PyCodeObject *py_code = NULL;
  13329. PyObject *py_funcname = NULL;
  13330. #if PY_MAJOR_VERSION < 3
  13331. PyObject *py_srcfile = NULL;
  13332. py_srcfile = PyString_FromString(filename);
  13333. if (!py_srcfile) goto bad;
  13334. #endif
  13335. if (c_line) {
  13336. #if PY_MAJOR_VERSION < 3
  13337. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  13338. if (!py_funcname) goto bad;
  13339. #else
  13340. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  13341. if (!py_funcname) goto bad;
  13342. funcname = PyUnicode_AsUTF8(py_funcname);
  13343. if (!funcname) goto bad;
  13344. #endif
  13345. }
  13346. else {
  13347. #if PY_MAJOR_VERSION < 3
  13348. py_funcname = PyString_FromString(funcname);
  13349. if (!py_funcname) goto bad;
  13350. #endif
  13351. }
  13352. #if PY_MAJOR_VERSION < 3
  13353. py_code = __Pyx_PyCode_New(
  13354. 0,
  13355. 0,
  13356. 0,
  13357. 0,
  13358. 0,
  13359. 0,
  13360. __pyx_empty_bytes, /*PyObject *code,*/
  13361. __pyx_empty_tuple, /*PyObject *consts,*/
  13362. __pyx_empty_tuple, /*PyObject *names,*/
  13363. __pyx_empty_tuple, /*PyObject *varnames,*/
  13364. __pyx_empty_tuple, /*PyObject *freevars,*/
  13365. __pyx_empty_tuple, /*PyObject *cellvars,*/
  13366. py_srcfile, /*PyObject *filename,*/
  13367. py_funcname, /*PyObject *name,*/
  13368. py_line,
  13369. __pyx_empty_bytes /*PyObject *lnotab*/
  13370. );
  13371. Py_DECREF(py_srcfile);
  13372. #else
  13373. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  13374. #endif
  13375. Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
  13376. return py_code;
  13377. bad:
  13378. Py_XDECREF(py_funcname);
  13379. #if PY_MAJOR_VERSION < 3
  13380. Py_XDECREF(py_srcfile);
  13381. #endif
  13382. return NULL;
  13383. }
  13384. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  13385. int py_line, const char *filename) {
  13386. PyCodeObject *py_code = 0;
  13387. PyFrameObject *py_frame = 0;
  13388. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  13389. PyObject *ptype, *pvalue, *ptraceback;
  13390. if (c_line) {
  13391. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  13392. }
  13393. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  13394. if (!py_code) {
  13395. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  13396. py_code = __Pyx_CreateCodeObjectForTraceback(
  13397. funcname, c_line, py_line, filename);
  13398. if (!py_code) {
  13399. /* If the code object creation fails, then we should clear the
  13400. fetched exception references and propagate the new exception */
  13401. Py_XDECREF(ptype);
  13402. Py_XDECREF(pvalue);
  13403. Py_XDECREF(ptraceback);
  13404. goto bad;
  13405. }
  13406. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  13407. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  13408. }
  13409. py_frame = PyFrame_New(
  13410. tstate, /*PyThreadState *tstate,*/
  13411. py_code, /*PyCodeObject *code,*/
  13412. __pyx_d, /*PyObject *globals,*/
  13413. 0 /*PyObject *locals*/
  13414. );
  13415. if (!py_frame) goto bad;
  13416. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  13417. PyTraceBack_Here(py_frame);
  13418. bad:
  13419. Py_XDECREF(py_code);
  13420. Py_XDECREF(py_frame);
  13421. }
  13422. #endif
  13423. /* Declarations */
  13424. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  13425. #ifdef __cplusplus
  13426. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  13427. return ::std::complex< double >(x, y);
  13428. }
  13429. #else
  13430. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  13431. return x + y*(__pyx_t_double_complex)_Complex_I;
  13432. }
  13433. #endif
  13434. #else
  13435. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  13436. __pyx_t_double_complex z;
  13437. z.real = x;
  13438. z.imag = y;
  13439. return z;
  13440. }
  13441. #endif
  13442. /* Arithmetic */
  13443. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  13444. #else
  13445. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13446. return (a.real == b.real) && (a.imag == b.imag);
  13447. }
  13448. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13449. __pyx_t_double_complex z;
  13450. z.real = a.real + b.real;
  13451. z.imag = a.imag + b.imag;
  13452. return z;
  13453. }
  13454. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13455. __pyx_t_double_complex z;
  13456. z.real = a.real - b.real;
  13457. z.imag = a.imag - b.imag;
  13458. return z;
  13459. }
  13460. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13461. __pyx_t_double_complex z;
  13462. z.real = a.real * b.real - a.imag * b.imag;
  13463. z.imag = a.real * b.imag + a.imag * b.real;
  13464. return z;
  13465. }
  13466. #if 1
  13467. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13468. if (b.imag == 0) {
  13469. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  13470. } else if (fabs(b.real) >= fabs(b.imag)) {
  13471. if (b.real == 0 && b.imag == 0) {
  13472. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  13473. } else {
  13474. double r = b.imag / b.real;
  13475. double s = (double)(1.0) / (b.real + b.imag * r);
  13476. return __pyx_t_double_complex_from_parts(
  13477. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  13478. }
  13479. } else {
  13480. double r = b.real / b.imag;
  13481. double s = (double)(1.0) / (b.imag + b.real * r);
  13482. return __pyx_t_double_complex_from_parts(
  13483. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  13484. }
  13485. }
  13486. #else
  13487. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13488. if (b.imag == 0) {
  13489. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  13490. } else {
  13491. double denom = b.real * b.real + b.imag * b.imag;
  13492. return __pyx_t_double_complex_from_parts(
  13493. (a.real * b.real + a.imag * b.imag) / denom,
  13494. (a.imag * b.real - a.real * b.imag) / denom);
  13495. }
  13496. }
  13497. #endif
  13498. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  13499. __pyx_t_double_complex z;
  13500. z.real = -a.real;
  13501. z.imag = -a.imag;
  13502. return z;
  13503. }
  13504. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  13505. return (a.real == 0) && (a.imag == 0);
  13506. }
  13507. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  13508. __pyx_t_double_complex z;
  13509. z.real = a.real;
  13510. z.imag = -a.imag;
  13511. return z;
  13512. }
  13513. #if 1
  13514. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  13515. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  13516. return sqrt(z.real*z.real + z.imag*z.imag);
  13517. #else
  13518. return hypot(z.real, z.imag);
  13519. #endif
  13520. }
  13521. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  13522. __pyx_t_double_complex z;
  13523. double r, lnr, theta, z_r, z_theta;
  13524. if (b.imag == 0 && b.real == (int)b.real) {
  13525. if (b.real < 0) {
  13526. double denom = a.real * a.real + a.imag * a.imag;
  13527. a.real = a.real / denom;
  13528. a.imag = -a.imag / denom;
  13529. b.real = -b.real;
  13530. }
  13531. switch ((int)b.real) {
  13532. case 0:
  13533. z.real = 1;
  13534. z.imag = 0;
  13535. return z;
  13536. case 1:
  13537. return a;
  13538. case 2:
  13539. return __Pyx_c_prod_double(a, a);
  13540. case 3:
  13541. z = __Pyx_c_prod_double(a, a);
  13542. return __Pyx_c_prod_double(z, a);
  13543. case 4:
  13544. z = __Pyx_c_prod_double(a, a);
  13545. return __Pyx_c_prod_double(z, z);
  13546. }
  13547. }
  13548. if (a.imag == 0) {
  13549. if (a.real == 0) {
  13550. return a;
  13551. } else if ((b.imag == 0) && (a.real >= 0)) {
  13552. z.real = pow(a.real, b.real);
  13553. z.imag = 0;
  13554. return z;
  13555. } else if (a.real > 0) {
  13556. r = a.real;
  13557. theta = 0;
  13558. } else {
  13559. r = -a.real;
  13560. theta = atan2(0.0, -1.0);
  13561. }
  13562. } else {
  13563. r = __Pyx_c_abs_double(a);
  13564. theta = atan2(a.imag, a.real);
  13565. }
  13566. lnr = log(r);
  13567. z_r = exp(lnr * b.real - theta * b.imag);
  13568. z_theta = theta * b.real + lnr * b.imag;
  13569. z.real = z_r * cos(z_theta);
  13570. z.imag = z_r * sin(z_theta);
  13571. return z;
  13572. }
  13573. #endif
  13574. #endif
  13575. /* FromPy */
  13576. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
  13577. Py_complex cval;
  13578. #if !CYTHON_COMPILING_IN_PYPY
  13579. if (PyComplex_CheckExact(o))
  13580. cval = ((PyComplexObject *)o)->cval;
  13581. else
  13582. #endif
  13583. cval = PyComplex_AsCComplex(o);
  13584. return __pyx_t_double_complex_from_parts(
  13585. (double)cval.real,
  13586. (double)cval.imag);
  13587. }
  13588. /* CIntFromPyVerify */
  13589. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  13590. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  13591. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  13592. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  13593. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  13594. {\
  13595. func_type value = func_value;\
  13596. if (sizeof(target_type) < sizeof(func_type)) {\
  13597. if (unlikely(value != (func_type) (target_type) value)) {\
  13598. func_type zero = 0;\
  13599. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  13600. return (target_type) -1;\
  13601. if (is_unsigned && unlikely(value < zero))\
  13602. goto raise_neg_overflow;\
  13603. else\
  13604. goto raise_overflow;\
  13605. }\
  13606. }\
  13607. return (target_type) value;\
  13608. }
  13609. /* CIntFromPy */
  13610. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  13611. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13612. #pragma GCC diagnostic push
  13613. #pragma GCC diagnostic ignored "-Wconversion"
  13614. #endif
  13615. const int neg_one = (int) -1, const_zero = (int) 0;
  13616. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13617. #pragma GCC diagnostic pop
  13618. #endif
  13619. const int is_unsigned = neg_one > const_zero;
  13620. #if PY_MAJOR_VERSION < 3
  13621. if (likely(PyInt_Check(x))) {
  13622. if ((sizeof(int) < sizeof(long))) {
  13623. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  13624. } else {
  13625. long val = PyInt_AS_LONG(x);
  13626. if (is_unsigned && unlikely(val < 0)) {
  13627. goto raise_neg_overflow;
  13628. }
  13629. return (int) val;
  13630. }
  13631. } else
  13632. #endif
  13633. if (likely(PyLong_Check(x))) {
  13634. if (is_unsigned) {
  13635. #if CYTHON_USE_PYLONG_INTERNALS
  13636. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  13637. goto raise_neg_overflow;
  13638. } else if (__Pyx_PyLong_IsCompact(x)) {
  13639. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  13640. } else {
  13641. const digit* digits = __Pyx_PyLong_Digits(x);
  13642. assert(__Pyx_PyLong_DigitCount(x) > 1);
  13643. switch (__Pyx_PyLong_DigitCount(x)) {
  13644. case 2:
  13645. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  13646. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  13647. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13648. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  13649. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  13650. }
  13651. }
  13652. break;
  13653. case 3:
  13654. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  13655. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  13656. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13657. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  13658. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  13659. }
  13660. }
  13661. break;
  13662. case 4:
  13663. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  13664. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  13665. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13666. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  13667. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  13668. }
  13669. }
  13670. break;
  13671. }
  13672. }
  13673. #endif
  13674. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  13675. if (unlikely(Py_SIZE(x) < 0)) {
  13676. goto raise_neg_overflow;
  13677. }
  13678. #else
  13679. {
  13680. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  13681. if (unlikely(result < 0))
  13682. return (int) -1;
  13683. if (unlikely(result == 1))
  13684. goto raise_neg_overflow;
  13685. }
  13686. #endif
  13687. if ((sizeof(int) <= sizeof(unsigned long))) {
  13688. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  13689. #ifdef HAVE_LONG_LONG
  13690. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  13691. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  13692. #endif
  13693. }
  13694. } else {
  13695. #if CYTHON_USE_PYLONG_INTERNALS
  13696. if (__Pyx_PyLong_IsCompact(x)) {
  13697. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  13698. } else {
  13699. const digit* digits = __Pyx_PyLong_Digits(x);
  13700. assert(__Pyx_PyLong_DigitCount(x) > 1);
  13701. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  13702. case -2:
  13703. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  13704. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  13705. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13706. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  13707. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13708. }
  13709. }
  13710. break;
  13711. case 2:
  13712. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  13713. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  13714. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13715. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  13716. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13717. }
  13718. }
  13719. break;
  13720. case -3:
  13721. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  13722. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  13723. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13724. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  13725. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13726. }
  13727. }
  13728. break;
  13729. case 3:
  13730. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  13731. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  13732. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13733. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  13734. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13735. }
  13736. }
  13737. break;
  13738. case -4:
  13739. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  13740. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  13741. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13742. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  13743. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13744. }
  13745. }
  13746. break;
  13747. case 4:
  13748. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  13749. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  13750. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  13751. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  13752. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  13753. }
  13754. }
  13755. break;
  13756. }
  13757. }
  13758. #endif
  13759. if ((sizeof(int) <= sizeof(long))) {
  13760. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  13761. #ifdef HAVE_LONG_LONG
  13762. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  13763. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  13764. #endif
  13765. }
  13766. }
  13767. {
  13768. int val;
  13769. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  13770. #if PY_MAJOR_VERSION < 3
  13771. if (likely(v) && !PyLong_Check(v)) {
  13772. PyObject *tmp = v;
  13773. v = PyNumber_Long(tmp);
  13774. Py_DECREF(tmp);
  13775. }
  13776. #endif
  13777. if (likely(v)) {
  13778. int ret = -1;
  13779. #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  13780. int one = 1; int is_little = (int)*(unsigned char *)&one;
  13781. unsigned char *bytes = (unsigned char *)&val;
  13782. ret = _PyLong_AsByteArray((PyLongObject *)v,
  13783. bytes, sizeof(val),
  13784. is_little, !is_unsigned);
  13785. #else
  13786. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  13787. int bits, remaining_bits, is_negative = 0;
  13788. long idigit;
  13789. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  13790. if (unlikely(!PyLong_CheckExact(v))) {
  13791. PyObject *tmp = v;
  13792. v = PyNumber_Long(v);
  13793. assert(PyLong_CheckExact(v));
  13794. Py_DECREF(tmp);
  13795. if (unlikely(!v)) return (int) -1;
  13796. }
  13797. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  13798. if (Py_SIZE(x) == 0)
  13799. return (int) 0;
  13800. is_negative = Py_SIZE(x) < 0;
  13801. #else
  13802. {
  13803. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  13804. if (unlikely(result < 0))
  13805. return (int) -1;
  13806. is_negative = result == 1;
  13807. }
  13808. #endif
  13809. if (is_unsigned && unlikely(is_negative)) {
  13810. goto raise_neg_overflow;
  13811. } else if (is_negative) {
  13812. stepval = PyNumber_Invert(v);
  13813. if (unlikely(!stepval))
  13814. return (int) -1;
  13815. } else {
  13816. stepval = __Pyx_NewRef(v);
  13817. }
  13818. val = (int) 0;
  13819. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  13820. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  13821. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  13822. PyObject *tmp, *digit;
  13823. digit = PyNumber_And(stepval, mask);
  13824. if (unlikely(!digit)) goto done;
  13825. idigit = PyLong_AsLong(digit);
  13826. Py_DECREF(digit);
  13827. if (unlikely(idigit < 0)) goto done;
  13828. tmp = PyNumber_Rshift(stepval, shift);
  13829. if (unlikely(!tmp)) goto done;
  13830. Py_DECREF(stepval); stepval = tmp;
  13831. val |= ((int) idigit) << bits;
  13832. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  13833. if (Py_SIZE(stepval) == 0)
  13834. goto unpacking_done;
  13835. #endif
  13836. }
  13837. idigit = PyLong_AsLong(stepval);
  13838. if (unlikely(idigit < 0)) goto done;
  13839. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  13840. if (unlikely(idigit >= (1L << remaining_bits)))
  13841. goto raise_overflow;
  13842. val |= ((int) idigit) << bits;
  13843. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  13844. unpacking_done:
  13845. #endif
  13846. if (!is_unsigned) {
  13847. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  13848. goto raise_overflow;
  13849. if (is_negative)
  13850. val = ~val;
  13851. }
  13852. ret = 0;
  13853. done:
  13854. Py_XDECREF(shift);
  13855. Py_XDECREF(mask);
  13856. Py_XDECREF(stepval);
  13857. #endif
  13858. Py_DECREF(v);
  13859. if (likely(!ret))
  13860. return val;
  13861. }
  13862. return (int) -1;
  13863. }
  13864. } else {
  13865. int val;
  13866. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  13867. if (!tmp) return (int) -1;
  13868. val = __Pyx_PyInt_As_int(tmp);
  13869. Py_DECREF(tmp);
  13870. return val;
  13871. }
  13872. raise_overflow:
  13873. PyErr_SetString(PyExc_OverflowError,
  13874. "value too large to convert to int");
  13875. return (int) -1;
  13876. raise_neg_overflow:
  13877. PyErr_SetString(PyExc_OverflowError,
  13878. "can't convert negative value to int");
  13879. return (int) -1;
  13880. }
  13881. /* CIntToPy */
  13882. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  13883. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13884. #pragma GCC diagnostic push
  13885. #pragma GCC diagnostic ignored "-Wconversion"
  13886. #endif
  13887. const int neg_one = (int) -1, const_zero = (int) 0;
  13888. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13889. #pragma GCC diagnostic pop
  13890. #endif
  13891. const int is_unsigned = neg_one > const_zero;
  13892. if (is_unsigned) {
  13893. if (sizeof(int) < sizeof(long)) {
  13894. return PyInt_FromLong((long) value);
  13895. } else if (sizeof(int) <= sizeof(unsigned long)) {
  13896. return PyLong_FromUnsignedLong((unsigned long) value);
  13897. #ifdef HAVE_LONG_LONG
  13898. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  13899. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  13900. #endif
  13901. }
  13902. } else {
  13903. if (sizeof(int) <= sizeof(long)) {
  13904. return PyInt_FromLong((long) value);
  13905. #ifdef HAVE_LONG_LONG
  13906. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  13907. return PyLong_FromLongLong((PY_LONG_LONG) value);
  13908. #endif
  13909. }
  13910. }
  13911. {
  13912. int one = 1; int little = (int)*(unsigned char *)&one;
  13913. unsigned char *bytes = (unsigned char *)&value;
  13914. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  13915. return _PyLong_FromByteArray(bytes, sizeof(int),
  13916. little, !is_unsigned);
  13917. #else
  13918. PyObject *from_bytes, *result = NULL;
  13919. PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
  13920. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  13921. if (!from_bytes) return NULL;
  13922. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
  13923. if (!py_bytes) goto limited_bad;
  13924. order_str = PyUnicode_FromString(little ? "little" : "big");
  13925. if (!order_str) goto limited_bad;
  13926. arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
  13927. if (!arg_tuple) goto limited_bad;
  13928. if (!is_unsigned) {
  13929. kwds = PyDict_New();
  13930. if (!kwds) goto limited_bad;
  13931. if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
  13932. }
  13933. result = PyObject_Call(from_bytes, arg_tuple, kwds);
  13934. limited_bad:
  13935. Py_XDECREF(kwds);
  13936. Py_XDECREF(arg_tuple);
  13937. Py_XDECREF(order_str);
  13938. Py_XDECREF(py_bytes);
  13939. Py_XDECREF(from_bytes);
  13940. return result;
  13941. #endif
  13942. }
  13943. }
  13944. /* CIntToPy */
  13945. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  13946. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13947. #pragma GCC diagnostic push
  13948. #pragma GCC diagnostic ignored "-Wconversion"
  13949. #endif
  13950. const long neg_one = (long) -1, const_zero = (long) 0;
  13951. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  13952. #pragma GCC diagnostic pop
  13953. #endif
  13954. const int is_unsigned = neg_one > const_zero;
  13955. if (is_unsigned) {
  13956. if (sizeof(long) < sizeof(long)) {
  13957. return PyInt_FromLong((long) value);
  13958. } else if (sizeof(long) <= sizeof(unsigned long)) {
  13959. return PyLong_FromUnsignedLong((unsigned long) value);
  13960. #ifdef HAVE_LONG_LONG
  13961. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  13962. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  13963. #endif
  13964. }
  13965. } else {
  13966. if (sizeof(long) <= sizeof(long)) {
  13967. return PyInt_FromLong((long) value);
  13968. #ifdef HAVE_LONG_LONG
  13969. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  13970. return PyLong_FromLongLong((PY_LONG_LONG) value);
  13971. #endif
  13972. }
  13973. }
  13974. {
  13975. int one = 1; int little = (int)*(unsigned char *)&one;
  13976. unsigned char *bytes = (unsigned char *)&value;
  13977. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  13978. return _PyLong_FromByteArray(bytes, sizeof(long),
  13979. little, !is_unsigned);
  13980. #else
  13981. PyObject *from_bytes, *result = NULL;
  13982. PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
  13983. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  13984. if (!from_bytes) return NULL;
  13985. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  13986. if (!py_bytes) goto limited_bad;
  13987. order_str = PyUnicode_FromString(little ? "little" : "big");
  13988. if (!order_str) goto limited_bad;
  13989. arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
  13990. if (!arg_tuple) goto limited_bad;
  13991. if (!is_unsigned) {
  13992. kwds = PyDict_New();
  13993. if (!kwds) goto limited_bad;
  13994. if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
  13995. }
  13996. result = PyObject_Call(from_bytes, arg_tuple, kwds);
  13997. limited_bad:
  13998. Py_XDECREF(kwds);
  13999. Py_XDECREF(arg_tuple);
  14000. Py_XDECREF(order_str);
  14001. Py_XDECREF(py_bytes);
  14002. Py_XDECREF(from_bytes);
  14003. return result;
  14004. #endif
  14005. }
  14006. }
  14007. /* FormatTypeName */
  14008. #if CYTHON_COMPILING_IN_LIMITED_API
  14009. static __Pyx_TypeName
  14010. __Pyx_PyType_GetName(PyTypeObject* tp)
  14011. {
  14012. PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  14013. __pyx_n_s_name);
  14014. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
  14015. PyErr_Clear();
  14016. Py_XDECREF(name);
  14017. name = __Pyx_NewRef(__pyx_n_s__15);
  14018. }
  14019. return name;
  14020. }
  14021. #endif
  14022. /* CIntFromPy */
  14023. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  14024. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  14025. #pragma GCC diagnostic push
  14026. #pragma GCC diagnostic ignored "-Wconversion"
  14027. #endif
  14028. const long neg_one = (long) -1, const_zero = (long) 0;
  14029. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  14030. #pragma GCC diagnostic pop
  14031. #endif
  14032. const int is_unsigned = neg_one > const_zero;
  14033. #if PY_MAJOR_VERSION < 3
  14034. if (likely(PyInt_Check(x))) {
  14035. if ((sizeof(long) < sizeof(long))) {
  14036. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  14037. } else {
  14038. long val = PyInt_AS_LONG(x);
  14039. if (is_unsigned && unlikely(val < 0)) {
  14040. goto raise_neg_overflow;
  14041. }
  14042. return (long) val;
  14043. }
  14044. } else
  14045. #endif
  14046. if (likely(PyLong_Check(x))) {
  14047. if (is_unsigned) {
  14048. #if CYTHON_USE_PYLONG_INTERNALS
  14049. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  14050. goto raise_neg_overflow;
  14051. } else if (__Pyx_PyLong_IsCompact(x)) {
  14052. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  14053. } else {
  14054. const digit* digits = __Pyx_PyLong_Digits(x);
  14055. assert(__Pyx_PyLong_DigitCount(x) > 1);
  14056. switch (__Pyx_PyLong_DigitCount(x)) {
  14057. case 2:
  14058. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  14059. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  14060. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14061. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  14062. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  14063. }
  14064. }
  14065. break;
  14066. case 3:
  14067. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  14068. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  14069. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14070. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  14071. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  14072. }
  14073. }
  14074. break;
  14075. case 4:
  14076. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  14077. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  14078. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14079. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  14080. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  14081. }
  14082. }
  14083. break;
  14084. }
  14085. }
  14086. #endif
  14087. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  14088. if (unlikely(Py_SIZE(x) < 0)) {
  14089. goto raise_neg_overflow;
  14090. }
  14091. #else
  14092. {
  14093. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  14094. if (unlikely(result < 0))
  14095. return (long) -1;
  14096. if (unlikely(result == 1))
  14097. goto raise_neg_overflow;
  14098. }
  14099. #endif
  14100. if ((sizeof(long) <= sizeof(unsigned long))) {
  14101. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  14102. #ifdef HAVE_LONG_LONG
  14103. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  14104. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  14105. #endif
  14106. }
  14107. } else {
  14108. #if CYTHON_USE_PYLONG_INTERNALS
  14109. if (__Pyx_PyLong_IsCompact(x)) {
  14110. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  14111. } else {
  14112. const digit* digits = __Pyx_PyLong_Digits(x);
  14113. assert(__Pyx_PyLong_DigitCount(x) > 1);
  14114. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  14115. case -2:
  14116. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  14117. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  14118. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14119. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  14120. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14121. }
  14122. }
  14123. break;
  14124. case 2:
  14125. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  14126. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  14127. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14128. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  14129. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14130. }
  14131. }
  14132. break;
  14133. case -3:
  14134. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  14135. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  14136. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14137. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  14138. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14139. }
  14140. }
  14141. break;
  14142. case 3:
  14143. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  14144. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  14145. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14146. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  14147. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14148. }
  14149. }
  14150. break;
  14151. case -4:
  14152. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  14153. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  14154. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14155. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  14156. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14157. }
  14158. }
  14159. break;
  14160. case 4:
  14161. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  14162. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  14163. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  14164. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  14165. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  14166. }
  14167. }
  14168. break;
  14169. }
  14170. }
  14171. #endif
  14172. if ((sizeof(long) <= sizeof(long))) {
  14173. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  14174. #ifdef HAVE_LONG_LONG
  14175. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  14176. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  14177. #endif
  14178. }
  14179. }
  14180. {
  14181. long val;
  14182. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  14183. #if PY_MAJOR_VERSION < 3
  14184. if (likely(v) && !PyLong_Check(v)) {
  14185. PyObject *tmp = v;
  14186. v = PyNumber_Long(tmp);
  14187. Py_DECREF(tmp);
  14188. }
  14189. #endif
  14190. if (likely(v)) {
  14191. int ret = -1;
  14192. #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  14193. int one = 1; int is_little = (int)*(unsigned char *)&one;
  14194. unsigned char *bytes = (unsigned char *)&val;
  14195. ret = _PyLong_AsByteArray((PyLongObject *)v,
  14196. bytes, sizeof(val),
  14197. is_little, !is_unsigned);
  14198. #else
  14199. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  14200. int bits, remaining_bits, is_negative = 0;
  14201. long idigit;
  14202. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  14203. if (unlikely(!PyLong_CheckExact(v))) {
  14204. PyObject *tmp = v;
  14205. v = PyNumber_Long(v);
  14206. assert(PyLong_CheckExact(v));
  14207. Py_DECREF(tmp);
  14208. if (unlikely(!v)) return (long) -1;
  14209. }
  14210. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  14211. if (Py_SIZE(x) == 0)
  14212. return (long) 0;
  14213. is_negative = Py_SIZE(x) < 0;
  14214. #else
  14215. {
  14216. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  14217. if (unlikely(result < 0))
  14218. return (long) -1;
  14219. is_negative = result == 1;
  14220. }
  14221. #endif
  14222. if (is_unsigned && unlikely(is_negative)) {
  14223. goto raise_neg_overflow;
  14224. } else if (is_negative) {
  14225. stepval = PyNumber_Invert(v);
  14226. if (unlikely(!stepval))
  14227. return (long) -1;
  14228. } else {
  14229. stepval = __Pyx_NewRef(v);
  14230. }
  14231. val = (long) 0;
  14232. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  14233. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  14234. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  14235. PyObject *tmp, *digit;
  14236. digit = PyNumber_And(stepval, mask);
  14237. if (unlikely(!digit)) goto done;
  14238. idigit = PyLong_AsLong(digit);
  14239. Py_DECREF(digit);
  14240. if (unlikely(idigit < 0)) goto done;
  14241. tmp = PyNumber_Rshift(stepval, shift);
  14242. if (unlikely(!tmp)) goto done;
  14243. Py_DECREF(stepval); stepval = tmp;
  14244. val |= ((long) idigit) << bits;
  14245. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  14246. if (Py_SIZE(stepval) == 0)
  14247. goto unpacking_done;
  14248. #endif
  14249. }
  14250. idigit = PyLong_AsLong(stepval);
  14251. if (unlikely(idigit < 0)) goto done;
  14252. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  14253. if (unlikely(idigit >= (1L << remaining_bits)))
  14254. goto raise_overflow;
  14255. val |= ((long) idigit) << bits;
  14256. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  14257. unpacking_done:
  14258. #endif
  14259. if (!is_unsigned) {
  14260. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  14261. goto raise_overflow;
  14262. if (is_negative)
  14263. val = ~val;
  14264. }
  14265. ret = 0;
  14266. done:
  14267. Py_XDECREF(shift);
  14268. Py_XDECREF(mask);
  14269. Py_XDECREF(stepval);
  14270. #endif
  14271. Py_DECREF(v);
  14272. if (likely(!ret))
  14273. return val;
  14274. }
  14275. return (long) -1;
  14276. }
  14277. } else {
  14278. long val;
  14279. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  14280. if (!tmp) return (long) -1;
  14281. val = __Pyx_PyInt_As_long(tmp);
  14282. Py_DECREF(tmp);
  14283. return val;
  14284. }
  14285. raise_overflow:
  14286. PyErr_SetString(PyExc_OverflowError,
  14287. "value too large to convert to long");
  14288. return (long) -1;
  14289. raise_neg_overflow:
  14290. PyErr_SetString(PyExc_OverflowError,
  14291. "can't convert negative value to long");
  14292. return (long) -1;
  14293. }
  14294. /* SwapException */
  14295. #if CYTHON_FAST_THREAD_STATE
  14296. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  14297. PyObject *tmp_type, *tmp_value, *tmp_tb;
  14298. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  14299. _PyErr_StackItem *exc_info = tstate->exc_info;
  14300. tmp_value = exc_info->exc_value;
  14301. exc_info->exc_value = *value;
  14302. if (tmp_value == NULL || tmp_value == Py_None) {
  14303. Py_XDECREF(tmp_value);
  14304. tmp_value = NULL;
  14305. tmp_type = NULL;
  14306. tmp_tb = NULL;
  14307. } else {
  14308. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  14309. Py_INCREF(tmp_type);
  14310. #if CYTHON_COMPILING_IN_CPYTHON
  14311. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  14312. Py_XINCREF(tmp_tb);
  14313. #else
  14314. tmp_tb = PyException_GetTraceback(tmp_value);
  14315. #endif
  14316. }
  14317. #elif CYTHON_USE_EXC_INFO_STACK
  14318. _PyErr_StackItem *exc_info = tstate->exc_info;
  14319. tmp_type = exc_info->exc_type;
  14320. tmp_value = exc_info->exc_value;
  14321. tmp_tb = exc_info->exc_traceback;
  14322. exc_info->exc_type = *type;
  14323. exc_info->exc_value = *value;
  14324. exc_info->exc_traceback = *tb;
  14325. #else
  14326. tmp_type = tstate->exc_type;
  14327. tmp_value = tstate->exc_value;
  14328. tmp_tb = tstate->exc_traceback;
  14329. tstate->exc_type = *type;
  14330. tstate->exc_value = *value;
  14331. tstate->exc_traceback = *tb;
  14332. #endif
  14333. *type = tmp_type;
  14334. *value = tmp_value;
  14335. *tb = tmp_tb;
  14336. }
  14337. #else
  14338. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  14339. PyObject *tmp_type, *tmp_value, *tmp_tb;
  14340. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  14341. PyErr_SetExcInfo(*type, *value, *tb);
  14342. *type = tmp_type;
  14343. *value = tmp_value;
  14344. *tb = tmp_tb;
  14345. }
  14346. #endif
  14347. /* PyObjectCall2Args */
  14348. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  14349. PyObject *args[3] = {NULL, arg1, arg2};
  14350. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  14351. }
  14352. /* PyObjectCallMethod1 */
  14353. #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
  14354. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  14355. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  14356. Py_DECREF(method);
  14357. return result;
  14358. }
  14359. #endif
  14360. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  14361. #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
  14362. PyObject *args[2] = {obj, arg};
  14363. (void) __Pyx_PyObject_GetMethod;
  14364. (void) __Pyx_PyObject_CallOneArg;
  14365. (void) __Pyx_PyObject_Call2Args;
  14366. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  14367. #else
  14368. PyObject *method = NULL, *result;
  14369. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  14370. if (likely(is_method)) {
  14371. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  14372. Py_DECREF(method);
  14373. return result;
  14374. }
  14375. if (unlikely(!method)) return NULL;
  14376. return __Pyx__PyObject_CallMethod1(method, arg);
  14377. #endif
  14378. }
  14379. /* CoroutineBase */
  14380. #include <frameobject.h>
  14381. #if PY_VERSION_HEX >= 0x030b00a6
  14382. #ifndef Py_BUILD_CORE
  14383. #define Py_BUILD_CORE 1
  14384. #endif
  14385. #include "internal/pycore_frame.h"
  14386. #endif
  14387. #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
  14388. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  14389. PyObject *et, *ev, *tb;
  14390. PyObject *value = NULL;
  14391. CYTHON_UNUSED_VAR(__pyx_tstate);
  14392. __Pyx_ErrFetch(&et, &ev, &tb);
  14393. if (!et) {
  14394. Py_XDECREF(tb);
  14395. Py_XDECREF(ev);
  14396. Py_INCREF(Py_None);
  14397. *pvalue = Py_None;
  14398. return 0;
  14399. }
  14400. if (likely(et == PyExc_StopIteration)) {
  14401. if (!ev) {
  14402. Py_INCREF(Py_None);
  14403. value = Py_None;
  14404. }
  14405. #if PY_VERSION_HEX >= 0x030300A0
  14406. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  14407. value = ((PyStopIterationObject *)ev)->value;
  14408. Py_INCREF(value);
  14409. Py_DECREF(ev);
  14410. }
  14411. #endif
  14412. else if (unlikely(PyTuple_Check(ev))) {
  14413. if (PyTuple_GET_SIZE(ev) >= 1) {
  14414. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  14415. value = PyTuple_GET_ITEM(ev, 0);
  14416. Py_INCREF(value);
  14417. #else
  14418. value = PySequence_ITEM(ev, 0);
  14419. #endif
  14420. } else {
  14421. Py_INCREF(Py_None);
  14422. value = Py_None;
  14423. }
  14424. Py_DECREF(ev);
  14425. }
  14426. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  14427. value = ev;
  14428. }
  14429. if (likely(value)) {
  14430. Py_XDECREF(tb);
  14431. Py_DECREF(et);
  14432. *pvalue = value;
  14433. return 0;
  14434. }
  14435. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  14436. __Pyx_ErrRestore(et, ev, tb);
  14437. return -1;
  14438. }
  14439. PyErr_NormalizeException(&et, &ev, &tb);
  14440. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  14441. __Pyx_ErrRestore(et, ev, tb);
  14442. return -1;
  14443. }
  14444. Py_XDECREF(tb);
  14445. Py_DECREF(et);
  14446. #if PY_VERSION_HEX >= 0x030300A0
  14447. value = ((PyStopIterationObject *)ev)->value;
  14448. Py_INCREF(value);
  14449. Py_DECREF(ev);
  14450. #else
  14451. {
  14452. PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
  14453. Py_DECREF(ev);
  14454. if (likely(args)) {
  14455. value = PySequence_GetItem(args, 0);
  14456. Py_DECREF(args);
  14457. }
  14458. if (unlikely(!value)) {
  14459. __Pyx_ErrRestore(NULL, NULL, NULL);
  14460. Py_INCREF(Py_None);
  14461. value = Py_None;
  14462. }
  14463. }
  14464. #endif
  14465. *pvalue = value;
  14466. return 0;
  14467. }
  14468. static CYTHON_INLINE
  14469. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  14470. #if PY_VERSION_HEX >= 0x030B00a4
  14471. Py_CLEAR(exc_state->exc_value);
  14472. #else
  14473. PyObject *t, *v, *tb;
  14474. t = exc_state->exc_type;
  14475. v = exc_state->exc_value;
  14476. tb = exc_state->exc_traceback;
  14477. exc_state->exc_type = NULL;
  14478. exc_state->exc_value = NULL;
  14479. exc_state->exc_traceback = NULL;
  14480. Py_XDECREF(t);
  14481. Py_XDECREF(v);
  14482. Py_XDECREF(tb);
  14483. #endif
  14484. }
  14485. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  14486. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  14487. const char *msg;
  14488. CYTHON_MAYBE_UNUSED_VAR(gen);
  14489. if ((0)) {
  14490. #ifdef __Pyx_Coroutine_USED
  14491. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  14492. msg = "coroutine already executing";
  14493. #endif
  14494. #ifdef __Pyx_AsyncGen_USED
  14495. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  14496. msg = "async generator already executing";
  14497. #endif
  14498. } else {
  14499. msg = "generator already executing";
  14500. }
  14501. PyErr_SetString(PyExc_ValueError, msg);
  14502. }
  14503. #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
  14504. static void __Pyx__Coroutine_NotStartedError(PyObject *gen) {
  14505. const char *msg;
  14506. CYTHON_MAYBE_UNUSED_VAR(gen);
  14507. if ((0)) {
  14508. #ifdef __Pyx_Coroutine_USED
  14509. } else if (__Pyx_Coroutine_Check(gen)) {
  14510. msg = "can't send non-None value to a just-started coroutine";
  14511. #endif
  14512. #ifdef __Pyx_AsyncGen_USED
  14513. } else if (__Pyx_AsyncGen_CheckExact(gen)) {
  14514. msg = "can't send non-None value to a just-started async generator";
  14515. #endif
  14516. } else {
  14517. msg = "can't send non-None value to a just-started generator";
  14518. }
  14519. PyErr_SetString(PyExc_TypeError, msg);
  14520. }
  14521. #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
  14522. static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  14523. CYTHON_MAYBE_UNUSED_VAR(gen);
  14524. CYTHON_MAYBE_UNUSED_VAR(closing);
  14525. #ifdef __Pyx_Coroutine_USED
  14526. if (!closing && __Pyx_Coroutine_Check(gen)) {
  14527. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  14528. } else
  14529. #endif
  14530. if (value) {
  14531. #ifdef __Pyx_AsyncGen_USED
  14532. if (__Pyx_AsyncGen_CheckExact(gen))
  14533. PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
  14534. else
  14535. #endif
  14536. PyErr_SetNone(PyExc_StopIteration);
  14537. }
  14538. }
  14539. static
  14540. PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
  14541. __Pyx_PyThreadState_declare
  14542. PyThreadState *tstate;
  14543. __Pyx_ExcInfoStruct *exc_state;
  14544. PyObject *retval;
  14545. assert(!self->is_running);
  14546. if (unlikely(self->resume_label == 0)) {
  14547. if (unlikely(value && value != Py_None)) {
  14548. return __Pyx_Coroutine_NotStartedError((PyObject*)self);
  14549. }
  14550. }
  14551. if (unlikely(self->resume_label == -1)) {
  14552. return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  14553. }
  14554. #if CYTHON_FAST_THREAD_STATE
  14555. __Pyx_PyThreadState_assign
  14556. tstate = __pyx_tstate;
  14557. #else
  14558. tstate = __Pyx_PyThreadState_Current;
  14559. #endif
  14560. exc_state = &self->gi_exc_state;
  14561. if (exc_state->exc_value) {
  14562. #if CYTHON_COMPILING_IN_PYPY
  14563. #else
  14564. PyObject *exc_tb;
  14565. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  14566. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  14567. #elif PY_VERSION_HEX >= 0x030B00a4
  14568. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  14569. #else
  14570. exc_tb = exc_state->exc_traceback;
  14571. #endif
  14572. if (exc_tb) {
  14573. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  14574. PyFrameObject *f = tb->tb_frame;
  14575. assert(f->f_back == NULL);
  14576. #if PY_VERSION_HEX >= 0x030B00A1
  14577. f->f_back = PyThreadState_GetFrame(tstate);
  14578. #else
  14579. Py_XINCREF(tstate->frame);
  14580. f->f_back = tstate->frame;
  14581. #endif
  14582. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  14583. Py_DECREF(exc_tb);
  14584. #endif
  14585. }
  14586. #endif
  14587. }
  14588. #if CYTHON_USE_EXC_INFO_STACK
  14589. exc_state->previous_item = tstate->exc_info;
  14590. tstate->exc_info = exc_state;
  14591. #else
  14592. if (exc_state->exc_type) {
  14593. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  14594. } else {
  14595. __Pyx_Coroutine_ExceptionClear(exc_state);
  14596. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  14597. }
  14598. #endif
  14599. self->is_running = 1;
  14600. retval = self->body(self, tstate, value);
  14601. self->is_running = 0;
  14602. #if CYTHON_USE_EXC_INFO_STACK
  14603. exc_state = &self->gi_exc_state;
  14604. tstate->exc_info = exc_state->previous_item;
  14605. exc_state->previous_item = NULL;
  14606. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  14607. #endif
  14608. return retval;
  14609. }
  14610. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  14611. #if CYTHON_COMPILING_IN_PYPY
  14612. CYTHON_UNUSED_VAR(exc_state);
  14613. #else
  14614. PyObject *exc_tb;
  14615. #if PY_VERSION_HEX >= 0x030B00a4
  14616. if (!exc_state->exc_value) return;
  14617. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  14618. #else
  14619. exc_tb = exc_state->exc_traceback;
  14620. #endif
  14621. if (likely(exc_tb)) {
  14622. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  14623. PyFrameObject *f = tb->tb_frame;
  14624. Py_CLEAR(f->f_back);
  14625. #if PY_VERSION_HEX >= 0x030B00a4
  14626. Py_DECREF(exc_tb);
  14627. #endif
  14628. }
  14629. #endif
  14630. }
  14631. static CYTHON_INLINE
  14632. PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) {
  14633. CYTHON_MAYBE_UNUSED_VAR(gen);
  14634. if (unlikely(!retval)) {
  14635. __Pyx_PyThreadState_declare
  14636. __Pyx_PyThreadState_assign
  14637. if (!__Pyx_PyErr_Occurred()) {
  14638. PyObject *exc = PyExc_StopIteration;
  14639. #ifdef __Pyx_AsyncGen_USED
  14640. if (__Pyx_AsyncGen_CheckExact(gen))
  14641. exc = __Pyx_PyExc_StopAsyncIteration;
  14642. #endif
  14643. __Pyx_PyErr_SetNone(exc);
  14644. }
  14645. }
  14646. return retval;
  14647. }
  14648. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  14649. static CYTHON_INLINE
  14650. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  14651. #if PY_VERSION_HEX <= 0x030A00A1
  14652. return _PyGen_Send(gen, arg);
  14653. #else
  14654. PyObject *result;
  14655. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  14656. if (PyAsyncGen_CheckExact(gen)) {
  14657. assert(result == Py_None);
  14658. PyErr_SetNone(PyExc_StopAsyncIteration);
  14659. }
  14660. else if (result == Py_None) {
  14661. PyErr_SetNone(PyExc_StopIteration);
  14662. }
  14663. else {
  14664. #if PY_VERSION_HEX < 0x030d00A1
  14665. _PyGen_SetStopIterationValue(result);
  14666. #else
  14667. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  14668. PyErr_SetObject(PyExc_StopIteration, result);
  14669. } else {
  14670. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  14671. if (likely(exc != NULL)) {
  14672. PyErr_SetObject(PyExc_StopIteration, exc);
  14673. Py_DECREF(exc);
  14674. }
  14675. }
  14676. #endif
  14677. }
  14678. Py_DECREF(result);
  14679. result = NULL;
  14680. }
  14681. return result;
  14682. #endif
  14683. }
  14684. #endif
  14685. static CYTHON_INLINE
  14686. PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
  14687. PyObject *ret;
  14688. PyObject *val = NULL;
  14689. __Pyx_Coroutine_Undelegate(gen);
  14690. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  14691. ret = __Pyx_Coroutine_SendEx(gen, val, 0);
  14692. Py_XDECREF(val);
  14693. return ret;
  14694. }
  14695. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  14696. PyObject *retval;
  14697. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  14698. PyObject *yf = gen->yieldfrom;
  14699. if (unlikely(gen->is_running))
  14700. return __Pyx_Coroutine_AlreadyRunningError(gen);
  14701. if (yf) {
  14702. PyObject *ret;
  14703. gen->is_running = 1;
  14704. #ifdef __Pyx_Generator_USED
  14705. if (__Pyx_Generator_CheckExact(yf)) {
  14706. ret = __Pyx_Coroutine_Send(yf, value);
  14707. } else
  14708. #endif
  14709. #ifdef __Pyx_Coroutine_USED
  14710. if (__Pyx_Coroutine_Check(yf)) {
  14711. ret = __Pyx_Coroutine_Send(yf, value);
  14712. } else
  14713. #endif
  14714. #ifdef __Pyx_AsyncGen_USED
  14715. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  14716. ret = __Pyx_async_gen_asend_send(yf, value);
  14717. } else
  14718. #endif
  14719. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  14720. if (PyGen_CheckExact(yf)) {
  14721. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  14722. } else
  14723. #endif
  14724. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  14725. if (PyCoro_CheckExact(yf)) {
  14726. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  14727. } else
  14728. #endif
  14729. {
  14730. if (value == Py_None)
  14731. ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
  14732. else
  14733. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
  14734. }
  14735. gen->is_running = 0;
  14736. if (likely(ret)) {
  14737. return ret;
  14738. }
  14739. retval = __Pyx_Coroutine_FinishDelegation(gen);
  14740. } else {
  14741. retval = __Pyx_Coroutine_SendEx(gen, value, 0);
  14742. }
  14743. return __Pyx_Coroutine_MethodReturn(self, retval);
  14744. }
  14745. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  14746. PyObject *retval = NULL;
  14747. int err = 0;
  14748. #ifdef __Pyx_Generator_USED
  14749. if (__Pyx_Generator_CheckExact(yf)) {
  14750. retval = __Pyx_Coroutine_Close(yf);
  14751. if (!retval)
  14752. return -1;
  14753. } else
  14754. #endif
  14755. #ifdef __Pyx_Coroutine_USED
  14756. if (__Pyx_Coroutine_Check(yf)) {
  14757. retval = __Pyx_Coroutine_Close(yf);
  14758. if (!retval)
  14759. return -1;
  14760. } else
  14761. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  14762. retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
  14763. if (!retval)
  14764. return -1;
  14765. } else
  14766. #endif
  14767. #ifdef __Pyx_AsyncGen_USED
  14768. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  14769. retval = __Pyx_async_gen_asend_close(yf, NULL);
  14770. } else
  14771. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  14772. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  14773. } else
  14774. #endif
  14775. {
  14776. PyObject *meth;
  14777. gen->is_running = 1;
  14778. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close);
  14779. if (unlikely(!meth)) {
  14780. if (unlikely(PyErr_Occurred())) {
  14781. PyErr_WriteUnraisable(yf);
  14782. }
  14783. } else {
  14784. retval = __Pyx_PyObject_CallNoArg(meth);
  14785. Py_DECREF(meth);
  14786. if (unlikely(!retval))
  14787. err = -1;
  14788. }
  14789. gen->is_running = 0;
  14790. }
  14791. Py_XDECREF(retval);
  14792. return err;
  14793. }
  14794. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  14795. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  14796. PyObject *yf = gen->yieldfrom;
  14797. if (unlikely(gen->is_running))
  14798. return __Pyx_Coroutine_AlreadyRunningError(gen);
  14799. if (yf) {
  14800. PyObject *ret;
  14801. gen->is_running = 1;
  14802. #ifdef __Pyx_Generator_USED
  14803. if (__Pyx_Generator_CheckExact(yf)) {
  14804. ret = __Pyx_Generator_Next(yf);
  14805. } else
  14806. #endif
  14807. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  14808. if (PyGen_CheckExact(yf)) {
  14809. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  14810. } else
  14811. #endif
  14812. #ifdef __Pyx_Coroutine_USED
  14813. if (__Pyx_Coroutine_Check(yf)) {
  14814. ret = __Pyx_Coroutine_Send(yf, Py_None);
  14815. } else
  14816. #endif
  14817. ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
  14818. gen->is_running = 0;
  14819. if (likely(ret)) {
  14820. return ret;
  14821. }
  14822. return __Pyx_Coroutine_FinishDelegation(gen);
  14823. }
  14824. return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
  14825. }
  14826. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  14827. CYTHON_UNUSED_VAR(arg);
  14828. return __Pyx_Coroutine_Close(self);
  14829. }
  14830. static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
  14831. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  14832. PyObject *retval, *raised_exception;
  14833. PyObject *yf = gen->yieldfrom;
  14834. int err = 0;
  14835. if (unlikely(gen->is_running))
  14836. return __Pyx_Coroutine_AlreadyRunningError(gen);
  14837. if (yf) {
  14838. Py_INCREF(yf);
  14839. err = __Pyx_Coroutine_CloseIter(gen, yf);
  14840. __Pyx_Coroutine_Undelegate(gen);
  14841. Py_DECREF(yf);
  14842. }
  14843. if (err == 0)
  14844. PyErr_SetNone(PyExc_GeneratorExit);
  14845. retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
  14846. if (unlikely(retval)) {
  14847. const char *msg;
  14848. Py_DECREF(retval);
  14849. if ((0)) {
  14850. #ifdef __Pyx_Coroutine_USED
  14851. } else if (__Pyx_Coroutine_Check(self)) {
  14852. msg = "coroutine ignored GeneratorExit";
  14853. #endif
  14854. #ifdef __Pyx_AsyncGen_USED
  14855. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  14856. #if PY_VERSION_HEX < 0x03060000
  14857. msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
  14858. #else
  14859. msg = "async generator ignored GeneratorExit";
  14860. #endif
  14861. #endif
  14862. } else {
  14863. msg = "generator ignored GeneratorExit";
  14864. }
  14865. PyErr_SetString(PyExc_RuntimeError, msg);
  14866. return NULL;
  14867. }
  14868. raised_exception = PyErr_Occurred();
  14869. if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
  14870. if (raised_exception) PyErr_Clear();
  14871. Py_INCREF(Py_None);
  14872. return Py_None;
  14873. }
  14874. return NULL;
  14875. }
  14876. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  14877. PyObject *args, int close_on_genexit) {
  14878. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  14879. PyObject *yf = gen->yieldfrom;
  14880. if (unlikely(gen->is_running))
  14881. return __Pyx_Coroutine_AlreadyRunningError(gen);
  14882. if (yf) {
  14883. PyObject *ret;
  14884. Py_INCREF(yf);
  14885. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  14886. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  14887. Py_DECREF(yf);
  14888. __Pyx_Coroutine_Undelegate(gen);
  14889. if (err < 0)
  14890. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  14891. goto throw_here;
  14892. }
  14893. gen->is_running = 1;
  14894. if (0
  14895. #ifdef __Pyx_Generator_USED
  14896. || __Pyx_Generator_CheckExact(yf)
  14897. #endif
  14898. #ifdef __Pyx_Coroutine_USED
  14899. || __Pyx_Coroutine_Check(yf)
  14900. #endif
  14901. ) {
  14902. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  14903. #ifdef __Pyx_Coroutine_USED
  14904. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  14905. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  14906. #endif
  14907. } else {
  14908. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw);
  14909. if (unlikely(!meth)) {
  14910. Py_DECREF(yf);
  14911. if (unlikely(PyErr_Occurred())) {
  14912. gen->is_running = 0;
  14913. return NULL;
  14914. }
  14915. __Pyx_Coroutine_Undelegate(gen);
  14916. gen->is_running = 0;
  14917. goto throw_here;
  14918. }
  14919. if (likely(args)) {
  14920. ret = __Pyx_PyObject_Call(meth, args, NULL);
  14921. } else {
  14922. PyObject *cargs[4] = {NULL, typ, val, tb};
  14923. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  14924. }
  14925. Py_DECREF(meth);
  14926. }
  14927. gen->is_running = 0;
  14928. Py_DECREF(yf);
  14929. if (!ret) {
  14930. ret = __Pyx_Coroutine_FinishDelegation(gen);
  14931. }
  14932. return __Pyx_Coroutine_MethodReturn(self, ret);
  14933. }
  14934. throw_here:
  14935. __Pyx_Raise(typ, val, tb, NULL);
  14936. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  14937. }
  14938. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  14939. PyObject *typ;
  14940. PyObject *val = NULL;
  14941. PyObject *tb = NULL;
  14942. if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)))
  14943. return NULL;
  14944. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  14945. }
  14946. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  14947. #if PY_VERSION_HEX >= 0x030B00a4
  14948. Py_VISIT(exc_state->exc_value);
  14949. #else
  14950. Py_VISIT(exc_state->exc_type);
  14951. Py_VISIT(exc_state->exc_value);
  14952. Py_VISIT(exc_state->exc_traceback);
  14953. #endif
  14954. return 0;
  14955. }
  14956. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  14957. Py_VISIT(gen->closure);
  14958. Py_VISIT(gen->classobj);
  14959. Py_VISIT(gen->yieldfrom);
  14960. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  14961. }
  14962. static int __Pyx_Coroutine_clear(PyObject *self) {
  14963. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  14964. Py_CLEAR(gen->closure);
  14965. Py_CLEAR(gen->classobj);
  14966. Py_CLEAR(gen->yieldfrom);
  14967. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  14968. #ifdef __Pyx_AsyncGen_USED
  14969. if (__Pyx_AsyncGen_CheckExact(self)) {
  14970. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  14971. }
  14972. #endif
  14973. Py_CLEAR(gen->gi_code);
  14974. Py_CLEAR(gen->gi_frame);
  14975. Py_CLEAR(gen->gi_name);
  14976. Py_CLEAR(gen->gi_qualname);
  14977. Py_CLEAR(gen->gi_modulename);
  14978. return 0;
  14979. }
  14980. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  14981. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  14982. PyObject_GC_UnTrack(gen);
  14983. if (gen->gi_weakreflist != NULL)
  14984. PyObject_ClearWeakRefs(self);
  14985. if (gen->resume_label >= 0) {
  14986. PyObject_GC_Track(self);
  14987. #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
  14988. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  14989. #else
  14990. Py_TYPE(gen)->tp_del(self);
  14991. if (unlikely(Py_REFCNT(self) > 0))
  14992. #endif
  14993. {
  14994. return;
  14995. }
  14996. PyObject_GC_UnTrack(self);
  14997. }
  14998. #ifdef __Pyx_AsyncGen_USED
  14999. if (__Pyx_AsyncGen_CheckExact(self)) {
  15000. /* We have to handle this case for asynchronous generators
  15001. right here, because this code has to be between UNTRACK
  15002. and GC_Del. */
  15003. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  15004. }
  15005. #endif
  15006. __Pyx_Coroutine_clear(self);
  15007. __Pyx_PyHeapTypeObject_GC_Del(gen);
  15008. }
  15009. static void __Pyx_Coroutine_del(PyObject *self) {
  15010. PyObject *error_type, *error_value, *error_traceback;
  15011. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  15012. __Pyx_PyThreadState_declare
  15013. if (gen->resume_label < 0) {
  15014. return;
  15015. }
  15016. #if !CYTHON_USE_TP_FINALIZE
  15017. assert(self->ob_refcnt == 0);
  15018. __Pyx_SET_REFCNT(self, 1);
  15019. #endif
  15020. __Pyx_PyThreadState_assign
  15021. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  15022. #ifdef __Pyx_AsyncGen_USED
  15023. if (__Pyx_AsyncGen_CheckExact(self)) {
  15024. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  15025. PyObject *finalizer = agen->ag_finalizer;
  15026. if (finalizer && !agen->ag_closed) {
  15027. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  15028. if (unlikely(!res)) {
  15029. PyErr_WriteUnraisable(self);
  15030. } else {
  15031. Py_DECREF(res);
  15032. }
  15033. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  15034. return;
  15035. }
  15036. }
  15037. #endif
  15038. if (unlikely(gen->resume_label == 0 && !error_value)) {
  15039. #ifdef __Pyx_Coroutine_USED
  15040. #ifdef __Pyx_Generator_USED
  15041. if (!__Pyx_Generator_CheckExact(self))
  15042. #endif
  15043. {
  15044. PyObject_GC_UnTrack(self);
  15045. #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
  15046. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  15047. PyErr_WriteUnraisable(self);
  15048. #else
  15049. {PyObject *msg;
  15050. char *cmsg;
  15051. #if CYTHON_COMPILING_IN_PYPY
  15052. msg = NULL;
  15053. cmsg = (char*) "coroutine was never awaited";
  15054. #else
  15055. char *cname;
  15056. PyObject *qualname;
  15057. qualname = gen->gi_qualname;
  15058. cname = PyString_AS_STRING(qualname);
  15059. msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
  15060. if (unlikely(!msg)) {
  15061. PyErr_Clear();
  15062. cmsg = (char*) "coroutine was never awaited";
  15063. } else {
  15064. cmsg = PyString_AS_STRING(msg);
  15065. }
  15066. #endif
  15067. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
  15068. PyErr_WriteUnraisable(self);
  15069. Py_XDECREF(msg);}
  15070. #endif
  15071. PyObject_GC_Track(self);
  15072. }
  15073. #endif
  15074. } else {
  15075. PyObject *res = __Pyx_Coroutine_Close(self);
  15076. if (unlikely(!res)) {
  15077. if (PyErr_Occurred())
  15078. PyErr_WriteUnraisable(self);
  15079. } else {
  15080. Py_DECREF(res);
  15081. }
  15082. }
  15083. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  15084. #if !CYTHON_USE_TP_FINALIZE
  15085. assert(Py_REFCNT(self) > 0);
  15086. if (likely(--self->ob_refcnt == 0)) {
  15087. return;
  15088. }
  15089. {
  15090. Py_ssize_t refcnt = Py_REFCNT(self);
  15091. _Py_NewReference(self);
  15092. __Pyx_SET_REFCNT(self, refcnt);
  15093. }
  15094. #if CYTHON_COMPILING_IN_CPYTHON
  15095. assert(PyType_IS_GC(Py_TYPE(self)) &&
  15096. _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
  15097. _Py_DEC_REFTOTAL;
  15098. #endif
  15099. #ifdef COUNT_ALLOCS
  15100. --Py_TYPE(self)->tp_frees;
  15101. --Py_TYPE(self)->tp_allocs;
  15102. #endif
  15103. #endif
  15104. }
  15105. static PyObject *
  15106. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  15107. {
  15108. PyObject *name = self->gi_name;
  15109. CYTHON_UNUSED_VAR(context);
  15110. if (unlikely(!name)) name = Py_None;
  15111. Py_INCREF(name);
  15112. return name;
  15113. }
  15114. static int
  15115. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  15116. {
  15117. CYTHON_UNUSED_VAR(context);
  15118. #if PY_MAJOR_VERSION >= 3
  15119. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  15120. #else
  15121. if (unlikely(value == NULL || !PyString_Check(value)))
  15122. #endif
  15123. {
  15124. PyErr_SetString(PyExc_TypeError,
  15125. "__name__ must be set to a string object");
  15126. return -1;
  15127. }
  15128. Py_INCREF(value);
  15129. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  15130. return 0;
  15131. }
  15132. static PyObject *
  15133. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  15134. {
  15135. PyObject *name = self->gi_qualname;
  15136. CYTHON_UNUSED_VAR(context);
  15137. if (unlikely(!name)) name = Py_None;
  15138. Py_INCREF(name);
  15139. return name;
  15140. }
  15141. static int
  15142. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  15143. {
  15144. CYTHON_UNUSED_VAR(context);
  15145. #if PY_MAJOR_VERSION >= 3
  15146. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  15147. #else
  15148. if (unlikely(value == NULL || !PyString_Check(value)))
  15149. #endif
  15150. {
  15151. PyErr_SetString(PyExc_TypeError,
  15152. "__qualname__ must be set to a string object");
  15153. return -1;
  15154. }
  15155. Py_INCREF(value);
  15156. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  15157. return 0;
  15158. }
  15159. static PyObject *
  15160. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context)
  15161. {
  15162. PyObject *frame = self->gi_frame;
  15163. CYTHON_UNUSED_VAR(context);
  15164. if (!frame) {
  15165. if (unlikely(!self->gi_code)) {
  15166. Py_RETURN_NONE;
  15167. }
  15168. frame = (PyObject *) PyFrame_New(
  15169. PyThreadState_Get(), /*PyThreadState *tstate,*/
  15170. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  15171. __pyx_d, /*PyObject *globals,*/
  15172. 0 /*PyObject *locals*/
  15173. );
  15174. if (unlikely(!frame))
  15175. return NULL;
  15176. self->gi_frame = frame;
  15177. }
  15178. Py_INCREF(frame);
  15179. return frame;
  15180. }
  15181. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  15182. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  15183. PyObject *name, PyObject *qualname, PyObject *module_name) {
  15184. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  15185. if (unlikely(!gen))
  15186. return NULL;
  15187. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  15188. }
  15189. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  15190. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  15191. PyObject *name, PyObject *qualname, PyObject *module_name) {
  15192. gen->body = body;
  15193. gen->closure = closure;
  15194. Py_XINCREF(closure);
  15195. gen->is_running = 0;
  15196. gen->resume_label = 0;
  15197. gen->classobj = NULL;
  15198. gen->yieldfrom = NULL;
  15199. #if PY_VERSION_HEX >= 0x030B00a4
  15200. gen->gi_exc_state.exc_value = NULL;
  15201. #else
  15202. gen->gi_exc_state.exc_type = NULL;
  15203. gen->gi_exc_state.exc_value = NULL;
  15204. gen->gi_exc_state.exc_traceback = NULL;
  15205. #endif
  15206. #if CYTHON_USE_EXC_INFO_STACK
  15207. gen->gi_exc_state.previous_item = NULL;
  15208. #endif
  15209. gen->gi_weakreflist = NULL;
  15210. Py_XINCREF(qualname);
  15211. gen->gi_qualname = qualname;
  15212. Py_XINCREF(name);
  15213. gen->gi_name = name;
  15214. Py_XINCREF(module_name);
  15215. gen->gi_modulename = module_name;
  15216. Py_XINCREF(code);
  15217. gen->gi_code = code;
  15218. gen->gi_frame = NULL;
  15219. PyObject_GC_Track(gen);
  15220. return gen;
  15221. }
  15222. /* PatchModuleWithCoroutine */
  15223. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
  15224. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  15225. int result;
  15226. PyObject *globals, *result_obj;
  15227. globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
  15228. result = PyDict_SetItemString(globals, "_cython_coroutine_type",
  15229. #ifdef __Pyx_Coroutine_USED
  15230. (PyObject*)__pyx_CoroutineType);
  15231. #else
  15232. Py_None);
  15233. #endif
  15234. if (unlikely(result < 0)) goto ignore;
  15235. result = PyDict_SetItemString(globals, "_cython_generator_type",
  15236. #ifdef __Pyx_Generator_USED
  15237. (PyObject*)__pyx_GeneratorType);
  15238. #else
  15239. Py_None);
  15240. #endif
  15241. if (unlikely(result < 0)) goto ignore;
  15242. if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
  15243. if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
  15244. result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
  15245. if (unlikely(!result_obj)) goto ignore;
  15246. Py_DECREF(result_obj);
  15247. Py_DECREF(globals);
  15248. return module;
  15249. ignore:
  15250. Py_XDECREF(globals);
  15251. PyErr_WriteUnraisable(module);
  15252. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
  15253. Py_DECREF(module);
  15254. module = NULL;
  15255. }
  15256. #else
  15257. py_code++;
  15258. #endif
  15259. return module;
  15260. }
  15261. /* PatchGeneratorABC */
  15262. #ifndef CYTHON_REGISTER_ABCS
  15263. #define CYTHON_REGISTER_ABCS 1
  15264. #endif
  15265. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  15266. static PyObject* __Pyx_patch_abc_module(PyObject *module);
  15267. static PyObject* __Pyx_patch_abc_module(PyObject *module) {
  15268. module = __Pyx_Coroutine_patch_module(
  15269. module, ""
  15270. "if _cython_generator_type is not None:\n"
  15271. " try: Generator = _module.Generator\n"
  15272. " except AttributeError: pass\n"
  15273. " else: Generator.register(_cython_generator_type)\n"
  15274. "if _cython_coroutine_type is not None:\n"
  15275. " try: Coroutine = _module.Coroutine\n"
  15276. " except AttributeError: pass\n"
  15277. " else: Coroutine.register(_cython_coroutine_type)\n"
  15278. );
  15279. return module;
  15280. }
  15281. #endif
  15282. static int __Pyx_patch_abc(void) {
  15283. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  15284. static int abc_patched = 0;
  15285. if (CYTHON_REGISTER_ABCS && !abc_patched) {
  15286. PyObject *module;
  15287. module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
  15288. if (unlikely(!module)) {
  15289. PyErr_WriteUnraisable(NULL);
  15290. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
  15291. ((PY_MAJOR_VERSION >= 3) ?
  15292. "Cython module failed to register with collections.abc module" :
  15293. "Cython module failed to register with collections module"), 1) < 0)) {
  15294. return -1;
  15295. }
  15296. } else {
  15297. module = __Pyx_patch_abc_module(module);
  15298. abc_patched = 1;
  15299. if (unlikely(!module))
  15300. return -1;
  15301. Py_DECREF(module);
  15302. }
  15303. module = PyImport_ImportModule("backports_abc");
  15304. if (module) {
  15305. module = __Pyx_patch_abc_module(module);
  15306. Py_XDECREF(module);
  15307. }
  15308. if (!module) {
  15309. PyErr_Clear();
  15310. }
  15311. }
  15312. #else
  15313. if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
  15314. #endif
  15315. return 0;
  15316. }
  15317. /* Generator */
  15318. static PyMethodDef __pyx_Generator_methods[] = {
  15319. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  15320. (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  15321. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  15322. (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  15323. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  15324. (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  15325. {0, 0, 0, 0}
  15326. };
  15327. static PyMemberDef __pyx_Generator_memberlist[] = {
  15328. {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
  15329. {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  15330. (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
  15331. {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  15332. {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  15333. #if CYTHON_USE_TYPE_SPECS
  15334. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  15335. #endif
  15336. {0, 0, 0, 0, 0}
  15337. };
  15338. static PyGetSetDef __pyx_Generator_getsets[] = {
  15339. {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  15340. (char*) PyDoc_STR("name of the generator"), 0},
  15341. {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  15342. (char*) PyDoc_STR("qualified name of the generator"), 0},
  15343. {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  15344. (char*) PyDoc_STR("Frame of the generator"), 0},
  15345. {0, 0, 0, 0, 0}
  15346. };
  15347. #if CYTHON_USE_TYPE_SPECS
  15348. static PyType_Slot __pyx_GeneratorType_slots[] = {
  15349. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  15350. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  15351. {Py_tp_iter, (void *)PyObject_SelfIter},
  15352. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  15353. {Py_tp_methods, (void *)__pyx_Generator_methods},
  15354. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  15355. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  15356. {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict},
  15357. #if CYTHON_USE_TP_FINALIZE
  15358. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  15359. #endif
  15360. {0, 0},
  15361. };
  15362. static PyType_Spec __pyx_GeneratorType_spec = {
  15363. __PYX_TYPE_MODULE_PREFIX "generator",
  15364. sizeof(__pyx_CoroutineObject),
  15365. 0,
  15366. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
  15367. __pyx_GeneratorType_slots
  15368. };
  15369. #else
  15370. static PyTypeObject __pyx_GeneratorType_type = {
  15371. PyVarObject_HEAD_INIT(0, 0)
  15372. __PYX_TYPE_MODULE_PREFIX "generator",
  15373. sizeof(__pyx_CoroutineObject),
  15374. 0,
  15375. (destructor) __Pyx_Coroutine_dealloc,
  15376. 0,
  15377. 0,
  15378. 0,
  15379. 0,
  15380. 0,
  15381. 0,
  15382. 0,
  15383. 0,
  15384. 0,
  15385. 0,
  15386. 0,
  15387. 0,
  15388. 0,
  15389. 0,
  15390. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
  15391. 0,
  15392. (traverseproc) __Pyx_Coroutine_traverse,
  15393. 0,
  15394. 0,
  15395. offsetof(__pyx_CoroutineObject, gi_weakreflist),
  15396. 0,
  15397. (iternextfunc) __Pyx_Generator_Next,
  15398. __pyx_Generator_methods,
  15399. __pyx_Generator_memberlist,
  15400. __pyx_Generator_getsets,
  15401. 0,
  15402. 0,
  15403. 0,
  15404. 0,
  15405. 0,
  15406. 0,
  15407. 0,
  15408. 0,
  15409. 0,
  15410. 0,
  15411. 0,
  15412. 0,
  15413. 0,
  15414. 0,
  15415. 0,
  15416. #if CYTHON_USE_TP_FINALIZE
  15417. 0,
  15418. #else
  15419. __Pyx_Coroutine_del,
  15420. #endif
  15421. 0,
  15422. #if CYTHON_USE_TP_FINALIZE
  15423. __Pyx_Coroutine_del,
  15424. #elif PY_VERSION_HEX >= 0x030400a1
  15425. 0,
  15426. #endif
  15427. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  15428. 0,
  15429. #endif
  15430. #if __PYX_NEED_TP_PRINT_SLOT
  15431. 0,
  15432. #endif
  15433. #if PY_VERSION_HEX >= 0x030C0000
  15434. 0,
  15435. #endif
  15436. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  15437. 0,
  15438. #endif
  15439. };
  15440. #endif
  15441. static int __pyx_Generator_init(PyObject *module) {
  15442. #if CYTHON_USE_TYPE_SPECS
  15443. __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL);
  15444. #else
  15445. CYTHON_UNUSED_VAR(module);
  15446. __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  15447. __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
  15448. __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
  15449. #endif
  15450. if (unlikely(!__pyx_GeneratorType)) {
  15451. return -1;
  15452. }
  15453. return 0;
  15454. }
  15455. /* CheckBinaryVersion */
  15456. static unsigned long __Pyx_get_runtime_version(void) {
  15457. #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
  15458. return Py_Version & ~0xFFUL;
  15459. #else
  15460. const char* rt_version = Py_GetVersion();
  15461. unsigned long version = 0;
  15462. unsigned long factor = 0x01000000UL;
  15463. unsigned int digit = 0;
  15464. int i = 0;
  15465. while (factor) {
  15466. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  15467. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  15468. ++i;
  15469. }
  15470. version += factor * digit;
  15471. if (rt_version[i] != '.')
  15472. break;
  15473. digit = 0;
  15474. factor >>= 8;
  15475. ++i;
  15476. }
  15477. return version;
  15478. #endif
  15479. }
  15480. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  15481. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  15482. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  15483. return 0;
  15484. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  15485. return 1;
  15486. {
  15487. char message[200];
  15488. PyOS_snprintf(message, sizeof(message),
  15489. "compile time Python version %d.%d "
  15490. "of module '%.100s' "
  15491. "%s "
  15492. "runtime version %d.%d",
  15493. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  15494. __Pyx_MODULE_NAME,
  15495. (allow_newer) ? "was newer than" : "does not match",
  15496. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  15497. );
  15498. return PyErr_WarnEx(NULL, message, 1);
  15499. }
  15500. }
  15501. /* InitStrings */
  15502. #if PY_MAJOR_VERSION >= 3
  15503. static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
  15504. if (t.is_unicode | t.is_str) {
  15505. if (t.intern) {
  15506. *str = PyUnicode_InternFromString(t.s);
  15507. } else if (t.encoding) {
  15508. *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
  15509. } else {
  15510. *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
  15511. }
  15512. } else {
  15513. *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
  15514. }
  15515. if (!*str)
  15516. return -1;
  15517. if (PyObject_Hash(*str) == -1)
  15518. return -1;
  15519. return 0;
  15520. }
  15521. #endif
  15522. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  15523. while (t->p) {
  15524. #if PY_MAJOR_VERSION >= 3
  15525. __Pyx_InitString(*t, t->p);
  15526. #else
  15527. if (t->is_unicode) {
  15528. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  15529. } else if (t->intern) {
  15530. *t->p = PyString_InternFromString(t->s);
  15531. } else {
  15532. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  15533. }
  15534. if (!*t->p)
  15535. return -1;
  15536. if (PyObject_Hash(*t->p) == -1)
  15537. return -1;
  15538. #endif
  15539. ++t;
  15540. }
  15541. return 0;
  15542. }
  15543. #include <string.h>
  15544. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  15545. size_t len = strlen(s);
  15546. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  15547. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  15548. return -1;
  15549. }
  15550. return (Py_ssize_t) len;
  15551. }
  15552. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  15553. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  15554. if (unlikely(len < 0)) return NULL;
  15555. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  15556. }
  15557. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  15558. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  15559. if (unlikely(len < 0)) return NULL;
  15560. return PyByteArray_FromStringAndSize(c_str, len);
  15561. }
  15562. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  15563. Py_ssize_t ignore;
  15564. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  15565. }
  15566. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  15567. #if !CYTHON_PEP393_ENABLED
  15568. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  15569. char* defenc_c;
  15570. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  15571. if (!defenc) return NULL;
  15572. defenc_c = PyBytes_AS_STRING(defenc);
  15573. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  15574. {
  15575. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  15576. char* c;
  15577. for (c = defenc_c; c < end; c++) {
  15578. if ((unsigned char) (*c) >= 128) {
  15579. PyUnicode_AsASCIIString(o);
  15580. return NULL;
  15581. }
  15582. }
  15583. }
  15584. #endif
  15585. *length = PyBytes_GET_SIZE(defenc);
  15586. return defenc_c;
  15587. }
  15588. #else
  15589. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  15590. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  15591. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  15592. if (likely(PyUnicode_IS_ASCII(o))) {
  15593. *length = PyUnicode_GET_LENGTH(o);
  15594. return PyUnicode_AsUTF8(o);
  15595. } else {
  15596. PyUnicode_AsASCIIString(o);
  15597. return NULL;
  15598. }
  15599. #else
  15600. return PyUnicode_AsUTF8AndSize(o, length);
  15601. #endif
  15602. }
  15603. #endif
  15604. #endif
  15605. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  15606. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  15607. if (
  15608. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  15609. __Pyx_sys_getdefaultencoding_not_ascii &&
  15610. #endif
  15611. PyUnicode_Check(o)) {
  15612. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  15613. } else
  15614. #endif
  15615. #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  15616. if (PyByteArray_Check(o)) {
  15617. *length = PyByteArray_GET_SIZE(o);
  15618. return PyByteArray_AS_STRING(o);
  15619. } else
  15620. #endif
  15621. {
  15622. char* result;
  15623. int r = PyBytes_AsStringAndSize(o, &result, length);
  15624. if (unlikely(r < 0)) {
  15625. return NULL;
  15626. } else {
  15627. return result;
  15628. }
  15629. }
  15630. }
  15631. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  15632. int is_true = x == Py_True;
  15633. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  15634. else return PyObject_IsTrue(x);
  15635. }
  15636. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  15637. int retval;
  15638. if (unlikely(!x)) return -1;
  15639. retval = __Pyx_PyObject_IsTrue(x);
  15640. Py_DECREF(x);
  15641. return retval;
  15642. }
  15643. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  15644. __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
  15645. #if PY_MAJOR_VERSION >= 3
  15646. if (PyLong_Check(result)) {
  15647. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  15648. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  15649. "The ability to return an instance of a strict subclass of int is deprecated, "
  15650. "and may be removed in a future version of Python.",
  15651. result_type_name)) {
  15652. __Pyx_DECREF_TypeName(result_type_name);
  15653. Py_DECREF(result);
  15654. return NULL;
  15655. }
  15656. __Pyx_DECREF_TypeName(result_type_name);
  15657. return result;
  15658. }
  15659. #endif
  15660. PyErr_Format(PyExc_TypeError,
  15661. "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
  15662. type_name, type_name, result_type_name);
  15663. __Pyx_DECREF_TypeName(result_type_name);
  15664. Py_DECREF(result);
  15665. return NULL;
  15666. }
  15667. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  15668. #if CYTHON_USE_TYPE_SLOTS
  15669. PyNumberMethods *m;
  15670. #endif
  15671. const char *name = NULL;
  15672. PyObject *res = NULL;
  15673. #if PY_MAJOR_VERSION < 3
  15674. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  15675. #else
  15676. if (likely(PyLong_Check(x)))
  15677. #endif
  15678. return __Pyx_NewRef(x);
  15679. #if CYTHON_USE_TYPE_SLOTS
  15680. m = Py_TYPE(x)->tp_as_number;
  15681. #if PY_MAJOR_VERSION < 3
  15682. if (m && m->nb_int) {
  15683. name = "int";
  15684. res = m->nb_int(x);
  15685. }
  15686. else if (m && m->nb_long) {
  15687. name = "long";
  15688. res = m->nb_long(x);
  15689. }
  15690. #else
  15691. if (likely(m && m->nb_int)) {
  15692. name = "int";
  15693. res = m->nb_int(x);
  15694. }
  15695. #endif
  15696. #else
  15697. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  15698. res = PyNumber_Int(x);
  15699. }
  15700. #endif
  15701. if (likely(res)) {
  15702. #if PY_MAJOR_VERSION < 3
  15703. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  15704. #else
  15705. if (unlikely(!PyLong_CheckExact(res))) {
  15706. #endif
  15707. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  15708. }
  15709. }
  15710. else if (!PyErr_Occurred()) {
  15711. PyErr_SetString(PyExc_TypeError,
  15712. "an integer is required");
  15713. }
  15714. return res;
  15715. }
  15716. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  15717. Py_ssize_t ival;
  15718. PyObject *x;
  15719. #if PY_MAJOR_VERSION < 3
  15720. if (likely(PyInt_CheckExact(b))) {
  15721. if (sizeof(Py_ssize_t) >= sizeof(long))
  15722. return PyInt_AS_LONG(b);
  15723. else
  15724. return PyInt_AsSsize_t(b);
  15725. }
  15726. #endif
  15727. if (likely(PyLong_CheckExact(b))) {
  15728. #if CYTHON_USE_PYLONG_INTERNALS
  15729. if (likely(__Pyx_PyLong_IsCompact(b))) {
  15730. return __Pyx_PyLong_CompactValue(b);
  15731. } else {
  15732. const digit* digits = __Pyx_PyLong_Digits(b);
  15733. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  15734. switch (size) {
  15735. case 2:
  15736. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  15737. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15738. }
  15739. break;
  15740. case -2:
  15741. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  15742. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15743. }
  15744. break;
  15745. case 3:
  15746. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  15747. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15748. }
  15749. break;
  15750. case -3:
  15751. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  15752. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15753. }
  15754. break;
  15755. case 4:
  15756. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  15757. return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15758. }
  15759. break;
  15760. case -4:
  15761. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  15762. return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  15763. }
  15764. break;
  15765. }
  15766. }
  15767. #endif
  15768. return PyLong_AsSsize_t(b);
  15769. }
  15770. x = PyNumber_Index(b);
  15771. if (!x) return -1;
  15772. ival = PyInt_AsSsize_t(x);
  15773. Py_DECREF(x);
  15774. return ival;
  15775. }
  15776. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  15777. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  15778. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  15779. #if PY_MAJOR_VERSION < 3
  15780. } else if (likely(PyInt_CheckExact(o))) {
  15781. return PyInt_AS_LONG(o);
  15782. #endif
  15783. } else {
  15784. Py_ssize_t ival;
  15785. PyObject *x;
  15786. x = PyNumber_Index(o);
  15787. if (!x) return -1;
  15788. ival = PyInt_AsLong(x);
  15789. Py_DECREF(x);
  15790. return ival;
  15791. }
  15792. }
  15793. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  15794. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  15795. }
  15796. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  15797. return PyInt_FromSize_t(ival);
  15798. }
  15799. /* #### Code section: utility_code_pragmas_end ### */
  15800. #ifdef _MSC_VER
  15801. #pragma warning( pop )
  15802. #endif
  15803. /* #### Code section: end ### */
  15804. #endif /* Py_PYTHON_H */