iup.c 816 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845
  1. /* Generated by Cython 3.2.4 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "name": "fontTools.varLib.iup",
  6. "sources": [
  7. "Lib/fontTools/varLib/iup.py"
  8. ]
  9. },
  10. "module_name": "fontTools.varLib.iup"
  11. }
  12. END: Cython Metadata */
  13. #ifndef PY_SSIZE_T_CLEAN
  14. #define PY_SSIZE_T_CLEAN
  15. #endif /* PY_SSIZE_T_CLEAN */
  16. /* InitLimitedAPI */
  17. #if defined(Py_LIMITED_API)
  18. #if !defined(CYTHON_LIMITED_API)
  19. #define CYTHON_LIMITED_API 1
  20. #endif
  21. #elif defined(CYTHON_LIMITED_API)
  22. #ifdef _MSC_VER
  23. #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  24. #else
  25. #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  26. #endif
  27. #endif
  28. #include "Python.h"
  29. #ifndef Py_PYTHON_H
  30. #error Python headers needed to compile C extensions, please install development version of Python.
  31. #elif PY_VERSION_HEX < 0x03080000
  32. #error Cython requires Python 3.8+.
  33. #else
  34. #define __PYX_ABI_VERSION "3_2_4"
  35. #define CYTHON_HEX_VERSION 0x030204F0
  36. #define CYTHON_FUTURE_DIVISION 1
  37. /* CModulePreamble */
  38. #include <stddef.h>
  39. #ifndef offsetof
  40. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  41. #endif
  42. #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  43. #ifndef __stdcall
  44. #define __stdcall
  45. #endif
  46. #ifndef __cdecl
  47. #define __cdecl
  48. #endif
  49. #ifndef __fastcall
  50. #define __fastcall
  51. #endif
  52. #endif
  53. #ifndef DL_IMPORT
  54. #define DL_IMPORT(t) t
  55. #endif
  56. #ifndef DL_EXPORT
  57. #define DL_EXPORT(t) t
  58. #endif
  59. #define __PYX_COMMA ,
  60. #ifndef PY_LONG_LONG
  61. #define PY_LONG_LONG LONG_LONG
  62. #endif
  63. #ifndef Py_HUGE_VAL
  64. #define Py_HUGE_VAL HUGE_VAL
  65. #endif
  66. #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
  67. #if defined(GRAALVM_PYTHON)
  68. /* For very preliminary testing purposes. Most variables are set the same as PyPy.
  69. The existence of this section does not imply that anything works or is even tested */
  70. #define CYTHON_COMPILING_IN_PYPY 0
  71. #define CYTHON_COMPILING_IN_CPYTHON 0
  72. #define CYTHON_COMPILING_IN_LIMITED_API 0
  73. #define CYTHON_COMPILING_IN_GRAAL 1
  74. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  75. #undef CYTHON_USE_TYPE_SLOTS
  76. #define CYTHON_USE_TYPE_SLOTS 0
  77. #undef CYTHON_USE_TYPE_SPECS
  78. #define CYTHON_USE_TYPE_SPECS 0
  79. #undef CYTHON_USE_PYTYPE_LOOKUP
  80. #define CYTHON_USE_PYTYPE_LOOKUP 0
  81. #undef CYTHON_USE_PYLIST_INTERNALS
  82. #define CYTHON_USE_PYLIST_INTERNALS 0
  83. #undef CYTHON_USE_UNICODE_INTERNALS
  84. #define CYTHON_USE_UNICODE_INTERNALS 0
  85. #undef CYTHON_USE_UNICODE_WRITER
  86. #define CYTHON_USE_UNICODE_WRITER 0
  87. #undef CYTHON_USE_PYLONG_INTERNALS
  88. #define CYTHON_USE_PYLONG_INTERNALS 0
  89. #undef CYTHON_AVOID_BORROWED_REFS
  90. #define CYTHON_AVOID_BORROWED_REFS 1
  91. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  92. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  93. #undef CYTHON_ASSUME_SAFE_MACROS
  94. #define CYTHON_ASSUME_SAFE_MACROS 0
  95. #undef CYTHON_ASSUME_SAFE_SIZE
  96. #define CYTHON_ASSUME_SAFE_SIZE 0
  97. #undef CYTHON_UNPACK_METHODS
  98. #define CYTHON_UNPACK_METHODS 0
  99. #undef CYTHON_FAST_THREAD_STATE
  100. #define CYTHON_FAST_THREAD_STATE 0
  101. #undef CYTHON_FAST_GIL
  102. #define CYTHON_FAST_GIL 0
  103. #undef CYTHON_METH_FASTCALL
  104. #define CYTHON_METH_FASTCALL 0
  105. #undef CYTHON_FAST_PYCALL
  106. #define CYTHON_FAST_PYCALL 0
  107. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  108. #define CYTHON_PEP487_INIT_SUBCLASS 1
  109. #endif
  110. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  111. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  112. #undef CYTHON_USE_MODULE_STATE
  113. #define CYTHON_USE_MODULE_STATE 0
  114. #undef CYTHON_USE_SYS_MONITORING
  115. #define CYTHON_USE_SYS_MONITORING 0
  116. #undef CYTHON_USE_TP_FINALIZE
  117. #define CYTHON_USE_TP_FINALIZE 0
  118. #undef CYTHON_USE_AM_SEND
  119. #define CYTHON_USE_AM_SEND 0
  120. #undef CYTHON_USE_DICT_VERSIONS
  121. #define CYTHON_USE_DICT_VERSIONS 0
  122. #undef CYTHON_USE_EXC_INFO_STACK
  123. #define CYTHON_USE_EXC_INFO_STACK 1
  124. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  125. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  126. #endif
  127. #undef CYTHON_USE_FREELISTS
  128. #define CYTHON_USE_FREELISTS 0
  129. #undef CYTHON_IMMORTAL_CONSTANTS
  130. #define CYTHON_IMMORTAL_CONSTANTS 0
  131. #elif defined(PYPY_VERSION)
  132. #define CYTHON_COMPILING_IN_PYPY 1
  133. #define CYTHON_COMPILING_IN_CPYTHON 0
  134. #define CYTHON_COMPILING_IN_LIMITED_API 0
  135. #define CYTHON_COMPILING_IN_GRAAL 0
  136. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  137. #undef CYTHON_USE_TYPE_SLOTS
  138. #define CYTHON_USE_TYPE_SLOTS 1
  139. #ifndef CYTHON_USE_TYPE_SPECS
  140. #define CYTHON_USE_TYPE_SPECS 0
  141. #endif
  142. #undef CYTHON_USE_PYTYPE_LOOKUP
  143. #define CYTHON_USE_PYTYPE_LOOKUP 0
  144. #undef CYTHON_USE_PYLIST_INTERNALS
  145. #define CYTHON_USE_PYLIST_INTERNALS 0
  146. #undef CYTHON_USE_UNICODE_INTERNALS
  147. #define CYTHON_USE_UNICODE_INTERNALS 0
  148. #undef CYTHON_USE_UNICODE_WRITER
  149. #define CYTHON_USE_UNICODE_WRITER 0
  150. #undef CYTHON_USE_PYLONG_INTERNALS
  151. #define CYTHON_USE_PYLONG_INTERNALS 0
  152. #undef CYTHON_AVOID_BORROWED_REFS
  153. #define CYTHON_AVOID_BORROWED_REFS 1
  154. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  155. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  156. #undef CYTHON_ASSUME_SAFE_MACROS
  157. #define CYTHON_ASSUME_SAFE_MACROS 0
  158. #ifndef CYTHON_ASSUME_SAFE_SIZE
  159. #define CYTHON_ASSUME_SAFE_SIZE 1
  160. #endif
  161. #undef CYTHON_UNPACK_METHODS
  162. #define CYTHON_UNPACK_METHODS 0
  163. #undef CYTHON_FAST_THREAD_STATE
  164. #define CYTHON_FAST_THREAD_STATE 0
  165. #undef CYTHON_FAST_GIL
  166. #define CYTHON_FAST_GIL 0
  167. #undef CYTHON_METH_FASTCALL
  168. #define CYTHON_METH_FASTCALL 0
  169. #undef CYTHON_FAST_PYCALL
  170. #define CYTHON_FAST_PYCALL 0
  171. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  172. #define CYTHON_PEP487_INIT_SUBCLASS 1
  173. #endif
  174. #if PY_VERSION_HEX < 0x03090000
  175. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  176. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  177. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  178. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  179. #endif
  180. #undef CYTHON_USE_MODULE_STATE
  181. #define CYTHON_USE_MODULE_STATE 0
  182. #undef CYTHON_USE_SYS_MONITORING
  183. #define CYTHON_USE_SYS_MONITORING 0
  184. #ifndef CYTHON_USE_TP_FINALIZE
  185. #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  186. #endif
  187. #undef CYTHON_USE_AM_SEND
  188. #define CYTHON_USE_AM_SEND 0
  189. #undef CYTHON_USE_DICT_VERSIONS
  190. #define CYTHON_USE_DICT_VERSIONS 0
  191. #undef CYTHON_USE_EXC_INFO_STACK
  192. #define CYTHON_USE_EXC_INFO_STACK 0
  193. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  194. #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  195. #endif
  196. #undef CYTHON_USE_FREELISTS
  197. #define CYTHON_USE_FREELISTS 0
  198. #undef CYTHON_IMMORTAL_CONSTANTS
  199. #define CYTHON_IMMORTAL_CONSTANTS 0
  200. #elif defined(CYTHON_LIMITED_API)
  201. #ifdef Py_LIMITED_API
  202. #undef __PYX_LIMITED_VERSION_HEX
  203. #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  204. #endif
  205. #define CYTHON_COMPILING_IN_PYPY 0
  206. #define CYTHON_COMPILING_IN_CPYTHON 0
  207. #define CYTHON_COMPILING_IN_LIMITED_API 1
  208. #define CYTHON_COMPILING_IN_GRAAL 0
  209. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 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_PYLIST_INTERNALS
  217. #define CYTHON_USE_PYLIST_INTERNALS 0
  218. #undef CYTHON_USE_UNICODE_INTERNALS
  219. #define CYTHON_USE_UNICODE_INTERNALS 0
  220. #ifndef CYTHON_USE_UNICODE_WRITER
  221. #define CYTHON_USE_UNICODE_WRITER 0
  222. #endif
  223. #undef CYTHON_USE_PYLONG_INTERNALS
  224. #define CYTHON_USE_PYLONG_INTERNALS 0
  225. #ifndef CYTHON_AVOID_BORROWED_REFS
  226. #define CYTHON_AVOID_BORROWED_REFS 0
  227. #endif
  228. #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  229. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  230. #endif
  231. #undef CYTHON_ASSUME_SAFE_MACROS
  232. #define CYTHON_ASSUME_SAFE_MACROS 0
  233. #undef CYTHON_ASSUME_SAFE_SIZE
  234. #define CYTHON_ASSUME_SAFE_SIZE 0
  235. #undef CYTHON_UNPACK_METHODS
  236. #define CYTHON_UNPACK_METHODS 0
  237. #undef CYTHON_FAST_THREAD_STATE
  238. #define CYTHON_FAST_THREAD_STATE 0
  239. #undef CYTHON_FAST_GIL
  240. #define CYTHON_FAST_GIL 0
  241. #undef CYTHON_METH_FASTCALL
  242. #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  243. #undef CYTHON_FAST_PYCALL
  244. #define CYTHON_FAST_PYCALL 0
  245. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  246. #define CYTHON_PEP487_INIT_SUBCLASS 1
  247. #endif
  248. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  249. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  250. #endif
  251. #ifndef CYTHON_USE_MODULE_STATE
  252. #define CYTHON_USE_MODULE_STATE 0
  253. #endif
  254. #undef CYTHON_USE_SYS_MONITORING
  255. #define CYTHON_USE_SYS_MONITORING 0
  256. #ifndef CYTHON_USE_TP_FINALIZE
  257. #define CYTHON_USE_TP_FINALIZE 0
  258. #endif
  259. #ifndef CYTHON_USE_AM_SEND
  260. #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  261. #endif
  262. #undef CYTHON_USE_DICT_VERSIONS
  263. #define CYTHON_USE_DICT_VERSIONS 0
  264. #undef CYTHON_USE_EXC_INFO_STACK
  265. #define CYTHON_USE_EXC_INFO_STACK 0
  266. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  267. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  268. #endif
  269. #ifndef CYTHON_USE_FREELISTS
  270. #define CYTHON_USE_FREELISTS 1
  271. #endif
  272. #undef CYTHON_IMMORTAL_CONSTANTS
  273. #define CYTHON_IMMORTAL_CONSTANTS 0
  274. #else
  275. #define CYTHON_COMPILING_IN_PYPY 0
  276. #define CYTHON_COMPILING_IN_CPYTHON 1
  277. #define CYTHON_COMPILING_IN_LIMITED_API 0
  278. #define CYTHON_COMPILING_IN_GRAAL 0
  279. #ifdef Py_GIL_DISABLED
  280. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  281. #else
  282. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  283. #endif
  284. #if PY_VERSION_HEX < 0x030A0000
  285. #undef CYTHON_USE_TYPE_SLOTS
  286. #define CYTHON_USE_TYPE_SLOTS 1
  287. #elif !defined(CYTHON_USE_TYPE_SLOTS)
  288. #define CYTHON_USE_TYPE_SLOTS 1
  289. #endif
  290. #ifndef CYTHON_USE_TYPE_SPECS
  291. #define CYTHON_USE_TYPE_SPECS 0
  292. #endif
  293. #ifndef CYTHON_USE_PYTYPE_LOOKUP
  294. #define CYTHON_USE_PYTYPE_LOOKUP 1
  295. #endif
  296. #ifndef CYTHON_USE_PYLONG_INTERNALS
  297. #define CYTHON_USE_PYLONG_INTERNALS 1
  298. #endif
  299. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  300. #undef CYTHON_USE_PYLIST_INTERNALS
  301. #define CYTHON_USE_PYLIST_INTERNALS 0
  302. #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
  303. #define CYTHON_USE_PYLIST_INTERNALS 1
  304. #endif
  305. #ifndef CYTHON_USE_UNICODE_INTERNALS
  306. #define CYTHON_USE_UNICODE_INTERNALS 1
  307. #endif
  308. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
  309. #undef CYTHON_USE_UNICODE_WRITER
  310. #define CYTHON_USE_UNICODE_WRITER 0
  311. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  312. #define CYTHON_USE_UNICODE_WRITER 1
  313. #endif
  314. #ifndef CYTHON_AVOID_BORROWED_REFS
  315. #define CYTHON_AVOID_BORROWED_REFS 0
  316. #endif
  317. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  318. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  319. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  320. #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
  321. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  322. #endif
  323. #ifndef CYTHON_ASSUME_SAFE_MACROS
  324. #define CYTHON_ASSUME_SAFE_MACROS 1
  325. #endif
  326. #ifndef CYTHON_ASSUME_SAFE_SIZE
  327. #define CYTHON_ASSUME_SAFE_SIZE 1
  328. #endif
  329. #ifndef CYTHON_UNPACK_METHODS
  330. #define CYTHON_UNPACK_METHODS 1
  331. #endif
  332. #ifndef CYTHON_FAST_THREAD_STATE
  333. #define CYTHON_FAST_THREAD_STATE 1
  334. #endif
  335. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  336. #undef CYTHON_FAST_GIL
  337. #define CYTHON_FAST_GIL 0
  338. #elif !defined(CYTHON_FAST_GIL)
  339. #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  340. #endif
  341. #ifndef CYTHON_METH_FASTCALL
  342. #define CYTHON_METH_FASTCALL 1
  343. #endif
  344. #ifndef CYTHON_FAST_PYCALL
  345. #define CYTHON_FAST_PYCALL 1
  346. #endif
  347. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  348. #define CYTHON_PEP487_INIT_SUBCLASS 1
  349. #endif
  350. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  351. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  352. #endif
  353. #ifndef CYTHON_USE_MODULE_STATE
  354. #define CYTHON_USE_MODULE_STATE 0
  355. #endif
  356. #ifndef CYTHON_USE_SYS_MONITORING
  357. #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  358. #endif
  359. #ifndef CYTHON_USE_TP_FINALIZE
  360. #define CYTHON_USE_TP_FINALIZE 1
  361. #endif
  362. #ifndef CYTHON_USE_AM_SEND
  363. #define CYTHON_USE_AM_SEND 1
  364. #endif
  365. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  366. #undef CYTHON_USE_DICT_VERSIONS
  367. #define CYTHON_USE_DICT_VERSIONS 0
  368. #elif !defined(CYTHON_USE_DICT_VERSIONS)
  369. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  370. #endif
  371. #ifndef CYTHON_USE_EXC_INFO_STACK
  372. #define CYTHON_USE_EXC_INFO_STACK 1
  373. #endif
  374. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  375. #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  376. #endif
  377. #ifndef CYTHON_USE_FREELISTS
  378. #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  379. #endif
  380. #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
  381. #undef CYTHON_IMMORTAL_CONSTANTS
  382. #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work
  383. #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
  384. #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  385. #endif
  386. #endif
  387. #ifndef CYTHON_COMPRESS_STRINGS
  388. #define CYTHON_COMPRESS_STRINGS 1
  389. #endif
  390. #ifndef CYTHON_FAST_PYCCALL
  391. #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL
  392. #endif
  393. #ifndef CYTHON_VECTORCALL
  394. #if CYTHON_COMPILING_IN_LIMITED_API
  395. #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  396. #else
  397. #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL)
  398. #endif
  399. #endif
  400. #if CYTHON_USE_PYLONG_INTERNALS
  401. #undef SHIFT
  402. #undef BASE
  403. #undef MASK
  404. #ifdef SIZEOF_VOID_P
  405. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  406. #endif
  407. #endif
  408. #ifndef __has_attribute
  409. #define __has_attribute(x) 0
  410. #endif
  411. #ifndef __has_cpp_attribute
  412. #define __has_cpp_attribute(x) 0
  413. #endif
  414. #ifndef CYTHON_RESTRICT
  415. #if defined(__GNUC__)
  416. #define CYTHON_RESTRICT __restrict__
  417. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  418. #define CYTHON_RESTRICT __restrict
  419. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  420. #define CYTHON_RESTRICT restrict
  421. #else
  422. #define CYTHON_RESTRICT
  423. #endif
  424. #endif
  425. #ifndef CYTHON_UNUSED
  426. #if defined(__cplusplus)
  427. /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
  428. * but leads to warnings with -pedantic, since it is a C++17 feature */
  429. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  430. #if __has_cpp_attribute(maybe_unused)
  431. #define CYTHON_UNUSED [[maybe_unused]]
  432. #endif
  433. #endif
  434. #endif
  435. #endif
  436. #ifndef CYTHON_UNUSED
  437. # if defined(__GNUC__)
  438. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  439. # define CYTHON_UNUSED __attribute__ ((__unused__))
  440. # else
  441. # define CYTHON_UNUSED
  442. # endif
  443. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  444. # define CYTHON_UNUSED __attribute__ ((__unused__))
  445. # else
  446. # define CYTHON_UNUSED
  447. # endif
  448. #endif
  449. #ifndef CYTHON_UNUSED_VAR
  450. # if defined(__cplusplus)
  451. template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
  452. # else
  453. # define CYTHON_UNUSED_VAR(x) (void)(x)
  454. # endif
  455. #endif
  456. #ifndef CYTHON_MAYBE_UNUSED_VAR
  457. #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
  458. #endif
  459. #ifndef CYTHON_NCP_UNUSED
  460. # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  461. # define CYTHON_NCP_UNUSED
  462. # else
  463. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  464. # endif
  465. #endif
  466. #ifndef CYTHON_USE_CPP_STD_MOVE
  467. #if defined(__cplusplus) && (\
  468. __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
  469. #define CYTHON_USE_CPP_STD_MOVE 1
  470. #else
  471. #define CYTHON_USE_CPP_STD_MOVE 0
  472. #endif
  473. #endif
  474. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  475. #include <stdint.h>
  476. typedef uintptr_t __pyx_uintptr_t;
  477. #ifndef CYTHON_FALLTHROUGH
  478. #if defined(__cplusplus)
  479. /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
  480. * but leads to warnings with -pedantic, since it is a C++17 feature */
  481. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  482. #if __has_cpp_attribute(fallthrough)
  483. #define CYTHON_FALLTHROUGH [[fallthrough]]
  484. #endif
  485. #endif
  486. #ifndef CYTHON_FALLTHROUGH
  487. #if __has_cpp_attribute(clang::fallthrough)
  488. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  489. #elif __has_cpp_attribute(gnu::fallthrough)
  490. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  491. #endif
  492. #endif
  493. #endif
  494. #ifndef CYTHON_FALLTHROUGH
  495. #if __has_attribute(fallthrough)
  496. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  497. #else
  498. #define CYTHON_FALLTHROUGH
  499. #endif
  500. #endif
  501. #if defined(__clang__) && defined(__apple_build_version__)
  502. #if __apple_build_version__ < 7000000
  503. #undef CYTHON_FALLTHROUGH
  504. #define CYTHON_FALLTHROUGH
  505. #endif
  506. #endif
  507. #endif
  508. #ifndef Py_UNREACHABLE
  509. #define Py_UNREACHABLE() assert(0); abort()
  510. #endif
  511. #ifdef __cplusplus
  512. template <typename T>
  513. struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  514. #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
  515. #else
  516. #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
  517. #endif
  518. #if CYTHON_COMPILING_IN_PYPY == 1
  519. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000)
  520. #else
  521. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000)
  522. #endif
  523. #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
  524. /* CInitCode */
  525. #ifndef CYTHON_INLINE
  526. #if defined(__clang__)
  527. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  528. #elif defined(__GNUC__)
  529. #define CYTHON_INLINE __inline__
  530. #elif defined(_MSC_VER)
  531. #define CYTHON_INLINE __inline
  532. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  533. #define CYTHON_INLINE inline
  534. #else
  535. #define CYTHON_INLINE
  536. #endif
  537. #endif
  538. /* PythonCompatibility */
  539. #define __PYX_BUILD_PY_SSIZE_T "n"
  540. #define CYTHON_FORMAT_SSIZE_T "z"
  541. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  542. #define __Pyx_DefaultClassType PyType_Type
  543. #if CYTHON_COMPILING_IN_LIMITED_API
  544. #ifndef CO_OPTIMIZED
  545. static int CO_OPTIMIZED;
  546. #endif
  547. #ifndef CO_NEWLOCALS
  548. static int CO_NEWLOCALS;
  549. #endif
  550. #ifndef CO_VARARGS
  551. static int CO_VARARGS;
  552. #endif
  553. #ifndef CO_VARKEYWORDS
  554. static int CO_VARKEYWORDS;
  555. #endif
  556. #ifndef CO_ASYNC_GENERATOR
  557. static int CO_ASYNC_GENERATOR;
  558. #endif
  559. #ifndef CO_GENERATOR
  560. static int CO_GENERATOR;
  561. #endif
  562. #ifndef CO_COROUTINE
  563. static int CO_COROUTINE;
  564. #endif
  565. #else
  566. #ifndef CO_COROUTINE
  567. #define CO_COROUTINE 0x80
  568. #endif
  569. #ifndef CO_ASYNC_GENERATOR
  570. #define CO_ASYNC_GENERATOR 0x200
  571. #endif
  572. #endif
  573. static int __Pyx_init_co_variables(void);
  574. #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  575. #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
  576. #else
  577. #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
  578. #endif
  579. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  580. #define __Pyx_Py_Is(x, y) Py_Is(x, y)
  581. #else
  582. #define __Pyx_Py_Is(x, y) ((x) == (y))
  583. #endif
  584. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  585. #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
  586. #else
  587. #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
  588. #endif
  589. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  590. #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
  591. #else
  592. #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
  593. #endif
  594. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  595. #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
  596. #else
  597. #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
  598. #endif
  599. #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
  600. #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  601. #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
  602. #else
  603. #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
  604. #endif
  605. #ifndef Py_TPFLAGS_CHECKTYPES
  606. #define Py_TPFLAGS_CHECKTYPES 0
  607. #endif
  608. #ifndef Py_TPFLAGS_HAVE_INDEX
  609. #define Py_TPFLAGS_HAVE_INDEX 0
  610. #endif
  611. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  612. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  613. #endif
  614. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  615. #define Py_TPFLAGS_HAVE_FINALIZE 0
  616. #endif
  617. #ifndef Py_TPFLAGS_SEQUENCE
  618. #define Py_TPFLAGS_SEQUENCE 0
  619. #endif
  620. #ifndef Py_TPFLAGS_MAPPING
  621. #define Py_TPFLAGS_MAPPING 0
  622. #endif
  623. #ifndef Py_TPFLAGS_IMMUTABLETYPE
  624. #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
  625. #endif
  626. #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  627. #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
  628. #endif
  629. #ifndef METH_STACKLESS
  630. #define METH_STACKLESS 0
  631. #endif
  632. #ifndef METH_FASTCALL
  633. #ifndef METH_FASTCALL
  634. #define METH_FASTCALL 0x80
  635. #endif
  636. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  637. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  638. Py_ssize_t nargs, PyObject *kwnames);
  639. #else
  640. #if PY_VERSION_HEX >= 0x030d00A4
  641. # define __Pyx_PyCFunctionFast PyCFunctionFast
  642. # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  643. #else
  644. # define __Pyx_PyCFunctionFast _PyCFunctionFast
  645. # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  646. #endif
  647. #endif
  648. #if CYTHON_METH_FASTCALL
  649. #define __Pyx_METH_FASTCALL METH_FASTCALL
  650. #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  651. #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
  652. #else
  653. #define __Pyx_METH_FASTCALL METH_VARARGS
  654. #define __Pyx_PyCFunction_FastCall PyCFunction
  655. #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
  656. #endif
  657. #if CYTHON_VECTORCALL
  658. #define __pyx_vectorcallfunc vectorcallfunc
  659. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
  660. #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
  661. #else
  662. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
  663. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
  664. #endif
  665. #if PY_VERSION_HEX >= 0x030900B1
  666. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
  667. #else
  668. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
  669. #endif
  670. #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
  671. #if CYTHON_COMPILING_IN_CPYTHON
  672. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
  673. #elif !CYTHON_COMPILING_IN_LIMITED_API
  674. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
  675. #endif
  676. #if CYTHON_COMPILING_IN_CPYTHON
  677. #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
  678. static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
  679. return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
  680. }
  681. #endif
  682. static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
  683. #if CYTHON_COMPILING_IN_LIMITED_API
  684. return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  685. #else
  686. return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  687. #endif
  688. }
  689. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
  690. #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  691. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
  692. typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
  693. #else
  694. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
  695. #define __Pyx_PyCMethod PyCMethod
  696. #endif
  697. #ifndef METH_METHOD
  698. #define METH_METHOD 0x200
  699. #endif
  700. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  701. #define PyObject_Malloc(s) PyMem_Malloc(s)
  702. #define PyObject_Free(p) PyMem_Free(p)
  703. #define PyObject_Realloc(p) PyMem_Realloc(p)
  704. #endif
  705. #if CYTHON_COMPILING_IN_LIMITED_API
  706. #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
  707. #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  708. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  709. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
  710. #elif CYTHON_COMPILING_IN_GRAAL
  711. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  712. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
  713. #else
  714. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  715. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  716. #endif
  717. #if CYTHON_COMPILING_IN_LIMITED_API
  718. #define __Pyx_PyThreadState_Current PyThreadState_Get()
  719. #elif !CYTHON_FAST_THREAD_STATE
  720. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  721. #elif PY_VERSION_HEX >= 0x030d00A1
  722. #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
  723. #else
  724. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  725. #endif
  726. #if CYTHON_USE_MODULE_STATE
  727. static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
  728. {
  729. void *result;
  730. result = PyModule_GetState(op);
  731. if (!result)
  732. Py_FatalError("Couldn't find the module state");
  733. return result;
  734. }
  735. #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
  736. #else
  737. #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
  738. #endif
  739. #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
  740. #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
  741. #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
  742. #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
  743. #if CYTHON_USE_TYPE_SLOTS
  744. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
  745. #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  746. #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  747. #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
  748. #else
  749. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
  750. #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
  751. ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
  752. (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
  753. __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  754. #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  755. #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
  756. #endif
  757. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  758. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  759. #else
  760. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  761. #endif
  762. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  763. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  764. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
  765. #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  766. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
  767. PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
  768. if (res == NULL) PyErr_Clear();
  769. return res;
  770. }
  771. #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
  772. #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
  773. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  774. #else
  775. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
  776. #if CYTHON_COMPILING_IN_PYPY
  777. return PyDict_GetItem(dict, name);
  778. #else
  779. PyDictEntry *ep;
  780. PyDictObject *mp = (PyDictObject*) dict;
  781. long hash = ((PyStringObject *) name)->ob_shash;
  782. assert(hash != -1);
  783. ep = (mp->ma_lookup)(mp, name, hash);
  784. if (ep == NULL) {
  785. return NULL;
  786. }
  787. return ep->me_value;
  788. #endif
  789. }
  790. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  791. #endif
  792. #if CYTHON_USE_TYPE_SLOTS
  793. #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
  794. #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
  795. #else
  796. #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
  797. #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
  798. #endif
  799. #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
  800. #if CYTHON_USE_TYPE_SPECS
  801. #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
  802. PyTypeObject *type = Py_TYPE((PyObject*)obj);\
  803. assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
  804. PyObject_GC_Del(obj);\
  805. Py_DECREF(type);\
  806. }
  807. #else
  808. #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
  809. #endif
  810. #if CYTHON_COMPILING_IN_LIMITED_API
  811. #define __Pyx_PyUnicode_READY(op) (0)
  812. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  813. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
  814. #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
  815. #define __Pyx_PyUnicode_DATA(u) ((void*)u)
  816. #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  817. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
  818. #else
  819. #if PY_VERSION_HEX >= 0x030C0000
  820. #define __Pyx_PyUnicode_READY(op) (0)
  821. #else
  822. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  823. 0 : _PyUnicode_Ready((PyObject *)(op)))
  824. #endif
  825. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  826. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  827. #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
  828. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  829. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  830. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  831. #if PY_VERSION_HEX >= 0x030C0000
  832. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
  833. #else
  834. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  835. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  836. #else
  837. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  838. #endif
  839. #endif
  840. #endif
  841. #if CYTHON_COMPILING_IN_PYPY
  842. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  843. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  844. #else
  845. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  846. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  847. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  848. #endif
  849. #if CYTHON_COMPILING_IN_PYPY
  850. #if !defined(PyUnicode_DecodeUnicodeEscape)
  851. #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
  852. #endif
  853. #if !defined(PyUnicode_Contains)
  854. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  855. #endif
  856. #if !defined(PyByteArray_Check)
  857. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  858. #endif
  859. #if !defined(PyObject_Format)
  860. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  861. #endif
  862. #endif
  863. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  864. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  865. #define __Pyx_PySequence_ListKeepNew(obj)\
  866. (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  867. #elif CYTHON_COMPILING_IN_CPYTHON
  868. #define __Pyx_PySequence_ListKeepNew(obj)\
  869. (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  870. #else
  871. #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
  872. #endif
  873. #ifndef PySet_CheckExact
  874. #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
  875. #endif
  876. #if PY_VERSION_HEX >= 0x030900A4
  877. #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  878. #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  879. #else
  880. #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  881. #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  882. #endif
  883. enum __Pyx_ReferenceSharing {
  884. __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  885. __Pyx_ReferenceSharing_OwnStrongReference,
  886. __Pyx_ReferenceSharing_FunctionArgument,
  887. __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
  888. };
  889. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
  890. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
  891. (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
  892. (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
  893. (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
  894. #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
  895. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
  896. #else
  897. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
  898. #endif
  899. #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  900. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  901. #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  902. #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  903. #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  904. #else
  905. #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  906. #endif
  907. #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  908. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  909. #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  910. #else
  911. #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  912. #endif
  913. #else
  914. #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
  915. #endif
  916. #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  917. #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
  918. __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
  919. #else
  920. #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
  921. #endif
  922. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  923. #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
  924. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  925. static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  926. *result = PyObject_GetItem(dict, key);
  927. if (*result == NULL) {
  928. if (PyErr_ExceptionMatches(PyExc_KeyError)) {
  929. PyErr_Clear();
  930. return 0;
  931. }
  932. return -1;
  933. }
  934. return 1;
  935. }
  936. #else
  937. static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  938. *result = PyDict_GetItemWithError(dict, key);
  939. if (*result == NULL) {
  940. return PyErr_Occurred() ? -1 : 0;
  941. }
  942. Py_INCREF(*result);
  943. return 1;
  944. }
  945. #endif
  946. #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  947. #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj)
  948. #else
  949. #define __Pyx_VISIT_CONST(obj)
  950. #endif
  951. #if CYTHON_ASSUME_SAFE_MACROS
  952. #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  953. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  954. #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  955. #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  956. #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  957. #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
  958. #else
  959. #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  960. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  961. #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  962. #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  963. #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  964. #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
  965. #endif
  966. #if CYTHON_ASSUME_SAFE_SIZE
  967. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  968. #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  969. #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  970. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  971. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  972. #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
  973. #else
  974. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  975. #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  976. #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  977. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  978. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  979. #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
  980. #endif
  981. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  982. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  983. #endif
  984. #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
  985. #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t
  986. #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  987. #define __Pyx_PySendResult PySendResult
  988. #else
  989. typedef enum {
  990. PYGEN_RETURN = 0,
  991. PYGEN_ERROR = -1,
  992. PYGEN_NEXT = 1,
  993. } __Pyx_PySendResult;
  994. #endif
  995. #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  996. typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
  997. #else
  998. #define __Pyx_pyiter_sendfunc sendfunc
  999. #endif
  1000. #if !CYTHON_USE_AM_SEND
  1001. #define __PYX_HAS_PY_AM_SEND 0
  1002. #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  1003. #define __PYX_HAS_PY_AM_SEND 1
  1004. #else
  1005. #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation
  1006. #endif
  1007. #if __PYX_HAS_PY_AM_SEND < 2
  1008. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  1009. #else
  1010. typedef struct {
  1011. unaryfunc am_await;
  1012. unaryfunc am_aiter;
  1013. unaryfunc am_anext;
  1014. __Pyx_pyiter_sendfunc am_send;
  1015. } __Pyx_PyAsyncMethodsStruct;
  1016. #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
  1017. #endif
  1018. #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
  1019. #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
  1020. #else
  1021. #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
  1022. #endif
  1023. #if PY_VERSION_HEX >= 0x03090000
  1024. #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
  1025. #else
  1026. #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
  1027. #endif
  1028. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
  1029. #ifdef __cplusplus
  1030. extern "C"
  1031. #endif
  1032. PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
  1033. #endif
  1034. #if CYTHON_COMPILING_IN_LIMITED_API
  1035. static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
  1036. int value;
  1037. PyObject *py_value = PyObject_GetAttrString(inspect, name);
  1038. if (!py_value) return 0;
  1039. value = (int) PyLong_AsLong(py_value);
  1040. Py_DECREF(py_value);
  1041. *write_to = value;
  1042. return value != -1 || !PyErr_Occurred();
  1043. }
  1044. static int __Pyx_init_co_variables(void) {
  1045. PyObject *inspect;
  1046. int result;
  1047. inspect = PyImport_ImportModule("inspect");
  1048. result =
  1049. #if !defined(CO_OPTIMIZED)
  1050. __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
  1051. #endif
  1052. #if !defined(CO_NEWLOCALS)
  1053. __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
  1054. #endif
  1055. #if !defined(CO_VARARGS)
  1056. __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
  1057. #endif
  1058. #if !defined(CO_VARKEYWORDS)
  1059. __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
  1060. #endif
  1061. #if !defined(CO_ASYNC_GENERATOR)
  1062. __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
  1063. #endif
  1064. #if !defined(CO_GENERATOR)
  1065. __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
  1066. #endif
  1067. #if !defined(CO_COROUTINE)
  1068. __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
  1069. #endif
  1070. 1;
  1071. Py_DECREF(inspect);
  1072. return result ? 0 : -1;
  1073. }
  1074. #else
  1075. static int __Pyx_init_co_variables(void) {
  1076. return 0; // It's a limited API-only feature
  1077. }
  1078. #endif
  1079. /* MathInitCode */
  1080. #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  1081. #ifndef _USE_MATH_DEFINES
  1082. #define _USE_MATH_DEFINES
  1083. #endif
  1084. #endif
  1085. #include <math.h>
  1086. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  1087. #define __Pyx_truncl trunc
  1088. #else
  1089. #define __Pyx_truncl truncl
  1090. #endif
  1091. #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  1092. #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
  1093. #endif
  1094. #ifndef CYTHON_CLINE_IN_TRACEBACK
  1095. #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  1096. #endif
  1097. #if CYTHON_CLINE_IN_TRACEBACK
  1098. #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
  1099. #else
  1100. #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
  1101. #endif
  1102. #define __PYX_ERR(f_index, lineno, Ln_error) \
  1103. { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  1104. #ifdef CYTHON_EXTERN_C
  1105. #undef __PYX_EXTERN_C
  1106. #define __PYX_EXTERN_C CYTHON_EXTERN_C
  1107. #elif defined(__PYX_EXTERN_C)
  1108. #ifdef _MSC_VER
  1109. #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
  1110. #else
  1111. #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
  1112. #endif
  1113. #else
  1114. #ifdef __cplusplus
  1115. #define __PYX_EXTERN_C extern "C"
  1116. #else
  1117. #define __PYX_EXTERN_C extern
  1118. #endif
  1119. #endif
  1120. #define __PYX_HAVE__fontTools__varLib__iup
  1121. #define __PYX_HAVE_API__fontTools__varLib__iup
  1122. /* Early includes */
  1123. #ifdef _OPENMP
  1124. #include <omp.h>
  1125. #endif /* _OPENMP */
  1126. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  1127. #define CYTHON_WITHOUT_ASSERTIONS
  1128. #endif
  1129. #ifdef CYTHON_FREETHREADING_COMPATIBLE
  1130. #if CYTHON_FREETHREADING_COMPATIBLE
  1131. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
  1132. #else
  1133. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
  1134. #endif
  1135. #else
  1136. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
  1137. #endif
  1138. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1139. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1140. #define __PYX_DEFAULT_STRING_ENCODING ""
  1141. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1142. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1143. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1144. #define __Pyx_long_cast(x) ((long)x)
  1145. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1146. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1147. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1148. likely(v < (type)PY_SSIZE_T_MAX ||\
  1149. v == (type)PY_SSIZE_T_MAX) &&\
  1150. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1151. v == (type)PY_SSIZE_T_MIN))) ||\
  1152. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1153. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1154. v == (type)PY_SSIZE_T_MAX))) )
  1155. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1156. return (size_t) i < (size_t) limit;
  1157. }
  1158. #if defined (__cplusplus) && __cplusplus >= 201103L
  1159. #include <cstdlib>
  1160. #define __Pyx_sst_abs(value) std::abs(value)
  1161. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1162. #define __Pyx_sst_abs(value) abs(value)
  1163. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1164. #define __Pyx_sst_abs(value) labs(value)
  1165. #elif defined (_MSC_VER)
  1166. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1167. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1168. #define __Pyx_sst_abs(value) llabs(value)
  1169. #elif defined (__GNUC__)
  1170. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1171. #else
  1172. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1173. #endif
  1174. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1175. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1176. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1177. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1178. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1179. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1180. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1181. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1182. #if CYTHON_ASSUME_SAFE_MACROS
  1183. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1184. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1185. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1186. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1187. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1188. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1189. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
  1190. #else
  1191. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
  1192. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
  1193. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
  1194. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
  1195. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
  1196. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
  1197. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
  1198. #endif
  1199. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1200. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1201. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1202. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1203. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1204. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1205. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1206. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1207. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1208. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1209. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1210. static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
  1211. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
  1212. return Py_NewRef(obj);
  1213. #else
  1214. Py_INCREF(obj);
  1215. return obj;
  1216. #endif
  1217. }
  1218. static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
  1219. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
  1220. return Py_XNewRef(obj);
  1221. #else
  1222. Py_XINCREF(obj);
  1223. return obj;
  1224. #endif
  1225. }
  1226. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
  1227. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1228. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1229. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1230. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
  1231. #define __Pyx_PySequence_Tuple(obj)\
  1232. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1233. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1234. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
  1235. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1236. #if CYTHON_ASSUME_SAFE_MACROS
  1237. #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1238. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
  1239. #else
  1240. #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1241. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
  1242. #endif
  1243. #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
  1244. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1245. #if CYTHON_USE_PYLONG_INTERNALS
  1246. #if PY_VERSION_HEX >= 0x030C00A7
  1247. #ifndef _PyLong_SIGN_MASK
  1248. #define _PyLong_SIGN_MASK 3
  1249. #endif
  1250. #ifndef _PyLong_NON_SIZE_BITS
  1251. #define _PyLong_NON_SIZE_BITS 3
  1252. #endif
  1253. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1254. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1255. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1256. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1257. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1258. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1259. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1260. #define __Pyx_PyLong_SignedDigitCount(x)\
  1261. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1262. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1263. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1264. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1265. #else
  1266. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1267. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1268. #endif
  1269. typedef Py_ssize_t __Pyx_compact_pylong;
  1270. typedef size_t __Pyx_compact_upylong;
  1271. #else
  1272. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1273. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1274. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1275. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1276. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1277. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1278. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1279. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1280. #define __Pyx_PyLong_CompactValue(x)\
  1281. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1282. typedef sdigit __Pyx_compact_pylong;
  1283. typedef digit __Pyx_compact_upylong;
  1284. #endif
  1285. #if PY_VERSION_HEX >= 0x030C00A5
  1286. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1287. #else
  1288. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1289. #endif
  1290. #endif
  1291. #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  1292. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1293. #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1294. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
  1295. #else
  1296. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1297. #endif
  1298. /* Test for GCC > 2.95 */
  1299. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1300. #define likely(x) __builtin_expect(!!(x), 1)
  1301. #define unlikely(x) __builtin_expect(!!(x), 0)
  1302. #else /* !__GNUC__ or GCC < 2.95 */
  1303. #define likely(x) (x)
  1304. #define unlikely(x) (x)
  1305. #endif /* __GNUC__ */
  1306. /* PretendToInitialize */
  1307. #ifdef __cplusplus
  1308. #if __cplusplus > 201103L
  1309. #include <type_traits>
  1310. #endif
  1311. template <typename T>
  1312. static void __Pyx_pretend_to_initialize(T* ptr) {
  1313. #if __cplusplus > 201103L
  1314. if ((std::is_trivially_default_constructible<T>::value))
  1315. #endif
  1316. *ptr = T();
  1317. (void)ptr;
  1318. }
  1319. #else
  1320. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1321. #endif
  1322. #if !CYTHON_USE_MODULE_STATE
  1323. static PyObject *__pyx_m = NULL;
  1324. #endif
  1325. static int __pyx_lineno;
  1326. static int __pyx_clineno = 0;
  1327. static const char * const __pyx_cfilenm = __FILE__;
  1328. static const char *__pyx_filename;
  1329. /* #### Code section: filename_table ### */
  1330. static const char* const __pyx_f[] = {
  1331. "Lib/fontTools/varLib/iup.py",
  1332. };
  1333. /* #### Code section: utility_code_proto_before_types ### */
  1334. /* Atomics.proto (used by UnpackUnboundCMethod) */
  1335. #include <pythread.h>
  1336. #ifndef CYTHON_ATOMICS
  1337. #define CYTHON_ATOMICS 1
  1338. #endif
  1339. #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
  1340. #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1341. #define __pyx_atomic_int_type int
  1342. #define __pyx_nonatomic_int_type int
  1343. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1344. (__STDC_VERSION__ >= 201112L) &&\
  1345. !defined(__STDC_NO_ATOMICS__))
  1346. #include <stdatomic.h>
  1347. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1348. (__cplusplus >= 201103L) ||\
  1349. (defined(_MSC_VER) && _MSC_VER >= 1700)))
  1350. #include <atomic>
  1351. #endif
  1352. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1353. (__STDC_VERSION__ >= 201112L) &&\
  1354. !defined(__STDC_NO_ATOMICS__) &&\
  1355. ATOMIC_INT_LOCK_FREE == 2)
  1356. #undef __pyx_atomic_int_type
  1357. #define __pyx_atomic_int_type atomic_int
  1358. #define __pyx_atomic_ptr_type atomic_uintptr_t
  1359. #define __pyx_nonatomic_ptr_type uintptr_t
  1360. #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
  1361. #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
  1362. #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
  1363. #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
  1364. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1365. #define __pyx_atomic_load(value) atomic_load(value)
  1366. #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
  1367. #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
  1368. #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
  1369. #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1370. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1371. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1372. #pragma message ("Using standard C atomics")
  1373. #elif defined(__PYX_DEBUG_ATOMICS)
  1374. #warning "Using standard C atomics"
  1375. #endif
  1376. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1377. (__cplusplus >= 201103L) ||\
  1378. \
  1379. (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
  1380. ATOMIC_INT_LOCK_FREE == 2)
  1381. #undef __pyx_atomic_int_type
  1382. #define __pyx_atomic_int_type std::atomic_int
  1383. #define __pyx_atomic_ptr_type std::atomic_uintptr_t
  1384. #define __pyx_nonatomic_ptr_type uintptr_t
  1385. #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
  1386. #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
  1387. #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
  1388. #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
  1389. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1390. #define __pyx_atomic_load(value) std::atomic_load(value)
  1391. #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
  1392. #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
  1393. #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
  1394. #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1395. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1396. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1397. #pragma message ("Using standard C++ atomics")
  1398. #elif defined(__PYX_DEBUG_ATOMICS)
  1399. #warning "Using standard C++ atomics"
  1400. #endif
  1401. #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
  1402. (__GNUC_MINOR__ > 1 ||\
  1403. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
  1404. #define __pyx_atomic_ptr_type void*
  1405. #define __pyx_nonatomic_ptr_type void*
  1406. #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
  1407. #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
  1408. #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
  1409. #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
  1410. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1411. __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1412. int result = old == *expected;
  1413. *expected = old;
  1414. return result;
  1415. }
  1416. #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
  1417. #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
  1418. #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
  1419. #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
  1420. #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
  1421. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1422. __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1423. int result = old == *expected;
  1424. *expected = old;
  1425. return result;
  1426. }
  1427. #ifdef __PYX_DEBUG_ATOMICS
  1428. #warning "Using GNU atomics"
  1429. #endif
  1430. #elif CYTHON_ATOMICS && defined(_MSC_VER)
  1431. #include <intrin.h>
  1432. #undef __pyx_atomic_int_type
  1433. #define __pyx_atomic_int_type long
  1434. #define __pyx_atomic_ptr_type void*
  1435. #undef __pyx_nonatomic_int_type
  1436. #define __pyx_nonatomic_int_type long
  1437. #define __pyx_nonatomic_ptr_type void*
  1438. #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
  1439. #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
  1440. #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
  1441. #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
  1442. #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
  1443. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1444. __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
  1445. int result = old == *expected;
  1446. *expected = old;
  1447. return result;
  1448. }
  1449. #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
  1450. #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
  1451. #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
  1452. #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
  1453. #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
  1454. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1455. __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
  1456. int result = old == *expected;
  1457. *expected = old;
  1458. return result;
  1459. }
  1460. #ifdef __PYX_DEBUG_ATOMICS
  1461. #pragma message ("Using MSVC atomics")
  1462. #endif
  1463. #else
  1464. #undef CYTHON_ATOMICS
  1465. #define CYTHON_ATOMICS 0
  1466. #ifdef __PYX_DEBUG_ATOMICS
  1467. #warning "Not using atomics"
  1468. #endif
  1469. #endif
  1470. /* CriticalSectionsDefinition.proto (used by CriticalSections) */
  1471. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1472. #define __Pyx_PyCriticalSection void*
  1473. #define __Pyx_PyCriticalSection2 void*
  1474. #define __Pyx_PyCriticalSection_End(cs)
  1475. #define __Pyx_PyCriticalSection2_End(cs)
  1476. #else
  1477. #define __Pyx_PyCriticalSection PyCriticalSection
  1478. #define __Pyx_PyCriticalSection2 PyCriticalSection2
  1479. #define __Pyx_PyCriticalSection_End PyCriticalSection_End
  1480. #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
  1481. #endif
  1482. /* CriticalSections.proto (used by ParseKeywordsImpl) */
  1483. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1484. #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
  1485. #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
  1486. #else
  1487. #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
  1488. #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
  1489. #endif
  1490. #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1491. #define __Pyx_BEGIN_CRITICAL_SECTION(o) {
  1492. #define __Pyx_END_CRITICAL_SECTION() }
  1493. #else
  1494. #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
  1495. #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
  1496. #endif
  1497. /* IncludeStructmemberH.proto (used by FixUpExtensionType) */
  1498. #include <structmember.h>
  1499. /* #### Code section: numeric_typedefs ### */
  1500. /* #### Code section: complex_type_declarations ### */
  1501. /* #### Code section: type_declarations ### */
  1502. /*--- Type declarations ---*/
  1503. struct __pyx_defaults;
  1504. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  1505. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  1506. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  1507. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  1508. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  1509. /* "fontTools/varLib/iup.py":293
  1510. *
  1511. *
  1512. * @cython.locals( # <<<<<<<<<<<<<<
  1513. * i=cython.int,
  1514. * j=cython.int,
  1515. */
  1516. struct __pyx_defaults {
  1517. PyObject_HEAD
  1518. PyObject *arg0;
  1519. };
  1520. /* "fontTools/varLib/iup.py":169
  1521. *
  1522. *
  1523. * @cython.cfunc # <<<<<<<<<<<<<<
  1524. * @cython.inline
  1525. * @cython.locals(
  1526. */
  1527. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between {
  1528. PyObject_HEAD
  1529. PyObject *__pyx_v_tolerance;
  1530. };
  1531. /* "fontTools/varLib/iup.py":197
  1532. *
  1533. * return all(
  1534. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  1535. * for (x, y), (p, q) in zip(deltas, interp)
  1536. * )
  1537. */
  1538. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr {
  1539. PyObject_HEAD
  1540. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_outer_scope;
  1541. PyObject *__pyx_genexpr_arg_0;
  1542. int __pyx_v_i;
  1543. int __pyx_v_j;
  1544. double __pyx_v_p;
  1545. double __pyx_v_q;
  1546. double __pyx_v_x;
  1547. double __pyx_v_y;
  1548. };
  1549. /* "fontTools/varLib/iup.py":363
  1550. *
  1551. *
  1552. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  1553. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  1554. * ) -> _DeltaOrNoneSegment:
  1555. */
  1556. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize {
  1557. PyObject_HEAD
  1558. PyObject *__pyx_v_d0;
  1559. PyObject *__pyx_v_tolerance;
  1560. };
  1561. /* "fontTools/varLib/iup.py":378
  1562. *
  1563. * # If all are within tolerance distance of 0, encode nothing:
  1564. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  1565. * return [None] * n
  1566. *
  1567. */
  1568. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr {
  1569. PyObject_HEAD
  1570. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1571. PyObject *__pyx_genexpr_arg_0;
  1572. PyObject *__pyx_v_p;
  1573. };
  1574. /* "fontTools/varLib/iup.py":387
  1575. * # If all deltas are exactly the same, return just one (the first one):
  1576. * d0 = deltas[0]
  1577. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  1578. * return [d0] + [None] * (n - 1)
  1579. *
  1580. */
  1581. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr {
  1582. PyObject_HEAD
  1583. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1584. PyObject *__pyx_genexpr_arg_0;
  1585. PyObject *__pyx_v_d;
  1586. };
  1587. /* #### Code section: utility_code_proto ### */
  1588. /* --- Runtime support code (head) --- */
  1589. /* Refnanny.proto */
  1590. #ifndef CYTHON_REFNANNY
  1591. #define CYTHON_REFNANNY 0
  1592. #endif
  1593. #if CYTHON_REFNANNY
  1594. typedef struct {
  1595. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1596. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1597. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1598. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1599. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1600. void (*FinishContext)(void**);
  1601. } __Pyx_RefNannyAPIStruct;
  1602. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1603. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1604. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1605. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1606. if (acquire_gil) {\
  1607. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1608. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1609. PyGILState_Release(__pyx_gilstate_save);\
  1610. } else {\
  1611. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1612. }
  1613. #define __Pyx_RefNannyFinishContextNogil() {\
  1614. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1615. __Pyx_RefNannyFinishContext();\
  1616. PyGILState_Release(__pyx_gilstate_save);\
  1617. }
  1618. #define __Pyx_RefNannyFinishContextNogil() {\
  1619. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1620. __Pyx_RefNannyFinishContext();\
  1621. PyGILState_Release(__pyx_gilstate_save);\
  1622. }
  1623. #define __Pyx_RefNannyFinishContext()\
  1624. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1625. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1626. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1627. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1628. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1629. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1630. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1631. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1632. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1633. #else
  1634. #define __Pyx_RefNannyDeclarations
  1635. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1636. #define __Pyx_RefNannyFinishContextNogil()
  1637. #define __Pyx_RefNannyFinishContext()
  1638. #define __Pyx_INCREF(r) Py_INCREF(r)
  1639. #define __Pyx_DECREF(r) Py_DECREF(r)
  1640. #define __Pyx_GOTREF(r)
  1641. #define __Pyx_GIVEREF(r)
  1642. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1643. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1644. #define __Pyx_XGOTREF(r)
  1645. #define __Pyx_XGIVEREF(r)
  1646. #endif
  1647. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1648. PyObject *tmp = (PyObject *) r;\
  1649. r = v; Py_XDECREF(tmp);\
  1650. } while (0)
  1651. #define __Pyx_XDECREF_SET(r, v) do {\
  1652. PyObject *tmp = (PyObject *) r;\
  1653. r = v; __Pyx_XDECREF(tmp);\
  1654. } while (0)
  1655. #define __Pyx_DECREF_SET(r, v) do {\
  1656. PyObject *tmp = (PyObject *) r;\
  1657. r = v; __Pyx_DECREF(tmp);\
  1658. } while (0)
  1659. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1660. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1661. /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
  1662. #if CYTHON_FAST_THREAD_STATE
  1663. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1664. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1665. #else
  1666. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1667. #endif
  1668. /* PyThreadStateGet.proto (used by PyErrFetchRestore) */
  1669. #if CYTHON_FAST_THREAD_STATE
  1670. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1671. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1672. #if PY_VERSION_HEX >= 0x030C00A6
  1673. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1674. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1675. #else
  1676. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1677. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1678. #endif
  1679. #else
  1680. #define __Pyx_PyThreadState_declare
  1681. #define __Pyx_PyThreadState_assign
  1682. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1683. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1684. #endif
  1685. /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
  1686. #if CYTHON_FAST_THREAD_STATE
  1687. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1688. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1689. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1690. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1691. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1692. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1693. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1694. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1695. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1696. #else
  1697. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1698. #endif
  1699. #else
  1700. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1701. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1702. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1703. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1704. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1705. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1706. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1707. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1708. #endif
  1709. /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
  1710. #if CYTHON_USE_TYPE_SLOTS
  1711. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1712. #else
  1713. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1714. #endif
  1715. /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
  1716. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1717. /* GetBuiltinName.proto */
  1718. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1719. /* SetItemInt.proto */
  1720. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1721. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1722. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
  1723. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  1724. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  1725. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  1726. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  1727. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  1728. /* GetItemInt.proto */
  1729. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1730. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1731. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
  1732. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1733. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1734. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1735. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1736. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  1737. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1738. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1739. int wraparound, int boundscheck, int unsafe_shared);
  1740. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1741. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1742. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  1743. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1744. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1745. int wraparound, int boundscheck, int unsafe_shared);
  1746. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1747. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1748. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  1749. /* ListExtend.proto */
  1750. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1751. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2
  1752. return PyList_Extend(L, v);
  1753. #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  1754. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1755. if (unlikely(!none))
  1756. return -1;
  1757. Py_DECREF(none);
  1758. return 0;
  1759. #else
  1760. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1761. #endif
  1762. }
  1763. /* ListAppend.proto */
  1764. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1765. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1766. PyListObject* L = (PyListObject*) list;
  1767. Py_ssize_t len = Py_SIZE(list);
  1768. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1769. Py_INCREF(x);
  1770. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1771. L->ob_item[len] = x;
  1772. #else
  1773. PyList_SET_ITEM(list, len, x);
  1774. #endif
  1775. __Pyx_SET_SIZE(list, len + 1);
  1776. return 0;
  1777. }
  1778. return PyList_Append(list, x);
  1779. }
  1780. #else
  1781. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1782. #endif
  1783. /* PyObjectCall.proto */
  1784. #if CYTHON_COMPILING_IN_CPYTHON
  1785. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1786. #else
  1787. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1788. #endif
  1789. /* TupleAndListFromArray.proto (used by fastcall) */
  1790. #if CYTHON_COMPILING_IN_CPYTHON
  1791. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1792. #endif
  1793. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
  1794. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1795. #endif
  1796. /* IncludeStringH.proto (used by BytesEquals) */
  1797. #include <string.h>
  1798. /* BytesEquals.proto (used by UnicodeEquals) */
  1799. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1800. /* UnicodeEquals.proto (used by fastcall) */
  1801. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1802. /* fastcall.proto */
  1803. #if CYTHON_AVOID_BORROWED_REFS
  1804. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
  1805. #elif CYTHON_ASSUME_SAFE_MACROS
  1806. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
  1807. #else
  1808. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
  1809. #endif
  1810. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1811. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1812. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1813. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1814. #if CYTHON_METH_FASTCALL
  1815. #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
  1816. #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
  1817. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1818. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1819. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1820. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1821. #else
  1822. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1823. #endif
  1824. #else
  1825. #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
  1826. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1827. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1828. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1829. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1830. #endif
  1831. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1832. #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  1833. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
  1834. #else
  1835. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1836. #endif
  1837. /* py_dict_items.proto (used by OwnedDictNext) */
  1838. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
  1839. /* CallCFunction.proto (used by CallUnboundCMethod0) */
  1840. #define __Pyx_CallCFunction(cfunc, self, args)\
  1841. ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
  1842. #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
  1843. ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
  1844. #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
  1845. ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
  1846. #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
  1847. ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)
  1848. /* PyObjectCallMethO.proto (used by PyObjectFastCall) */
  1849. #if CYTHON_COMPILING_IN_CPYTHON
  1850. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1851. #endif
  1852. /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
  1853. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1854. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);
  1855. /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
  1856. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1857. /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
  1858. typedef struct {
  1859. PyObject *type;
  1860. PyObject **method_name;
  1861. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
  1862. __pyx_atomic_int_type initialized;
  1863. #endif
  1864. PyCFunction func;
  1865. PyObject *method;
  1866. int flag;
  1867. } __Pyx_CachedCFunction;
  1868. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1869. static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
  1870. #if !CYTHON_ATOMICS
  1871. return 1;
  1872. #else
  1873. __pyx_nonatomic_int_type expected = 0;
  1874. if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
  1875. return 0;
  1876. }
  1877. return expected;
  1878. #endif
  1879. }
  1880. static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
  1881. #if CYTHON_ATOMICS
  1882. __pyx_atomic_store(&cfunc->initialized, 2);
  1883. #endif
  1884. }
  1885. #else
  1886. #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
  1887. #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
  1888. #endif
  1889. /* CallUnboundCMethod0.proto */
  1890. CYTHON_UNUSED
  1891. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1892. #if CYTHON_COMPILING_IN_CPYTHON
  1893. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1894. #else
  1895. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  1896. #endif
  1897. /* py_dict_values.proto (used by OwnedDictNext) */
  1898. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);
  1899. /* OwnedDictNext.proto (used by ParseKeywordsImpl) */
  1900. #if CYTHON_AVOID_BORROWED_REFS
  1901. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
  1902. #else
  1903. CYTHON_INLINE
  1904. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
  1905. #endif
  1906. /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
  1907. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1908. /* ParseKeywordsImpl.export */
  1909. static int __Pyx_ParseKeywordsTuple(
  1910. PyObject *kwds,
  1911. PyObject * const *kwvalues,
  1912. PyObject ** const argnames[],
  1913. PyObject *kwds2,
  1914. PyObject *values[],
  1915. Py_ssize_t num_pos_args,
  1916. Py_ssize_t num_kwargs,
  1917. const char* function_name,
  1918. int ignore_unknown_kwargs
  1919. );
  1920. static int __Pyx_ParseKeywordDictToDict(
  1921. PyObject *kwds,
  1922. PyObject ** const argnames[],
  1923. PyObject *kwds2,
  1924. PyObject *values[],
  1925. Py_ssize_t num_pos_args,
  1926. const char* function_name
  1927. );
  1928. static int __Pyx_ParseKeywordDict(
  1929. PyObject *kwds,
  1930. PyObject ** const argnames[],
  1931. PyObject *values[],
  1932. Py_ssize_t num_pos_args,
  1933. Py_ssize_t num_kwargs,
  1934. const char* function_name,
  1935. int ignore_unknown_kwargs
  1936. );
  1937. /* CallUnboundCMethod2.proto */
  1938. CYTHON_UNUSED
  1939. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
  1940. #if CYTHON_COMPILING_IN_CPYTHON
  1941. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
  1942. #else
  1943. #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
  1944. #endif
  1945. /* ParseKeywords.proto */
  1946. static CYTHON_INLINE int __Pyx_ParseKeywords(
  1947. PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
  1948. PyObject *kwds2, PyObject *values[],
  1949. Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
  1950. const char* function_name,
  1951. int ignore_unknown_kwargs
  1952. );
  1953. /* RaiseArgTupleInvalid.proto */
  1954. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1955. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1956. /* AssertionsEnabled.proto */
  1957. #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000
  1958. static int __pyx_assertions_enabled_flag;
  1959. #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  1960. #if __clang__ || __GNUC__
  1961. __attribute__((no_sanitize("thread")))
  1962. #endif
  1963. static int __Pyx_init_assertions_enabled(void) {
  1964. PyObject *builtins, *debug, *debug_str;
  1965. int flag;
  1966. builtins = PyEval_GetBuiltins();
  1967. if (!builtins) goto bad;
  1968. debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
  1969. if (!debug_str) goto bad;
  1970. debug = PyObject_GetItem(builtins, debug_str);
  1971. Py_DECREF(debug_str);
  1972. if (!debug) goto bad;
  1973. flag = PyObject_IsTrue(debug);
  1974. Py_DECREF(debug);
  1975. if (flag == -1) goto bad;
  1976. __pyx_assertions_enabled_flag = flag;
  1977. return 0;
  1978. bad:
  1979. __pyx_assertions_enabled_flag = 1;
  1980. return -1;
  1981. }
  1982. #else
  1983. #define __Pyx_init_assertions_enabled() (0)
  1984. #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
  1985. #endif
  1986. /* PyAssertionError_Check.proto */
  1987. #define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError)
  1988. /* RaiseException.export */
  1989. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1990. /* PySequenceContains.proto */
  1991. static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
  1992. int result = PySequence_Contains(seq, item);
  1993. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  1994. }
  1995. /* PyLongBinop.proto */
  1996. #if !CYTHON_COMPILING_IN_PYPY
  1997. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1998. #else
  1999. #define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  2000. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  2001. #endif
  2002. /* ListCompAppend.proto */
  2003. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2004. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  2005. PyListObject* L = (PyListObject*) list;
  2006. Py_ssize_t len = Py_SIZE(list);
  2007. if (likely(L->allocated > len)) {
  2008. Py_INCREF(x);
  2009. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2010. L->ob_item[len] = x;
  2011. #else
  2012. PyList_SET_ITEM(list, len, x);
  2013. #endif
  2014. __Pyx_SET_SIZE(list, len + 1);
  2015. return 0;
  2016. }
  2017. return PyList_Append(list, x);
  2018. }
  2019. #else
  2020. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  2021. #endif
  2022. /* IterNextPlain.proto (used by IterNext) */
  2023. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
  2024. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2025. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
  2026. #endif
  2027. /* IterNext.proto */
  2028. #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
  2029. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
  2030. /* PyLongCompare.proto */
  2031. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2032. /* SliceObject.proto */
  2033. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  2034. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  2035. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  2036. int has_cstart, int has_cstop, int wraparound);
  2037. /* ObjectGetItem.proto */
  2038. #if CYTHON_USE_TYPE_SLOTS
  2039. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  2040. #else
  2041. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  2042. #endif
  2043. /* PyLongBinop.proto */
  2044. #if !CYTHON_COMPILING_IN_PYPY
  2045. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2046. #else
  2047. #define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
  2048. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  2049. #endif
  2050. /* PyDictVersioning.proto (used by GetModuleGlobalName) */
  2051. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  2052. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  2053. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  2054. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  2055. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  2056. (cache_var) = (value);
  2057. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  2058. static PY_UINT64_T __pyx_dict_version = 0;\
  2059. static PyObject *__pyx_dict_cached_value = NULL;\
  2060. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  2061. (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
  2062. } else {\
  2063. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  2064. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  2065. }\
  2066. }
  2067. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  2068. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  2069. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  2070. #else
  2071. #define __PYX_GET_DICT_VERSION(dict) (0)
  2072. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  2073. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  2074. #endif
  2075. /* GetModuleGlobalName.proto */
  2076. #if CYTHON_USE_DICT_VERSIONS
  2077. #define __Pyx_GetModuleGlobalName(var, name) do {\
  2078. static PY_UINT64_T __pyx_dict_version = 0;\
  2079. static PyObject *__pyx_dict_cached_value = NULL;\
  2080. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
  2081. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  2082. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2083. } while(0)
  2084. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  2085. PY_UINT64_T __pyx_dict_version;\
  2086. PyObject *__pyx_dict_cached_value;\
  2087. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2088. } while(0)
  2089. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  2090. #else
  2091. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2092. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2093. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  2094. #endif
  2095. /* RaiseUnboundLocalError.proto */
  2096. static void __Pyx_RaiseUnboundLocalError(const char *varname);
  2097. /* RaiseTooManyValuesToUnpack.proto */
  2098. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  2099. /* RaiseNeedMoreValuesToUnpack.proto */
  2100. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  2101. /* IterFinish.proto */
  2102. static CYTHON_INLINE int __Pyx_IterFinish(void);
  2103. /* UnpackItemEndCheck.proto */
  2104. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  2105. /* py_abs.proto */
  2106. #if CYTHON_USE_PYLONG_INTERNALS
  2107. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  2108. #define __Pyx_PyNumber_Absolute(x)\
  2109. ((likely(PyLong_CheckExact(x))) ?\
  2110. (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
  2111. PyNumber_Absolute(x))
  2112. #else
  2113. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  2114. #endif
  2115. /* RaiseClosureNameError.proto */
  2116. static void __Pyx_RaiseClosureNameError(const char *varname);
  2117. /* GetException.proto (used by pep479) */
  2118. #if CYTHON_FAST_THREAD_STATE
  2119. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  2120. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2121. #else
  2122. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  2123. #endif
  2124. /* pep479.proto */
  2125. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  2126. /* PyRange_Check.proto */
  2127. #if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  2128. #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type)
  2129. #endif
  2130. /* IncludeStdlibH.proto */
  2131. #include <stdlib.h>
  2132. /* ArgTypeTestFunc.export */
  2133. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  2134. /* ArgTypeTest.proto */
  2135. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  2136. ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  2137. __Pyx__ArgTypeTest(obj, type, name, exact))
  2138. /* DictGetItem.proto */
  2139. #if !CYTHON_COMPILING_IN_PYPY
  2140. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  2141. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  2142. (likely(PyDict_CheckExact(obj)) ?\
  2143. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  2144. #else
  2145. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  2146. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  2147. #endif
  2148. /* PyObjectCallNoArg.proto (used by pyfrozenset_new) */
  2149. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  2150. /* pyfrozenset_new.proto (used by PySetContains) */
  2151. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2152. /* PySetContains.proto */
  2153. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2154. /* pyint_simplify.proto */
  2155. static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);
  2156. /* SliceTupleAndList.proto */
  2157. #if CYTHON_COMPILING_IN_CPYTHON
  2158. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2159. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2160. #else
  2161. #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2162. #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2163. #endif
  2164. /* set_iter.proto */
  2165. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  2166. Py_ssize_t* p_orig_length, int* p_source_is_set);
  2167. static CYTHON_INLINE int __Pyx_set_iter_next(
  2168. PyObject* iter_obj, Py_ssize_t orig_length,
  2169. Py_ssize_t* ppos, PyObject **value,
  2170. int source_is_set);
  2171. /* PyLongCompare.proto */
  2172. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2173. /* py_set_remove.proto */
  2174. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key);
  2175. /* AllocateExtensionType.proto */
  2176. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);
  2177. /* CallTypeTraverse.proto */
  2178. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  2179. #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
  2180. #else
  2181. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
  2182. #endif
  2183. /* CheckTypeForFreelists.proto */
  2184. #if CYTHON_USE_FREELISTS
  2185. #if CYTHON_USE_TYPE_SPECS
  2186. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
  2187. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT
  2188. #else
  2189. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
  2190. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
  2191. #endif
  2192. #define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
  2193. (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
  2194. (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
  2195. #endif
  2196. /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
  2197. #if CYTHON_COMPILING_IN_LIMITED_API
  2198. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
  2199. #endif
  2200. /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
  2201. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
  2202. #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)
  2203. /* FixUpExtensionType.proto */
  2204. static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2205. /* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
  2206. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  2207. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2208. #endif
  2209. /* PyObjectCallMethod0.proto (used by PyType_Ready) */
  2210. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2211. /* ValidateBasesTuple.proto (used by PyType_Ready) */
  2212. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2213. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2214. #endif
  2215. /* PyType_Ready.proto */
  2216. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2217. /* HasAttr.proto (used by ImportImpl) */
  2218. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2219. #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
  2220. #else
  2221. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  2222. #endif
  2223. /* ImportImpl.export */
  2224. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);
  2225. /* Import.proto */
  2226. static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);
  2227. /* ImportFrom.proto */
  2228. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2229. /* dict_setdefault.proto (used by FetchCommonType) */
  2230. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);
  2231. /* AddModuleRef.proto (used by FetchSharedCythonModule) */
  2232. #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
  2233. __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  2234. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
  2235. #else
  2236. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  2237. #endif
  2238. /* FetchSharedCythonModule.proto (used by FetchCommonType) */
  2239. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2240. /* FetchCommonType.proto (used by CommonTypesMetaclass) */
  2241. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);
  2242. /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
  2243. static int __pyx_CommonTypesMetaclass_init(PyObject *module);
  2244. #define __Pyx_CommonTypesMetaclass_USED
  2245. /* PyMethodNew.proto (used by CythonFunctionShared) */
  2246. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);
  2247. /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
  2248. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  2249. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2250. #endif
  2251. /* CythonFunctionShared.proto (used by CythonFunction) */
  2252. #define __Pyx_CyFunction_USED
  2253. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2254. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2255. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2256. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2257. #define __Pyx_CyFunction_GetClosure(f)\
  2258. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2259. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2260. #define __Pyx_CyFunction_GetClassObj(f)\
  2261. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2262. #else
  2263. #define __Pyx_CyFunction_GetClassObj(f)\
  2264. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2265. #endif
  2266. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2267. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2268. #define __Pyx_CyFunction_Defaults(type, f)\
  2269. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2270. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2271. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2272. typedef struct {
  2273. #if CYTHON_COMPILING_IN_LIMITED_API
  2274. PyObject_HEAD
  2275. PyObject *func;
  2276. #elif PY_VERSION_HEX < 0x030900B1
  2277. PyCFunctionObject func;
  2278. #else
  2279. PyCMethodObject func;
  2280. #endif
  2281. #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
  2282. __pyx_vectorcallfunc func_vectorcall;
  2283. #endif
  2284. #if CYTHON_COMPILING_IN_LIMITED_API
  2285. PyObject *func_weakreflist;
  2286. #endif
  2287. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2288. PyObject *func_dict;
  2289. #endif
  2290. PyObject *func_name;
  2291. PyObject *func_qualname;
  2292. PyObject *func_doc;
  2293. PyObject *func_globals;
  2294. PyObject *func_code;
  2295. PyObject *func_closure;
  2296. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2297. PyObject *func_classobj;
  2298. #endif
  2299. PyObject *defaults;
  2300. int flags;
  2301. PyObject *defaults_tuple;
  2302. PyObject *defaults_kwdict;
  2303. PyObject *(*defaults_getter)(PyObject *);
  2304. PyObject *func_annotations;
  2305. PyObject *func_is_coroutine;
  2306. } __pyx_CyFunctionObject;
  2307. #undef __Pyx_CyOrPyCFunction_Check
  2308. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2309. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
  2310. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2311. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
  2312. #undef __Pyx_IsSameCFunction
  2313. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2314. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2315. int flags, PyObject* qualname,
  2316. PyObject *closure,
  2317. PyObject *module, PyObject *globals,
  2318. PyObject* code);
  2319. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2320. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
  2321. PyTypeObject *defaults_type);
  2322. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2323. PyObject *tuple);
  2324. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2325. PyObject *dict);
  2326. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2327. PyObject *dict);
  2328. static int __pyx_CyFunction_init(PyObject *module);
  2329. #if CYTHON_METH_FASTCALL
  2330. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2331. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2332. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2333. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2334. #if CYTHON_COMPILING_IN_LIMITED_API
  2335. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2336. #else
  2337. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2338. #endif
  2339. #endif
  2340. /* CythonFunction.proto */
  2341. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2342. int flags, PyObject* qualname,
  2343. PyObject *closure,
  2344. PyObject *module, PyObject *globals,
  2345. PyObject* code);
  2346. /* CLineInTraceback.proto (used by AddTraceback) */
  2347. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  2348. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2349. #else
  2350. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2351. #endif
  2352. /* CodeObjectCache.proto (used by AddTraceback) */
  2353. #if CYTHON_COMPILING_IN_LIMITED_API
  2354. typedef PyObject __Pyx_CachedCodeObjectType;
  2355. #else
  2356. typedef PyCodeObject __Pyx_CachedCodeObjectType;
  2357. #endif
  2358. typedef struct {
  2359. __Pyx_CachedCodeObjectType* code_object;
  2360. int code_line;
  2361. } __Pyx_CodeObjectCacheEntry;
  2362. struct __Pyx_CodeObjectCache {
  2363. int count;
  2364. int max_count;
  2365. __Pyx_CodeObjectCacheEntry* entries;
  2366. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  2367. __pyx_atomic_int_type accessor_count;
  2368. #endif
  2369. };
  2370. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2371. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
  2372. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
  2373. /* AddTraceback.proto */
  2374. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2375. int py_line, const char *filename);
  2376. /* GCCDiagnostics.proto */
  2377. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2378. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2379. #endif
  2380. /* CIntFromPy.proto */
  2381. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);
  2382. /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */
  2383. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2384. #if CYTHON_VECTORCALL
  2385. #if PY_VERSION_HEX >= 0x03090000
  2386. #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
  2387. #else
  2388. #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
  2389. #endif
  2390. #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
  2391. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2392. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2393. #else
  2394. #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
  2395. #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
  2396. #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
  2397. #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
  2398. #endif
  2399. /* CIntToPy.proto */
  2400. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);
  2401. /* CIntToPy.proto */
  2402. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);
  2403. /* CIntFromPy.proto */
  2404. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);
  2405. /* FormatTypeName.proto */
  2406. #if CYTHON_COMPILING_IN_LIMITED_API
  2407. typedef PyObject *__Pyx_TypeName;
  2408. #define __Pyx_FMT_TYPENAME "%U"
  2409. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2410. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2411. #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
  2412. #else
  2413. static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
  2414. #endif
  2415. #else // !LIMITED_API
  2416. typedef const char *__Pyx_TypeName;
  2417. #define __Pyx_FMT_TYPENAME "%.200s"
  2418. #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
  2419. #define __Pyx_DECREF_TypeName(obj)
  2420. #endif
  2421. /* FastTypeChecks.proto */
  2422. #if CYTHON_COMPILING_IN_CPYTHON
  2423. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2424. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2425. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2426. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2427. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2428. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2429. #else
  2430. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2431. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2432. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2433. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
  2434. return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
  2435. }
  2436. #endif
  2437. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2438. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2439. #ifdef PyExceptionInstance_Check
  2440. #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
  2441. #else
  2442. #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
  2443. #endif
  2444. /* GetRuntimeVersion.proto */
  2445. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  2446. static unsigned long __Pyx_cached_runtime_version = 0;
  2447. static void __Pyx_init_runtime_version(void);
  2448. #else
  2449. #define __Pyx_init_runtime_version()
  2450. #endif
  2451. static unsigned long __Pyx_get_runtime_version(void);
  2452. /* GetTopmostException.proto (used by SaveResetException) */
  2453. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2454. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2455. #endif
  2456. /* SaveResetException.proto (used by CoroutineBase) */
  2457. #if CYTHON_FAST_THREAD_STATE
  2458. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2459. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2460. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2461. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2462. #else
  2463. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2464. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2465. #endif
  2466. /* SwapException.proto (used by CoroutineBase) */
  2467. #if CYTHON_FAST_THREAD_STATE
  2468. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2469. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2470. #else
  2471. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2472. #endif
  2473. /* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
  2474. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2475. /* PyObjectCallMethod1.proto (used by CoroutineBase) */
  2476. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2477. /* ReturnWithStopIteration.proto (used by CoroutineBase) */
  2478. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);
  2479. /* CoroutineBase.proto (used by Generator) */
  2480. struct __pyx_CoroutineObject;
  2481. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2482. #if CYTHON_USE_EXC_INFO_STACK
  2483. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2484. #else
  2485. typedef struct {
  2486. PyObject *exc_type;
  2487. PyObject *exc_value;
  2488. PyObject *exc_traceback;
  2489. } __Pyx_ExcInfoStruct;
  2490. #endif
  2491. typedef struct __pyx_CoroutineObject {
  2492. PyObject_HEAD
  2493. __pyx_coroutine_body_t body;
  2494. PyObject *closure;
  2495. __Pyx_ExcInfoStruct gi_exc_state;
  2496. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2497. PyObject *gi_weakreflist;
  2498. #endif
  2499. PyObject *classobj;
  2500. PyObject *yieldfrom;
  2501. __Pyx_pyiter_sendfunc yieldfrom_am_send;
  2502. PyObject *gi_name;
  2503. PyObject *gi_qualname;
  2504. PyObject *gi_modulename;
  2505. PyObject *gi_code;
  2506. PyObject *gi_frame;
  2507. #if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
  2508. PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
  2509. uint64_t __pyx_pymonitoring_version;
  2510. #endif
  2511. int resume_label;
  2512. char is_running;
  2513. } __pyx_CoroutineObject;
  2514. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2515. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2516. PyObject *name, PyObject *qualname, PyObject *module_name);
  2517. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2518. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2519. PyObject *name, PyObject *qualname, PyObject *module_name);
  2520. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2521. static int __Pyx_Coroutine_clear(PyObject *self);
  2522. static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
  2523. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2524. static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
  2525. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2526. #if CYTHON_USE_EXC_INFO_STACK
  2527. #define __Pyx_Coroutine_SwapException(self)
  2528. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2529. #else
  2530. #define __Pyx_Coroutine_SwapException(self) {\
  2531. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2532. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2533. }
  2534. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2535. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2536. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2537. }
  2538. #endif
  2539. #if CYTHON_FAST_THREAD_STATE
  2540. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2541. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2542. #else
  2543. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2544. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2545. #endif
  2546. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2547. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2548. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
  2549. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
  2550. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
  2551. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
  2552. #if __PYX_HAS_PY_AM_SEND == 2
  2553. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
  2554. #endif
  2555. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);
  2556. /* Generator.proto */
  2557. #define __Pyx_Generator_USED
  2558. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
  2559. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2560. __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2561. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2562. static int __pyx_Generator_init(PyObject *module);
  2563. static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);
  2564. /* CheckBinaryVersion.proto */
  2565. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2566. /* DecompressString.proto */
  2567. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);
  2568. /* MultiPhaseInitModuleState.proto */
  2569. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  2570. static PyObject *__Pyx_State_FindModule(void*);
  2571. static int __Pyx_State_AddModule(PyObject* module, void*);
  2572. static int __Pyx_State_RemoveModule(void*);
  2573. #elif CYTHON_USE_MODULE_STATE
  2574. #define __Pyx_State_FindModule PyState_FindModule
  2575. #define __Pyx_State_AddModule PyState_AddModule
  2576. #define __Pyx_State_RemoveModule PyState_RemoveModule
  2577. #endif
  2578. /* #### Code section: module_declarations ### */
  2579. /* CythonABIVersion.proto */
  2580. #if CYTHON_COMPILING_IN_LIMITED_API
  2581. #if CYTHON_METH_FASTCALL
  2582. #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall"
  2583. #else
  2584. #define __PYX_FASTCALL_ABI_SUFFIX
  2585. #endif
  2586. #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2587. #else
  2588. #define __PYX_LIMITED_ABI_SUFFIX
  2589. #endif
  2590. #if __PYX_HAS_PY_AM_SEND == 1
  2591. #define __PYX_AM_SEND_ABI_SUFFIX
  2592. #elif __PYX_HAS_PY_AM_SEND == 2
  2593. #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
  2594. #else
  2595. #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
  2596. #endif
  2597. #ifndef __PYX_MONITORING_ABI_SUFFIX
  2598. #define __PYX_MONITORING_ABI_SUFFIX
  2599. #endif
  2600. #if CYTHON_USE_TP_FINALIZE
  2601. #define __PYX_TP_FINALIZE_ABI_SUFFIX
  2602. #else
  2603. #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
  2604. #endif
  2605. #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
  2606. #define __PYX_FREELISTS_ABI_SUFFIX
  2607. #else
  2608. #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
  2609. #endif
  2610. #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2611. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  2612. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  2613. /* Module declarations from "cython" */
  2614. /* Module declarations from "fontTools.varLib.iup" */
  2615. static PyObject *__pyx_f_9fontTools_6varLib_3iup_iup_segment(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
  2616. static CYTHON_INLINE int __pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *, PyObject *, int, int, PyObject *); /*proto*/
  2617. /* #### Code section: typeinfo ### */
  2618. /* #### Code section: before_global_var ### */
  2619. #define __Pyx_MODULE_NAME "fontTools.varLib.iup"
  2620. extern int __pyx_module_is_main_fontTools__varLib__iup;
  2621. int __pyx_module_is_main_fontTools__varLib__iup = 0;
  2622. /* Implementation of "fontTools.varLib.iup" */
  2623. /* #### Code section: global_var ### */
  2624. static PyObject *__pyx_builtin_zip;
  2625. static PyObject *__pyx_builtin_enumerate;
  2626. static PyObject *__pyx_builtin_max;
  2627. /* #### Code section: string_decls ### */
  2628. /* #### Code section: decls ### */
  2629. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords); /* proto */
  2630. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_2iup_delta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_ends); /* proto */
  2631. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2632. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_tolerance); /* proto */
  2633. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2634. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_6_iup_contour_optimize_dp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_forced, double __pyx_v_tolerance, PyObject *__pyx_v_lookback); /* proto */
  2635. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k); /* proto */
  2636. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_10_rot_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_k, PyObject *__pyx_v_n); /* proto */
  2637. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2638. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2639. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_12iup_contour_optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_tolerance); /* proto */
  2640. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_14iup_delta_optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_ends, PyObject *__pyx_v_tolerance); /* proto */
  2641. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2642. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2643. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2644. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2645. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2646. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2647. /* #### Code section: late_includes ### */
  2648. /* #### Code section: module_state ### */
  2649. /* SmallCodeConfig */
  2650. #ifndef CYTHON_SMALL_CODE
  2651. #if defined(__clang__)
  2652. #define CYTHON_SMALL_CODE
  2653. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  2654. #define CYTHON_SMALL_CODE __attribute__((cold))
  2655. #else
  2656. #define CYTHON_SMALL_CODE
  2657. #endif
  2658. #endif
  2659. typedef struct {
  2660. PyObject *__pyx_d;
  2661. PyObject *__pyx_b;
  2662. PyObject *__pyx_cython_runtime;
  2663. PyObject *__pyx_empty_tuple;
  2664. PyObject *__pyx_empty_bytes;
  2665. PyObject *__pyx_empty_unicode;
  2666. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_defaults;
  2667. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2668. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2669. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2670. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2671. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2672. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults;
  2673. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2674. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2675. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2676. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2677. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2678. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  2679. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  2680. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  2681. PyObject *__pyx_tuple[4];
  2682. PyObject *__pyx_codeobj_tab[11];
  2683. PyObject *__pyx_string_tab[128];
  2684. PyObject *__pyx_number_tab[8];
  2685. /* #### Code section: module_state_contents ### */
  2686. /* IterNextPlain.module_state_decls */
  2687. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2688. PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
  2689. #endif
  2690. #if CYTHON_USE_FREELISTS
  2691. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between[8];
  2692. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2693. #endif
  2694. #if CYTHON_USE_FREELISTS
  2695. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[8];
  2696. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2697. #endif
  2698. #if CYTHON_USE_FREELISTS
  2699. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize[8];
  2700. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2701. #endif
  2702. #if CYTHON_USE_FREELISTS
  2703. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[8];
  2704. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2705. #endif
  2706. #if CYTHON_USE_FREELISTS
  2707. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[8];
  2708. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2709. #endif
  2710. /* CommonTypesMetaclass.module_state_decls */
  2711. PyTypeObject *__pyx_CommonTypesMetaclassType;
  2712. /* CachedMethodType.module_state_decls */
  2713. #if CYTHON_COMPILING_IN_LIMITED_API
  2714. PyObject *__Pyx_CachedMethodType;
  2715. #endif
  2716. /* CythonFunctionShared.module_state_decls */
  2717. PyTypeObject *__pyx_CyFunctionType;
  2718. /* CodeObjectCache.module_state_decls */
  2719. struct __Pyx_CodeObjectCache __pyx_code_cache;
  2720. /* Generator.module_state_decls */
  2721. PyTypeObject *__pyx_GeneratorType;
  2722. /* #### Code section: module_state_end ### */
  2723. } __pyx_mstatetype;
  2724. #if CYTHON_USE_MODULE_STATE
  2725. #ifdef __cplusplus
  2726. namespace {
  2727. extern struct PyModuleDef __pyx_moduledef;
  2728. } /* anonymous namespace */
  2729. #else
  2730. static struct PyModuleDef __pyx_moduledef;
  2731. #endif
  2732. #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))
  2733. #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
  2734. #else
  2735. static __pyx_mstatetype __pyx_mstate_global_static =
  2736. #ifdef __cplusplus
  2737. {};
  2738. #else
  2739. {0};
  2740. #endif
  2741. static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
  2742. #endif
  2743. /* #### Code section: constant_name_defines ### */
  2744. #define __pyx_kp_u_ __pyx_string_tab[0]
  2745. #define __pyx_kp_u_Lib_fontTools_varLib_iup_py __pyx_string_tab[1]
  2746. #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[2]
  2747. #define __pyx_kp_u__2 __pyx_string_tab[3]
  2748. #define __pyx_kp_u_add_note __pyx_string_tab[4]
  2749. #define __pyx_kp_u_disable __pyx_string_tab[5]
  2750. #define __pyx_kp_u_enable __pyx_string_tab[6]
  2751. #define __pyx_kp_u_gc __pyx_string_tab[7]
  2752. #define __pyx_kp_u_isenabled __pyx_string_tab[8]
  2753. #define __pyx_n_u_COMPILED __pyx_string_tab[9]
  2754. #define __pyx_n_u_Delta __pyx_string_tab[10]
  2755. #define __pyx_n_u_DeltaOrNone __pyx_string_tab[11]
  2756. #define __pyx_n_u_DeltaOrNoneSegment __pyx_string_tab[12]
  2757. #define __pyx_n_u_DeltaSegment __pyx_string_tab[13]
  2758. #define __pyx_n_u_Endpoints __pyx_string_tab[14]
  2759. #define __pyx_n_u_Integral __pyx_string_tab[15]
  2760. #define __pyx_n_u_MAX_LOOKBACK __pyx_string_tab[16]
  2761. #define __pyx_n_u_Point __pyx_string_tab[17]
  2762. #define __pyx_n_u_PointSegment __pyx_string_tab[18]
  2763. #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[19]
  2764. #define __pyx_n_u_Real __pyx_string_tab[20]
  2765. #define __pyx_n_u_Sequence __pyx_string_tab[21]
  2766. #define __pyx_n_u_Tuple __pyx_string_tab[22]
  2767. #define __pyx_n_u_Union __pyx_string_tab[23]
  2768. #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[24]
  2769. #define __pyx_n_u_best_cost __pyx_string_tab[25]
  2770. #define __pyx_n_u_best_j __pyx_string_tab[26]
  2771. #define __pyx_n_u_best_sol __pyx_string_tab[27]
  2772. #define __pyx_n_u_c __pyx_string_tab[28]
  2773. #define __pyx_n_u_c1 __pyx_string_tab[29]
  2774. #define __pyx_n_u_c2 __pyx_string_tab[30]
  2775. #define __pyx_n_u_can_iup_in_between_locals_genexp __pyx_string_tab[31]
  2776. #define __pyx_n_u_chain __pyx_string_tab[32]
  2777. #define __pyx_n_u_cj __pyx_string_tab[33]
  2778. #define __pyx_n_u_class_getitem __pyx_string_tab[34]
  2779. #define __pyx_n_u_cline_in_traceback __pyx_string_tab[35]
  2780. #define __pyx_n_u_close __pyx_string_tab[36]
  2781. #define __pyx_n_u_contour __pyx_string_tab[37]
  2782. #define __pyx_n_u_coords __pyx_string_tab[38]
  2783. #define __pyx_n_u_cost __pyx_string_tab[39]
  2784. #define __pyx_n_u_costs __pyx_string_tab[40]
  2785. #define __pyx_n_u_d __pyx_string_tab[41]
  2786. #define __pyx_n_u_d0 __pyx_string_tab[42]
  2787. #define __pyx_n_u_d1 __pyx_string_tab[43]
  2788. #define __pyx_n_u_d2 __pyx_string_tab[44]
  2789. #define __pyx_n_u_deltas __pyx_string_tab[45]
  2790. #define __pyx_n_u_dj __pyx_string_tab[46]
  2791. #define __pyx_n_u_end __pyx_string_tab[47]
  2792. #define __pyx_n_u_ends __pyx_string_tab[48]
  2793. #define __pyx_n_u_enumerate __pyx_string_tab[49]
  2794. #define __pyx_n_u_fontTools_varLib_iup __pyx_string_tab[50]
  2795. #define __pyx_n_u_force __pyx_string_tab[51]
  2796. #define __pyx_n_u_forced __pyx_string_tab[52]
  2797. #define __pyx_n_u_func __pyx_string_tab[53]
  2798. #define __pyx_n_u_genexpr __pyx_string_tab[54]
  2799. #define __pyx_n_u_i __pyx_string_tab[55]
  2800. #define __pyx_n_u_i1 __pyx_string_tab[56]
  2801. #define __pyx_n_u_i2 __pyx_string_tab[57]
  2802. #define __pyx_n_u_indices __pyx_string_tab[58]
  2803. #define __pyx_n_u_int __pyx_string_tab[59]
  2804. #define __pyx_n_u_is_coroutine __pyx_string_tab[60]
  2805. #define __pyx_n_u_it __pyx_string_tab[61]
  2806. #define __pyx_n_u_items __pyx_string_tab[62]
  2807. #define __pyx_n_u_iup_contour __pyx_string_tab[63]
  2808. #define __pyx_n_u_iup_contour_bound_forced_set __pyx_string_tab[64]
  2809. #define __pyx_n_u_iup_contour_optimize __pyx_string_tab[65]
  2810. #define __pyx_n_u_iup_contour_optimize_dp __pyx_string_tab[66]
  2811. #define __pyx_n_u_iup_contour_optimize_locals_gene __pyx_string_tab[67]
  2812. #define __pyx_n_u_iup_delta __pyx_string_tab[68]
  2813. #define __pyx_n_u_iup_delta_optimize __pyx_string_tab[69]
  2814. #define __pyx_n_u_j __pyx_string_tab[70]
  2815. #define __pyx_n_u_k __pyx_string_tab[71]
  2816. #define __pyx_n_u_l __pyx_string_tab[72]
  2817. #define __pyx_n_u_lc __pyx_string_tab[73]
  2818. #define __pyx_n_u_lcj __pyx_string_tab[74]
  2819. #define __pyx_n_u_ld __pyx_string_tab[75]
  2820. #define __pyx_n_u_ldj __pyx_string_tab[76]
  2821. #define __pyx_n_u_list __pyx_string_tab[77]
  2822. #define __pyx_n_u_lookback __pyx_string_tab[78]
  2823. #define __pyx_n_u_main __pyx_string_tab[79]
  2824. #define __pyx_n_u_max __pyx_string_tab[80]
  2825. #define __pyx_n_u_module __pyx_string_tab[81]
  2826. #define __pyx_n_u_n __pyx_string_tab[82]
  2827. #define __pyx_n_u_name __pyx_string_tab[83]
  2828. #define __pyx_n_u_nc __pyx_string_tab[84]
  2829. #define __pyx_n_u_ncj __pyx_string_tab[85]
  2830. #define __pyx_n_u_nd __pyx_string_tab[86]
  2831. #define __pyx_n_u_ndj __pyx_string_tab[87]
  2832. #define __pyx_n_u_next __pyx_string_tab[88]
  2833. #define __pyx_n_u_numbers __pyx_string_tab[89]
  2834. #define __pyx_n_u_out __pyx_string_tab[90]
  2835. #define __pyx_n_u_p __pyx_string_tab[91]
  2836. #define __pyx_n_u_pop __pyx_string_tab[92]
  2837. #define __pyx_n_u_q __pyx_string_tab[93]
  2838. #define __pyx_n_u_qualname __pyx_string_tab[94]
  2839. #define __pyx_n_u_return __pyx_string_tab[95]
  2840. #define __pyx_n_u_ri1 __pyx_string_tab[96]
  2841. #define __pyx_n_u_ri2 __pyx_string_tab[97]
  2842. #define __pyx_n_u_rot_list __pyx_string_tab[98]
  2843. #define __pyx_n_u_rot_set __pyx_string_tab[99]
  2844. #define __pyx_n_u_s __pyx_string_tab[100]
  2845. #define __pyx_n_u_send __pyx_string_tab[101]
  2846. #define __pyx_n_u_set __pyx_string_tab[102]
  2847. #define __pyx_n_u_set_name __pyx_string_tab[103]
  2848. #define __pyx_n_u_setdefault __pyx_string_tab[104]
  2849. #define __pyx_n_u_solution __pyx_string_tab[105]
  2850. #define __pyx_n_u_start __pyx_string_tab[106]
  2851. #define __pyx_n_u_test __pyx_string_tab[107]
  2852. #define __pyx_n_u_throw __pyx_string_tab[108]
  2853. #define __pyx_n_u_tolerance __pyx_string_tab[109]
  2854. #define __pyx_n_u_typing __pyx_string_tab[110]
  2855. #define __pyx_n_u_v __pyx_string_tab[111]
  2856. #define __pyx_n_u_value __pyx_string_tab[112]
  2857. #define __pyx_n_u_values __pyx_string_tab[113]
  2858. #define __pyx_n_u_x __pyx_string_tab[114]
  2859. #define __pyx_n_u_y __pyx_string_tab[115]
  2860. #define __pyx_n_u_zip __pyx_string_tab[116]
  2861. #define __pyx_kp_b_iso88591_1 __pyx_string_tab[117]
  2862. #define __pyx_kp_b_iso88591_1A_t1_q_1ARr_b_Bb __pyx_string_tab[118]
  2863. #define __pyx_kp_b_iso88591_55Gq_3axs_Qa_uG1_q_1A_ar_S_Yaxs __pyx_string_tab[119]
  2864. #define __pyx_kp_b_iso88591_A __pyx_string_tab[120]
  2865. #define __pyx_kp_b_iso88591_Q_1A_A_q_r_A_q_q_a_q_Bay_A_881 __pyx_string_tab[121]
  2866. #define __pyx_kp_b_iso88591_Q_3axs_Qa_1A_U_3axr_T_E_q_D_ar __pyx_string_tab[122]
  2867. #define __pyx_kp_b_iso88591_a __pyx_string_tab[123]
  2868. #define __pyx_kp_b_iso88591_a_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2 __pyx_string_tab[124]
  2869. #define __pyx_kp_b_iso88591_q_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2 __pyx_string_tab[125]
  2870. #define __pyx_kp_b_iso88591_q_a_1A_y_1_1_Q_c_c_U_3a_E_Bc_1 __pyx_string_tab[126]
  2871. #define __pyx_kp_b_iso88591_t1_q_2Rr_Bb_E __pyx_string_tab[127]
  2872. #define __pyx_float_0_0 __pyx_number_tab[0]
  2873. #define __pyx_int_0 __pyx_number_tab[1]
  2874. #define __pyx_int_neg_1 __pyx_number_tab[2]
  2875. #define __pyx_int_1 __pyx_number_tab[3]
  2876. #define __pyx_int_2 __pyx_number_tab[4]
  2877. #define __pyx_int_3 __pyx_number_tab[5]
  2878. #define __pyx_int_4 __pyx_number_tab[6]
  2879. #define __pyx_int_8 __pyx_number_tab[7]
  2880. /* #### Code section: module_state_clear ### */
  2881. #if CYTHON_USE_MODULE_STATE
  2882. static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  2883. __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  2884. if (!clear_module_state) return 0;
  2885. Py_CLEAR(clear_module_state->__pyx_d);
  2886. Py_CLEAR(clear_module_state->__pyx_b);
  2887. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  2888. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  2889. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  2890. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  2891. #if CYTHON_PEP489_MULTI_PHASE_INIT
  2892. __Pyx_State_RemoveModule(NULL);
  2893. #endif
  2894. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  2895. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_defaults);
  2896. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2897. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2898. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2899. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2900. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2901. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2902. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2903. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2904. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2905. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2906. for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  2907. for (int i=0; i<11; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  2908. for (int i=0; i<128; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  2909. for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
  2910. /* #### Code section: module_state_clear_contents ### */
  2911. /* CommonTypesMetaclass.module_state_clear */
  2912. Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);
  2913. /* CythonFunctionShared.module_state_clear */
  2914. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  2915. /* Generator.module_state_clear */
  2916. Py_CLEAR(clear_module_state->__pyx_GeneratorType);
  2917. /* #### Code section: module_state_clear_end ### */
  2918. return 0;
  2919. }
  2920. #endif
  2921. /* #### Code section: module_state_traverse ### */
  2922. #if CYTHON_USE_MODULE_STATE
  2923. static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  2924. __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  2925. if (!traverse_module_state) return 0;
  2926. Py_VISIT(traverse_module_state->__pyx_d);
  2927. Py_VISIT(traverse_module_state->__pyx_b);
  2928. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  2929. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  2930. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  2931. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  2932. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  2933. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_defaults);
  2934. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2935. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2936. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2937. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2938. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2939. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2940. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2941. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2942. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2943. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2944. for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  2945. for (int i=0; i<11; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  2946. for (int i=0; i<128; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  2947. for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
  2948. /* #### Code section: module_state_traverse_contents ### */
  2949. /* CommonTypesMetaclass.module_state_traverse */
  2950. Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);
  2951. /* CythonFunctionShared.module_state_traverse */
  2952. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  2953. /* Generator.module_state_traverse */
  2954. Py_VISIT(traverse_module_state->__pyx_GeneratorType);
  2955. /* #### Code section: module_state_traverse_end ### */
  2956. return 0;
  2957. }
  2958. #endif
  2959. /* #### Code section: module_code ### */
  2960. /* "fontTools/varLib/iup.py":28
  2961. *
  2962. *
  2963. * @cython.cfunc # <<<<<<<<<<<<<<
  2964. * @cython.locals(
  2965. * j=cython.int,
  2966. */
  2967. static PyObject *__pyx_f_9fontTools_6varLib_3iup_iup_segment(PyObject *__pyx_v_coords, PyObject *__pyx_v_rc1, PyObject *__pyx_v_rd1, PyObject *__pyx_v_rc2, PyObject *__pyx_v_rd2) {
  2968. int __pyx_v_j;
  2969. int __pyx_v_n;
  2970. double __pyx_v_x1;
  2971. double __pyx_v_x2;
  2972. double __pyx_v_d1;
  2973. double __pyx_v_d2;
  2974. double __pyx_v_scale;
  2975. double __pyx_v_x;
  2976. double __pyx_v_d;
  2977. PyObject *__pyx_v_out_arrays = NULL;
  2978. PyObject *__pyx_v_out = NULL;
  2979. PyObject *__pyx_v_pair = NULL;
  2980. double __pyx_v_nudge;
  2981. PyObject *__pyx_r = NULL;
  2982. __Pyx_RefNannyDeclarations
  2983. PyObject *__pyx_t_1 = NULL;
  2984. Py_ssize_t __pyx_t_2;
  2985. PyObject *__pyx_t_3 = NULL;
  2986. int __pyx_t_4;
  2987. double __pyx_t_5;
  2988. double __pyx_t_6;
  2989. double __pyx_t_7;
  2990. double __pyx_t_8;
  2991. int __pyx_t_9;
  2992. Py_ssize_t __pyx_t_10;
  2993. PyObject *__pyx_t_11 = NULL;
  2994. int __pyx_t_12;
  2995. PyObject *(*__pyx_t_13)(PyObject *);
  2996. int __pyx_lineno = 0;
  2997. const char *__pyx_filename = NULL;
  2998. int __pyx_clineno = 0;
  2999. __Pyx_RefNannySetupContext("iup_segment", 0);
  3000. /* "fontTools/varLib/iup.py":49
  3001. * # rc1 = reference coord 1
  3002. * # rd1 = reference delta 1
  3003. * out_arrays = [None, None] # <<<<<<<<<<<<<<
  3004. * for j in 0, 1:
  3005. * out_arrays[j] = out = []
  3006. */
  3007. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
  3008. __Pyx_GOTREF(__pyx_t_1);
  3009. __Pyx_INCREF(Py_None);
  3010. __Pyx_GIVEREF(Py_None);
  3011. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_None) != (0)) __PYX_ERR(0, 49, __pyx_L1_error);
  3012. __Pyx_INCREF(Py_None);
  3013. __Pyx_GIVEREF(Py_None);
  3014. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 49, __pyx_L1_error);
  3015. __pyx_v_out_arrays = ((PyObject*)__pyx_t_1);
  3016. __pyx_t_1 = 0;
  3017. /* "fontTools/varLib/iup.py":50
  3018. * # rd1 = reference delta 1
  3019. * out_arrays = [None, None]
  3020. * for j in 0, 1: # <<<<<<<<<<<<<<
  3021. * out_arrays[j] = out = []
  3022. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3023. */
  3024. __pyx_t_1 = __pyx_mstate_global->__pyx_tuple[0]; __Pyx_INCREF(__pyx_t_1);
  3025. __pyx_t_2 = 0;
  3026. for (;;) {
  3027. if (__pyx_t_2 >= 2) break;
  3028. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3029. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  3030. #else
  3031. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  3032. #endif
  3033. ++__pyx_t_2;
  3034. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
  3035. __Pyx_GOTREF(__pyx_t_3);
  3036. __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error)
  3037. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3038. __pyx_v_j = __pyx_t_4;
  3039. /* "fontTools/varLib/iup.py":51
  3040. * out_arrays = [None, None]
  3041. * for j in 0, 1:
  3042. * out_arrays[j] = out = [] # <<<<<<<<<<<<<<
  3043. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3044. *
  3045. */
  3046. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  3047. __Pyx_GOTREF(__pyx_t_3);
  3048. if (unlikely((__Pyx_SetItemInt(__pyx_v_out_arrays, __pyx_v_j, __pyx_t_3, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 51, __pyx_L1_error)
  3049. __Pyx_INCREF(__pyx_t_3);
  3050. __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_3);
  3051. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3052. /* "fontTools/varLib/iup.py":52
  3053. * for j in 0, 1:
  3054. * out_arrays[j] = out = []
  3055. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j] # <<<<<<<<<<<<<<
  3056. *
  3057. * if x1 == x2:
  3058. */
  3059. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rc1, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  3060. __Pyx_GOTREF(__pyx_t_3);
  3061. __pyx_t_5 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
  3062. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3063. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rc2, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  3064. __Pyx_GOTREF(__pyx_t_3);
  3065. __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
  3066. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3067. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rd1, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  3068. __Pyx_GOTREF(__pyx_t_3);
  3069. __pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
  3070. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3071. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rd2, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  3072. __Pyx_GOTREF(__pyx_t_3);
  3073. __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
  3074. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3075. __pyx_v_x1 = __pyx_t_5;
  3076. __pyx_v_x2 = __pyx_t_6;
  3077. __pyx_v_d1 = __pyx_t_7;
  3078. __pyx_v_d2 = __pyx_t_8;
  3079. /* "fontTools/varLib/iup.py":54
  3080. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3081. *
  3082. * if x1 == x2: # <<<<<<<<<<<<<<
  3083. * n = len(coords)
  3084. * if d1 == d2:
  3085. */
  3086. __pyx_t_9 = (__pyx_v_x1 == __pyx_v_x2);
  3087. if (__pyx_t_9) {
  3088. /* "fontTools/varLib/iup.py":55
  3089. *
  3090. * if x1 == x2:
  3091. * n = len(coords) # <<<<<<<<<<<<<<
  3092. * if d1 == d2:
  3093. * out.extend([d1] * n)
  3094. */
  3095. __pyx_t_10 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 55, __pyx_L1_error)
  3096. __pyx_v_n = __pyx_t_10;
  3097. /* "fontTools/varLib/iup.py":56
  3098. * if x1 == x2:
  3099. * n = len(coords)
  3100. * if d1 == d2: # <<<<<<<<<<<<<<
  3101. * out.extend([d1] * n)
  3102. * else:
  3103. */
  3104. __pyx_t_9 = (__pyx_v_d1 == __pyx_v_d2);
  3105. if (__pyx_t_9) {
  3106. /* "fontTools/varLib/iup.py":57
  3107. * n = len(coords)
  3108. * if d1 == d2:
  3109. * out.extend([d1] * n) # <<<<<<<<<<<<<<
  3110. * else:
  3111. * out.extend([0] * n)
  3112. */
  3113. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
  3114. __Pyx_GOTREF(__pyx_t_3);
  3115. __pyx_t_11 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L1_error)
  3116. __Pyx_GOTREF(__pyx_t_11);
  3117. { Py_ssize_t __pyx_temp;
  3118. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3119. __Pyx_INCREF(__pyx_t_3);
  3120. __Pyx_GIVEREF(__pyx_t_3);
  3121. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_t_3) != (0)) __PYX_ERR(0, 57, __pyx_L1_error);
  3122. }
  3123. }
  3124. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3125. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 57, __pyx_L1_error)
  3126. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3127. /* "fontTools/varLib/iup.py":56
  3128. * if x1 == x2:
  3129. * n = len(coords)
  3130. * if d1 == d2: # <<<<<<<<<<<<<<
  3131. * out.extend([d1] * n)
  3132. * else:
  3133. */
  3134. goto __pyx_L6;
  3135. }
  3136. /* "fontTools/varLib/iup.py":59
  3137. * out.extend([d1] * n)
  3138. * else:
  3139. * out.extend([0] * n) # <<<<<<<<<<<<<<
  3140. * continue
  3141. *
  3142. */
  3143. /*else*/ {
  3144. __pyx_t_11 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L1_error)
  3145. __Pyx_GOTREF(__pyx_t_11);
  3146. { Py_ssize_t __pyx_temp;
  3147. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3148. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  3149. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
  3150. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 59, __pyx_L1_error);
  3151. }
  3152. }
  3153. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 59, __pyx_L1_error)
  3154. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3155. }
  3156. __pyx_L6:;
  3157. /* "fontTools/varLib/iup.py":60
  3158. * else:
  3159. * out.extend([0] * n)
  3160. * continue # <<<<<<<<<<<<<<
  3161. *
  3162. * if x1 > x2:
  3163. */
  3164. goto __pyx_L3_continue;
  3165. /* "fontTools/varLib/iup.py":54
  3166. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3167. *
  3168. * if x1 == x2: # <<<<<<<<<<<<<<
  3169. * n = len(coords)
  3170. * if d1 == d2:
  3171. */
  3172. }
  3173. /* "fontTools/varLib/iup.py":62
  3174. * continue
  3175. *
  3176. * if x1 > x2: # <<<<<<<<<<<<<<
  3177. * x1, x2 = x2, x1
  3178. * d1, d2 = d2, d1
  3179. */
  3180. __pyx_t_9 = (__pyx_v_x1 > __pyx_v_x2);
  3181. if (__pyx_t_9) {
  3182. /* "fontTools/varLib/iup.py":63
  3183. *
  3184. * if x1 > x2:
  3185. * x1, x2 = x2, x1 # <<<<<<<<<<<<<<
  3186. * d1, d2 = d2, d1
  3187. *
  3188. */
  3189. __pyx_t_8 = __pyx_v_x2;
  3190. __pyx_t_7 = __pyx_v_x1;
  3191. __pyx_v_x1 = __pyx_t_8;
  3192. __pyx_v_x2 = __pyx_t_7;
  3193. /* "fontTools/varLib/iup.py":64
  3194. * if x1 > x2:
  3195. * x1, x2 = x2, x1
  3196. * d1, d2 = d2, d1 # <<<<<<<<<<<<<<
  3197. *
  3198. * # x1 < x2
  3199. */
  3200. __pyx_t_7 = __pyx_v_d2;
  3201. __pyx_t_8 = __pyx_v_d1;
  3202. __pyx_v_d1 = __pyx_t_7;
  3203. __pyx_v_d2 = __pyx_t_8;
  3204. /* "fontTools/varLib/iup.py":62
  3205. * continue
  3206. *
  3207. * if x1 > x2: # <<<<<<<<<<<<<<
  3208. * x1, x2 = x2, x1
  3209. * d1, d2 = d2, d1
  3210. */
  3211. }
  3212. /* "fontTools/varLib/iup.py":67
  3213. *
  3214. * # x1 < x2
  3215. * scale = (d2 - d1) / (x2 - x1) # <<<<<<<<<<<<<<
  3216. * for pair in coords:
  3217. * x = pair[j]
  3218. */
  3219. __pyx_t_8 = (__pyx_v_d2 - __pyx_v_d1);
  3220. __pyx_t_7 = (__pyx_v_x2 - __pyx_v_x1);
  3221. if (unlikely(__pyx_t_7 == 0)) {
  3222. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  3223. __PYX_ERR(0, 67, __pyx_L1_error)
  3224. }
  3225. __pyx_v_scale = (__pyx_t_8 / __pyx_t_7);
  3226. /* "fontTools/varLib/iup.py":68
  3227. * # x1 < x2
  3228. * scale = (d2 - d1) / (x2 - x1)
  3229. * for pair in coords: # <<<<<<<<<<<<<<
  3230. * x = pair[j]
  3231. *
  3232. */
  3233. if (likely(PyList_CheckExact(__pyx_v_coords)) || PyTuple_CheckExact(__pyx_v_coords)) {
  3234. __pyx_t_11 = __pyx_v_coords; __Pyx_INCREF(__pyx_t_11);
  3235. __pyx_t_10 = 0;
  3236. __pyx_t_13 = NULL;
  3237. } else {
  3238. __pyx_t_10 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_coords); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 68, __pyx_L1_error)
  3239. __Pyx_GOTREF(__pyx_t_11);
  3240. __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 68, __pyx_L1_error)
  3241. }
  3242. for (;;) {
  3243. if (likely(!__pyx_t_13)) {
  3244. if (likely(PyList_CheckExact(__pyx_t_11))) {
  3245. {
  3246. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  3247. #if !CYTHON_ASSUME_SAFE_SIZE
  3248. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
  3249. #endif
  3250. if (__pyx_t_10 >= __pyx_temp) break;
  3251. }
  3252. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
  3253. ++__pyx_t_10;
  3254. } else {
  3255. {
  3256. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  3257. #if !CYTHON_ASSUME_SAFE_SIZE
  3258. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
  3259. #endif
  3260. if (__pyx_t_10 >= __pyx_temp) break;
  3261. }
  3262. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3263. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_10));
  3264. #else
  3265. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_10);
  3266. #endif
  3267. ++__pyx_t_10;
  3268. }
  3269. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  3270. } else {
  3271. __pyx_t_3 = __pyx_t_13(__pyx_t_11);
  3272. if (unlikely(!__pyx_t_3)) {
  3273. PyObject* exc_type = PyErr_Occurred();
  3274. if (exc_type) {
  3275. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 68, __pyx_L1_error)
  3276. PyErr_Clear();
  3277. }
  3278. break;
  3279. }
  3280. }
  3281. __Pyx_GOTREF(__pyx_t_3);
  3282. __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3);
  3283. __pyx_t_3 = 0;
  3284. /* "fontTools/varLib/iup.py":69
  3285. * scale = (d2 - d1) / (x2 - x1)
  3286. * for pair in coords:
  3287. * x = pair[j] # <<<<<<<<<<<<<<
  3288. *
  3289. * if x <= x1:
  3290. */
  3291. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pair, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  3292. __Pyx_GOTREF(__pyx_t_3);
  3293. __pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
  3294. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3295. __pyx_v_x = __pyx_t_7;
  3296. /* "fontTools/varLib/iup.py":71
  3297. * x = pair[j]
  3298. *
  3299. * if x <= x1: # <<<<<<<<<<<<<<
  3300. * d = d1
  3301. * elif x >= x2:
  3302. */
  3303. __pyx_t_9 = (__pyx_v_x <= __pyx_v_x1);
  3304. if (__pyx_t_9) {
  3305. /* "fontTools/varLib/iup.py":72
  3306. *
  3307. * if x <= x1:
  3308. * d = d1 # <<<<<<<<<<<<<<
  3309. * elif x >= x2:
  3310. * d = d2
  3311. */
  3312. __pyx_v_d = __pyx_v_d1;
  3313. /* "fontTools/varLib/iup.py":71
  3314. * x = pair[j]
  3315. *
  3316. * if x <= x1: # <<<<<<<<<<<<<<
  3317. * d = d1
  3318. * elif x >= x2:
  3319. */
  3320. goto __pyx_L10;
  3321. }
  3322. /* "fontTools/varLib/iup.py":73
  3323. * if x <= x1:
  3324. * d = d1
  3325. * elif x >= x2: # <<<<<<<<<<<<<<
  3326. * d = d2
  3327. * else:
  3328. */
  3329. __pyx_t_9 = (__pyx_v_x >= __pyx_v_x2);
  3330. if (__pyx_t_9) {
  3331. /* "fontTools/varLib/iup.py":74
  3332. * d = d1
  3333. * elif x >= x2:
  3334. * d = d2 # <<<<<<<<<<<<<<
  3335. * else:
  3336. * # Interpolate
  3337. */
  3338. __pyx_v_d = __pyx_v_d2;
  3339. /* "fontTools/varLib/iup.py":73
  3340. * if x <= x1:
  3341. * d = d1
  3342. * elif x >= x2: # <<<<<<<<<<<<<<
  3343. * d = d2
  3344. * else:
  3345. */
  3346. goto __pyx_L10;
  3347. }
  3348. /* "fontTools/varLib/iup.py":83
  3349. * # - https://godbolt.org/z/YsP4T3TqK,
  3350. * # - https://github.com/fonttools/fonttools/issues/3703
  3351. * nudge = (x - x1) * scale # <<<<<<<<<<<<<<
  3352. * d = d1 + nudge
  3353. *
  3354. */
  3355. /*else*/ {
  3356. __pyx_v_nudge = ((__pyx_v_x - __pyx_v_x1) * __pyx_v_scale);
  3357. /* "fontTools/varLib/iup.py":84
  3358. * # - https://github.com/fonttools/fonttools/issues/3703
  3359. * nudge = (x - x1) * scale
  3360. * d = d1 + nudge # <<<<<<<<<<<<<<
  3361. *
  3362. * out.append(d)
  3363. */
  3364. __pyx_v_d = (__pyx_v_d1 + __pyx_v_nudge);
  3365. }
  3366. __pyx_L10:;
  3367. /* "fontTools/varLib/iup.py":86
  3368. * d = d1 + nudge
  3369. *
  3370. * out.append(d) # <<<<<<<<<<<<<<
  3371. *
  3372. * return zip(*out_arrays)
  3373. */
  3374. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  3375. __Pyx_GOTREF(__pyx_t_3);
  3376. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error)
  3377. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3378. /* "fontTools/varLib/iup.py":68
  3379. * # x1 < x2
  3380. * scale = (d2 - d1) / (x2 - x1)
  3381. * for pair in coords: # <<<<<<<<<<<<<<
  3382. * x = pair[j]
  3383. *
  3384. */
  3385. }
  3386. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3387. /* "fontTools/varLib/iup.py":50
  3388. * # rd1 = reference delta 1
  3389. * out_arrays = [None, None]
  3390. * for j in 0, 1: # <<<<<<<<<<<<<<
  3391. * out_arrays[j] = out = []
  3392. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3393. */
  3394. __pyx_L3_continue:;
  3395. }
  3396. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3397. /* "fontTools/varLib/iup.py":88
  3398. * out.append(d)
  3399. *
  3400. * return zip(*out_arrays) # <<<<<<<<<<<<<<
  3401. *
  3402. *
  3403. */
  3404. __Pyx_XDECREF(__pyx_r);
  3405. __pyx_t_1 = PySequence_Tuple(__pyx_v_out_arrays); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  3406. __Pyx_GOTREF(__pyx_t_1);
  3407. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 88, __pyx_L1_error)
  3408. __Pyx_GOTREF(__pyx_t_11);
  3409. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3410. __pyx_r = __pyx_t_11;
  3411. __pyx_t_11 = 0;
  3412. goto __pyx_L0;
  3413. /* "fontTools/varLib/iup.py":28
  3414. *
  3415. *
  3416. * @cython.cfunc # <<<<<<<<<<<<<<
  3417. * @cython.locals(
  3418. * j=cython.int,
  3419. */
  3420. /* function exit code */
  3421. __pyx_L1_error:;
  3422. __Pyx_XDECREF(__pyx_t_1);
  3423. __Pyx_XDECREF(__pyx_t_3);
  3424. __Pyx_XDECREF(__pyx_t_11);
  3425. __Pyx_AddTraceback("fontTools.varLib.iup.iup_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3426. __pyx_r = 0;
  3427. __pyx_L0:;
  3428. __Pyx_XDECREF(__pyx_v_out_arrays);
  3429. __Pyx_XDECREF(__pyx_v_out);
  3430. __Pyx_XDECREF(__pyx_v_pair);
  3431. __Pyx_XGIVEREF(__pyx_r);
  3432. __Pyx_RefNannyFinishContext();
  3433. return __pyx_r;
  3434. }
  3435. /* "fontTools/varLib/iup.py":91
  3436. *
  3437. *
  3438. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  3439. * """For the contour given in `coords`, interpolate any missing
  3440. * delta values in delta vector `deltas`.
  3441. */
  3442. /* Python wrapper */
  3443. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_1iup_contour(PyObject *__pyx_self,
  3444. #if CYTHON_METH_FASTCALL
  3445. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3446. #else
  3447. PyObject *__pyx_args, PyObject *__pyx_kwds
  3448. #endif
  3449. ); /*proto*/
  3450. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_iup_contour, "iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment\n\nFor the contour given in `coords`, interpolate any missing\ndelta values in delta vector `deltas`.\n\nReturns fully filled-out delta vector.");
  3451. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_1iup_contour = {"iup_contour", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_1iup_contour, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_iup_contour};
  3452. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_1iup_contour(PyObject *__pyx_self,
  3453. #if CYTHON_METH_FASTCALL
  3454. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3455. #else
  3456. PyObject *__pyx_args, PyObject *__pyx_kwds
  3457. #endif
  3458. ) {
  3459. PyObject *__pyx_v_deltas = 0;
  3460. PyObject *__pyx_v_coords = 0;
  3461. #if !CYTHON_METH_FASTCALL
  3462. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3463. #endif
  3464. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3465. PyObject* values[2] = {0,0};
  3466. int __pyx_lineno = 0;
  3467. const char *__pyx_filename = NULL;
  3468. int __pyx_clineno = 0;
  3469. PyObject *__pyx_r = 0;
  3470. __Pyx_RefNannyDeclarations
  3471. __Pyx_RefNannySetupContext("iup_contour (wrapper)", 0);
  3472. #if !CYTHON_METH_FASTCALL
  3473. #if CYTHON_ASSUME_SAFE_SIZE
  3474. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3475. #else
  3476. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3477. #endif
  3478. #endif
  3479. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3480. {
  3481. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,0};
  3482. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3483. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 91, __pyx_L3_error)
  3484. if (__pyx_kwds_len > 0) {
  3485. switch (__pyx_nargs) {
  3486. case 2:
  3487. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3488. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 91, __pyx_L3_error)
  3489. CYTHON_FALLTHROUGH;
  3490. case 1:
  3491. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3492. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error)
  3493. CYTHON_FALLTHROUGH;
  3494. case 0: break;
  3495. default: goto __pyx_L5_argtuple_error;
  3496. }
  3497. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3498. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iup_contour", 0) < (0)) __PYX_ERR(0, 91, __pyx_L3_error)
  3499. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  3500. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, i); __PYX_ERR(0, 91, __pyx_L3_error) }
  3501. }
  3502. } else if (unlikely(__pyx_nargs != 2)) {
  3503. goto __pyx_L5_argtuple_error;
  3504. } else {
  3505. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3506. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error)
  3507. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3508. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 91, __pyx_L3_error)
  3509. }
  3510. __pyx_v_deltas = values[0];
  3511. __pyx_v_coords = values[1];
  3512. }
  3513. goto __pyx_L6_skip;
  3514. __pyx_L5_argtuple_error:;
  3515. __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error)
  3516. __pyx_L6_skip:;
  3517. goto __pyx_L4_argument_unpacking_done;
  3518. __pyx_L3_error:;
  3519. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3520. Py_XDECREF(values[__pyx_temp]);
  3521. }
  3522. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3523. __Pyx_RefNannyFinishContext();
  3524. return NULL;
  3525. __pyx_L4_argument_unpacking_done:;
  3526. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_iup_contour(__pyx_self, __pyx_v_deltas, __pyx_v_coords);
  3527. /* function exit code */
  3528. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3529. Py_XDECREF(values[__pyx_temp]);
  3530. }
  3531. __Pyx_RefNannyFinishContext();
  3532. return __pyx_r;
  3533. }
  3534. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords) {
  3535. PyObject *__pyx_v_n = NULL;
  3536. PyObject *__pyx_v_indices = NULL;
  3537. PyObject *__pyx_v_out = NULL;
  3538. PyObject *__pyx_v_it = NULL;
  3539. PyObject *__pyx_v_start = NULL;
  3540. PyObject *__pyx_v_i1 = NULL;
  3541. PyObject *__pyx_v_i2 = NULL;
  3542. PyObject *__pyx_v_ri1 = NULL;
  3543. PyObject *__pyx_v_ri2 = NULL;
  3544. PyObject *__pyx_v_end = NULL;
  3545. PyObject *__pyx_7genexpr__pyx_v_i = NULL;
  3546. PyObject *__pyx_7genexpr__pyx_v_v = NULL;
  3547. PyObject *__pyx_r = NULL;
  3548. __Pyx_RefNannyDeclarations
  3549. Py_ssize_t __pyx_t_1;
  3550. Py_ssize_t __pyx_t_2;
  3551. int __pyx_t_3;
  3552. PyObject *__pyx_t_4 = NULL;
  3553. PyObject *__pyx_t_5 = NULL;
  3554. PyObject *__pyx_t_6 = NULL;
  3555. PyObject *(*__pyx_t_7)(PyObject *);
  3556. PyObject *__pyx_t_8 = NULL;
  3557. int __pyx_t_9;
  3558. PyObject *__pyx_t_10 = NULL;
  3559. PyObject *__pyx_t_11 = NULL;
  3560. int __pyx_t_12;
  3561. PyObject *__pyx_t_13 = NULL;
  3562. int __pyx_lineno = 0;
  3563. const char *__pyx_filename = NULL;
  3564. int __pyx_clineno = 0;
  3565. __Pyx_RefNannySetupContext("iup_contour", 0);
  3566. /* "fontTools/varLib/iup.py":97
  3567. * Returns fully filled-out delta vector."""
  3568. *
  3569. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  3570. * if None not in deltas:
  3571. * return deltas
  3572. */
  3573. #ifndef CYTHON_WITHOUT_ASSERTIONS
  3574. if (unlikely(__pyx_assertions_enabled())) {
  3575. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  3576. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  3577. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  3578. if (unlikely(!__pyx_t_3)) {
  3579. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  3580. __PYX_ERR(0, 97, __pyx_L1_error)
  3581. }
  3582. }
  3583. #else
  3584. if ((1)); else __PYX_ERR(0, 97, __pyx_L1_error)
  3585. #endif
  3586. /* "fontTools/varLib/iup.py":98
  3587. *
  3588. * assert len(deltas) == len(coords)
  3589. * if None not in deltas: # <<<<<<<<<<<<<<
  3590. * return deltas
  3591. *
  3592. */
  3593. __pyx_t_3 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_deltas, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 98, __pyx_L1_error)
  3594. if (__pyx_t_3) {
  3595. /* "fontTools/varLib/iup.py":99
  3596. * assert len(deltas) == len(coords)
  3597. * if None not in deltas:
  3598. * return deltas # <<<<<<<<<<<<<<
  3599. *
  3600. * n = len(deltas)
  3601. */
  3602. __Pyx_XDECREF(__pyx_r);
  3603. __Pyx_INCREF(__pyx_v_deltas);
  3604. __pyx_r = __pyx_v_deltas;
  3605. goto __pyx_L0;
  3606. /* "fontTools/varLib/iup.py":98
  3607. *
  3608. * assert len(deltas) == len(coords)
  3609. * if None not in deltas: # <<<<<<<<<<<<<<
  3610. * return deltas
  3611. *
  3612. */
  3613. }
  3614. /* "fontTools/varLib/iup.py":101
  3615. * return deltas
  3616. *
  3617. * n = len(deltas) # <<<<<<<<<<<<<<
  3618. * # indices of points with explicit deltas
  3619. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3620. */
  3621. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error)
  3622. __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
  3623. __Pyx_GOTREF(__pyx_t_4);
  3624. __pyx_v_n = __pyx_t_4;
  3625. __pyx_t_4 = 0;
  3626. /* "fontTools/varLib/iup.py":103
  3627. * n = len(deltas)
  3628. * # indices of points with explicit deltas
  3629. * indices = [i for i, v in enumerate(deltas) if v is not None] # <<<<<<<<<<<<<<
  3630. * if not indices:
  3631. * # All deltas are None. Return 0,0 for all.
  3632. */
  3633. { /* enter inner scope */
  3634. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L6_error)
  3635. __Pyx_GOTREF(__pyx_t_4);
  3636. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  3637. __pyx_t_5 = __pyx_mstate_global->__pyx_int_0;
  3638. if (likely(PyList_CheckExact(__pyx_v_deltas)) || PyTuple_CheckExact(__pyx_v_deltas)) {
  3639. __pyx_t_6 = __pyx_v_deltas; __Pyx_INCREF(__pyx_t_6);
  3640. __pyx_t_2 = 0;
  3641. __pyx_t_7 = NULL;
  3642. } else {
  3643. __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_deltas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L6_error)
  3644. __Pyx_GOTREF(__pyx_t_6);
  3645. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L6_error)
  3646. }
  3647. for (;;) {
  3648. if (likely(!__pyx_t_7)) {
  3649. if (likely(PyList_CheckExact(__pyx_t_6))) {
  3650. {
  3651. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  3652. #if !CYTHON_ASSUME_SAFE_SIZE
  3653. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L6_error)
  3654. #endif
  3655. if (__pyx_t_2 >= __pyx_temp) break;
  3656. }
  3657. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  3658. ++__pyx_t_2;
  3659. } else {
  3660. {
  3661. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  3662. #if !CYTHON_ASSUME_SAFE_SIZE
  3663. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L6_error)
  3664. #endif
  3665. if (__pyx_t_2 >= __pyx_temp) break;
  3666. }
  3667. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3668. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2));
  3669. #else
  3670. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_2);
  3671. #endif
  3672. ++__pyx_t_2;
  3673. }
  3674. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L6_error)
  3675. } else {
  3676. __pyx_t_8 = __pyx_t_7(__pyx_t_6);
  3677. if (unlikely(!__pyx_t_8)) {
  3678. PyObject* exc_type = PyErr_Occurred();
  3679. if (exc_type) {
  3680. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 103, __pyx_L6_error)
  3681. PyErr_Clear();
  3682. }
  3683. break;
  3684. }
  3685. }
  3686. __Pyx_GOTREF(__pyx_t_8);
  3687. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_8);
  3688. __pyx_t_8 = 0;
  3689. __Pyx_INCREF(__pyx_t_5);
  3690. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_5);
  3691. __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L6_error)
  3692. __Pyx_GOTREF(__pyx_t_8);
  3693. __Pyx_DECREF(__pyx_t_5);
  3694. __pyx_t_5 = __pyx_t_8;
  3695. __pyx_t_8 = 0;
  3696. __pyx_t_3 = (__pyx_7genexpr__pyx_v_v != Py_None);
  3697. if (__pyx_t_3) {
  3698. if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_7genexpr__pyx_v_i))) __PYX_ERR(0, 103, __pyx_L6_error)
  3699. }
  3700. }
  3701. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3702. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3703. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3704. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3705. goto __pyx_L11_exit_scope;
  3706. __pyx_L6_error:;
  3707. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3708. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3709. goto __pyx_L1_error;
  3710. __pyx_L11_exit_scope:;
  3711. } /* exit inner scope */
  3712. __pyx_v_indices = ((PyObject*)__pyx_t_4);
  3713. __pyx_t_4 = 0;
  3714. /* "fontTools/varLib/iup.py":104
  3715. * # indices of points with explicit deltas
  3716. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3717. * if not indices: # <<<<<<<<<<<<<<
  3718. * # All deltas are None. Return 0,0 for all.
  3719. * return [(0, 0)] * n
  3720. */
  3721. {
  3722. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_indices);
  3723. if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error)
  3724. __pyx_t_3 = (__pyx_temp != 0);
  3725. }
  3726. __pyx_t_9 = (!__pyx_t_3);
  3727. if (__pyx_t_9) {
  3728. /* "fontTools/varLib/iup.py":106
  3729. * if not indices:
  3730. * # All deltas are None. Return 0,0 for all.
  3731. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  3732. *
  3733. * out = []
  3734. */
  3735. __Pyx_XDECREF(__pyx_r);
  3736. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
  3737. __Pyx_GOTREF(__pyx_t_4);
  3738. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  3739. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  3740. if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_tuple[1]) != (0)) __PYX_ERR(0, 106, __pyx_L1_error);
  3741. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 106, __pyx_L1_error)
  3742. __Pyx_GOTREF(__pyx_temp);
  3743. __Pyx_DECREF(__pyx_t_4);
  3744. __pyx_t_4 = __pyx_temp;
  3745. }
  3746. __pyx_r = __pyx_t_4;
  3747. __pyx_t_4 = 0;
  3748. goto __pyx_L0;
  3749. /* "fontTools/varLib/iup.py":104
  3750. * # indices of points with explicit deltas
  3751. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3752. * if not indices: # <<<<<<<<<<<<<<
  3753. * # All deltas are None. Return 0,0 for all.
  3754. * return [(0, 0)] * n
  3755. */
  3756. }
  3757. /* "fontTools/varLib/iup.py":108
  3758. * return [(0, 0)] * n
  3759. *
  3760. * out = [] # <<<<<<<<<<<<<<
  3761. * it = iter(indices)
  3762. * start = next(it)
  3763. */
  3764. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
  3765. __Pyx_GOTREF(__pyx_t_4);
  3766. __pyx_v_out = ((PyObject*)__pyx_t_4);
  3767. __pyx_t_4 = 0;
  3768. /* "fontTools/varLib/iup.py":109
  3769. *
  3770. * out = []
  3771. * it = iter(indices) # <<<<<<<<<<<<<<
  3772. * start = next(it)
  3773. * if start != 0:
  3774. */
  3775. __pyx_t_4 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
  3776. __Pyx_GOTREF(__pyx_t_4);
  3777. __pyx_v_it = __pyx_t_4;
  3778. __pyx_t_4 = 0;
  3779. /* "fontTools/varLib/iup.py":110
  3780. * out = []
  3781. * it = iter(indices)
  3782. * start = next(it) # <<<<<<<<<<<<<<
  3783. * if start != 0:
  3784. * # Initial segment that wraps around
  3785. */
  3786. __pyx_t_4 = __Pyx_PyIter_Next(__pyx_v_it); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
  3787. __Pyx_GOTREF(__pyx_t_4);
  3788. __pyx_v_start = __pyx_t_4;
  3789. __pyx_t_4 = 0;
  3790. /* "fontTools/varLib/iup.py":111
  3791. * it = iter(indices)
  3792. * start = next(it)
  3793. * if start != 0: # <<<<<<<<<<<<<<
  3794. * # Initial segment that wraps around
  3795. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3796. */
  3797. __pyx_t_9 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 111, __pyx_L1_error)
  3798. if (__pyx_t_9) {
  3799. /* "fontTools/varLib/iup.py":113
  3800. * if start != 0:
  3801. * # Initial segment that wraps around
  3802. * i1, i2, ri1, ri2 = 0, start, start, indices[-1] # <<<<<<<<<<<<<<
  3803. * out.extend(
  3804. * iup_segment(
  3805. */
  3806. __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
  3807. __Pyx_INCREF(__pyx_t_4);
  3808. __pyx_t_5 = __pyx_v_start;
  3809. __Pyx_INCREF(__pyx_t_5);
  3810. __pyx_t_6 = __pyx_v_start;
  3811. __Pyx_INCREF(__pyx_t_6);
  3812. __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_indices, -1L, long, 1, __Pyx_PyLong_From_long, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 113, __pyx_L1_error)
  3813. __Pyx_GOTREF(__pyx_t_8);
  3814. __pyx_v_i1 = __pyx_t_4;
  3815. __pyx_t_4 = 0;
  3816. __pyx_v_i2 = __pyx_t_5;
  3817. __pyx_t_5 = 0;
  3818. __pyx_v_ri1 = __pyx_t_6;
  3819. __pyx_t_6 = 0;
  3820. __pyx_v_ri2 = __pyx_t_8;
  3821. __pyx_t_8 = 0;
  3822. /* "fontTools/varLib/iup.py":116
  3823. * out.extend(
  3824. * iup_segment(
  3825. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  3826. * )
  3827. * )
  3828. */
  3829. __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_i1, &__pyx_v_i2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 116, __pyx_L1_error)
  3830. __Pyx_GOTREF(__pyx_t_8);
  3831. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error)
  3832. __Pyx_GOTREF(__pyx_t_6);
  3833. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error)
  3834. __Pyx_GOTREF(__pyx_t_5);
  3835. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  3836. __Pyx_GOTREF(__pyx_t_4);
  3837. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 116, __pyx_L1_error)
  3838. __Pyx_GOTREF(__pyx_t_10);
  3839. /* "fontTools/varLib/iup.py":115
  3840. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3841. * out.extend(
  3842. * iup_segment( # <<<<<<<<<<<<<<
  3843. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3844. * )
  3845. */
  3846. __pyx_t_11 = __pyx_f_9fontTools_6varLib_3iup_iup_segment(__pyx_t_8, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error)
  3847. __Pyx_GOTREF(__pyx_t_11);
  3848. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3849. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3850. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3851. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3852. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3853. /* "fontTools/varLib/iup.py":114
  3854. * # Initial segment that wraps around
  3855. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3856. * out.extend( # <<<<<<<<<<<<<<
  3857. * iup_segment(
  3858. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3859. */
  3860. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 114, __pyx_L1_error)
  3861. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3862. /* "fontTools/varLib/iup.py":111
  3863. * it = iter(indices)
  3864. * start = next(it)
  3865. * if start != 0: # <<<<<<<<<<<<<<
  3866. * # Initial segment that wraps around
  3867. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3868. */
  3869. }
  3870. /* "fontTools/varLib/iup.py":119
  3871. * )
  3872. * )
  3873. * out.append(deltas[start]) # <<<<<<<<<<<<<<
  3874. * for end in it:
  3875. * if end - start > 1:
  3876. */
  3877. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L1_error)
  3878. __Pyx_GOTREF(__pyx_t_11);
  3879. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error)
  3880. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3881. /* "fontTools/varLib/iup.py":120
  3882. * )
  3883. * out.append(deltas[start])
  3884. * for end in it: # <<<<<<<<<<<<<<
  3885. * if end - start > 1:
  3886. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3887. */
  3888. if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) {
  3889. __pyx_t_11 = __pyx_v_it; __Pyx_INCREF(__pyx_t_11);
  3890. __pyx_t_2 = 0;
  3891. __pyx_t_7 = NULL;
  3892. } else {
  3893. __pyx_t_2 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 120, __pyx_L1_error)
  3894. __Pyx_GOTREF(__pyx_t_11);
  3895. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
  3896. }
  3897. for (;;) {
  3898. if (likely(!__pyx_t_7)) {
  3899. if (likely(PyList_CheckExact(__pyx_t_11))) {
  3900. {
  3901. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  3902. #if !CYTHON_ASSUME_SAFE_SIZE
  3903. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 120, __pyx_L1_error)
  3904. #endif
  3905. if (__pyx_t_2 >= __pyx_temp) break;
  3906. }
  3907. __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  3908. ++__pyx_t_2;
  3909. } else {
  3910. {
  3911. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  3912. #if !CYTHON_ASSUME_SAFE_SIZE
  3913. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 120, __pyx_L1_error)
  3914. #endif
  3915. if (__pyx_t_2 >= __pyx_temp) break;
  3916. }
  3917. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3918. __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_2));
  3919. #else
  3920. __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2);
  3921. #endif
  3922. ++__pyx_t_2;
  3923. }
  3924. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error)
  3925. } else {
  3926. __pyx_t_10 = __pyx_t_7(__pyx_t_11);
  3927. if (unlikely(!__pyx_t_10)) {
  3928. PyObject* exc_type = PyErr_Occurred();
  3929. if (exc_type) {
  3930. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 120, __pyx_L1_error)
  3931. PyErr_Clear();
  3932. }
  3933. break;
  3934. }
  3935. }
  3936. __Pyx_GOTREF(__pyx_t_10);
  3937. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_10);
  3938. __pyx_t_10 = 0;
  3939. /* "fontTools/varLib/iup.py":121
  3940. * out.append(deltas[start])
  3941. * for end in it:
  3942. * if end - start > 1: # <<<<<<<<<<<<<<
  3943. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3944. * out.extend(
  3945. */
  3946. __pyx_t_10 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error)
  3947. __Pyx_GOTREF(__pyx_t_10);
  3948. __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, __pyx_mstate_global->__pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  3949. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3950. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  3951. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3952. if (__pyx_t_9) {
  3953. /* "fontTools/varLib/iup.py":122
  3954. * for end in it:
  3955. * if end - start > 1:
  3956. * i1, i2, ri1, ri2 = start + 1, end, start, end # <<<<<<<<<<<<<<
  3957. * out.extend(
  3958. * iup_segment(
  3959. */
  3960. __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
  3961. __Pyx_GOTREF(__pyx_t_4);
  3962. __pyx_t_10 = __pyx_v_end;
  3963. __Pyx_INCREF(__pyx_t_10);
  3964. __pyx_t_5 = __pyx_v_start;
  3965. __Pyx_INCREF(__pyx_t_5);
  3966. __pyx_t_6 = __pyx_v_end;
  3967. __Pyx_INCREF(__pyx_t_6);
  3968. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_4);
  3969. __pyx_t_4 = 0;
  3970. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_10);
  3971. __pyx_t_10 = 0;
  3972. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_5);
  3973. __pyx_t_5 = 0;
  3974. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_6);
  3975. __pyx_t_6 = 0;
  3976. /* "fontTools/varLib/iup.py":125
  3977. * out.extend(
  3978. * iup_segment(
  3979. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  3980. * )
  3981. * )
  3982. */
  3983. __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_i1, &__pyx_v_i2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
  3984. __Pyx_GOTREF(__pyx_t_6);
  3985. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
  3986. __Pyx_GOTREF(__pyx_t_5);
  3987. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 125, __pyx_L1_error)
  3988. __Pyx_GOTREF(__pyx_t_10);
  3989. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error)
  3990. __Pyx_GOTREF(__pyx_t_4);
  3991. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
  3992. __Pyx_GOTREF(__pyx_t_8);
  3993. /* "fontTools/varLib/iup.py":124
  3994. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3995. * out.extend(
  3996. * iup_segment( # <<<<<<<<<<<<<<
  3997. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3998. * )
  3999. */
  4000. __pyx_t_13 = __pyx_f_9fontTools_6varLib_3iup_iup_segment(__pyx_t_6, __pyx_t_5, __pyx_t_10, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 124, __pyx_L1_error)
  4001. __Pyx_GOTREF(__pyx_t_13);
  4002. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4003. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4004. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4005. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4006. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4007. /* "fontTools/varLib/iup.py":123
  4008. * if end - start > 1:
  4009. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4010. * out.extend( # <<<<<<<<<<<<<<
  4011. * iup_segment(
  4012. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4013. */
  4014. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error)
  4015. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4016. /* "fontTools/varLib/iup.py":121
  4017. * out.append(deltas[start])
  4018. * for end in it:
  4019. * if end - start > 1: # <<<<<<<<<<<<<<
  4020. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4021. * out.extend(
  4022. */
  4023. }
  4024. /* "fontTools/varLib/iup.py":128
  4025. * )
  4026. * )
  4027. * out.append(deltas[end]) # <<<<<<<<<<<<<<
  4028. * start = end
  4029. * if start != n - 1:
  4030. */
  4031. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_end); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 128, __pyx_L1_error)
  4032. __Pyx_GOTREF(__pyx_t_13);
  4033. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 128, __pyx_L1_error)
  4034. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4035. /* "fontTools/varLib/iup.py":129
  4036. * )
  4037. * out.append(deltas[end])
  4038. * start = end # <<<<<<<<<<<<<<
  4039. * if start != n - 1:
  4040. * # Final segment that wraps around
  4041. */
  4042. __Pyx_INCREF(__pyx_v_end);
  4043. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4044. /* "fontTools/varLib/iup.py":120
  4045. * )
  4046. * out.append(deltas[start])
  4047. * for end in it: # <<<<<<<<<<<<<<
  4048. * if end - start > 1:
  4049. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4050. */
  4051. }
  4052. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4053. /* "fontTools/varLib/iup.py":130
  4054. * out.append(deltas[end])
  4055. * start = end
  4056. * if start != n - 1: # <<<<<<<<<<<<<<
  4057. * # Final segment that wraps around
  4058. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4059. */
  4060. __pyx_t_11 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 130, __pyx_L1_error)
  4061. __Pyx_GOTREF(__pyx_t_11);
  4062. __pyx_t_13 = PyObject_RichCompare(__pyx_v_start, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 130, __pyx_L1_error)
  4063. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4064. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 130, __pyx_L1_error)
  4065. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4066. if (__pyx_t_9) {
  4067. /* "fontTools/varLib/iup.py":132
  4068. * if start != n - 1:
  4069. * # Final segment that wraps around
  4070. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0] # <<<<<<<<<<<<<<
  4071. * out.extend(
  4072. * iup_segment(
  4073. */
  4074. __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 132, __pyx_L1_error)
  4075. __Pyx_GOTREF(__pyx_t_13);
  4076. __pyx_t_11 = __pyx_v_n;
  4077. __Pyx_INCREF(__pyx_t_11);
  4078. __pyx_t_8 = __pyx_v_start;
  4079. __Pyx_INCREF(__pyx_t_8);
  4080. __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indices, 0, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error)
  4081. __Pyx_GOTREF(__pyx_t_4);
  4082. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_13);
  4083. __pyx_t_13 = 0;
  4084. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_11);
  4085. __pyx_t_11 = 0;
  4086. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_8);
  4087. __pyx_t_8 = 0;
  4088. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_4);
  4089. __pyx_t_4 = 0;
  4090. /* "fontTools/varLib/iup.py":135
  4091. * out.extend(
  4092. * iup_segment(
  4093. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  4094. * )
  4095. * )
  4096. */
  4097. __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_i1, &__pyx_v_i2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
  4098. __Pyx_GOTREF(__pyx_t_4);
  4099. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 135, __pyx_L1_error)
  4100. __Pyx_GOTREF(__pyx_t_8);
  4101. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
  4102. __Pyx_GOTREF(__pyx_t_11);
  4103. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 135, __pyx_L1_error)
  4104. __Pyx_GOTREF(__pyx_t_13);
  4105. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
  4106. __Pyx_GOTREF(__pyx_t_10);
  4107. /* "fontTools/varLib/iup.py":134
  4108. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4109. * out.extend(
  4110. * iup_segment( # <<<<<<<<<<<<<<
  4111. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4112. * )
  4113. */
  4114. __pyx_t_5 = __pyx_f_9fontTools_6varLib_3iup_iup_segment(__pyx_t_4, __pyx_t_8, __pyx_t_11, __pyx_t_13, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error)
  4115. __Pyx_GOTREF(__pyx_t_5);
  4116. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4117. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4118. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4119. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4120. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4121. /* "fontTools/varLib/iup.py":133
  4122. * # Final segment that wraps around
  4123. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4124. * out.extend( # <<<<<<<<<<<<<<
  4125. * iup_segment(
  4126. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4127. */
  4128. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_5); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 133, __pyx_L1_error)
  4129. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4130. /* "fontTools/varLib/iup.py":130
  4131. * out.append(deltas[end])
  4132. * start = end
  4133. * if start != n - 1: # <<<<<<<<<<<<<<
  4134. * # Final segment that wraps around
  4135. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4136. */
  4137. }
  4138. /* "fontTools/varLib/iup.py":139
  4139. * )
  4140. *
  4141. * assert len(deltas) == len(out), (len(deltas), len(out)) # <<<<<<<<<<<<<<
  4142. * return out
  4143. *
  4144. */
  4145. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4146. if (unlikely(__pyx_assertions_enabled())) {
  4147. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4148. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_out); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4149. __pyx_t_9 = (__pyx_t_2 == __pyx_t_1);
  4150. if (unlikely(!__pyx_t_9)) {
  4151. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4152. __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
  4153. __Pyx_GOTREF(__pyx_t_5);
  4154. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_out); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4155. __pyx_t_10 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error)
  4156. __Pyx_GOTREF(__pyx_t_10);
  4157. __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error)
  4158. __Pyx_GOTREF(__pyx_t_13);
  4159. __Pyx_GIVEREF(__pyx_t_5);
  4160. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 139, __pyx_L1_error);
  4161. __Pyx_GIVEREF(__pyx_t_10);
  4162. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 139, __pyx_L1_error);
  4163. __pyx_t_5 = 0;
  4164. __pyx_t_10 = 0;
  4165. __pyx_t_10 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error)
  4166. __Pyx_GOTREF(__pyx_t_10);
  4167. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4168. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_10, 0, 0);
  4169. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4170. __PYX_ERR(0, 139, __pyx_L1_error)
  4171. }
  4172. }
  4173. #else
  4174. if ((1)); else __PYX_ERR(0, 139, __pyx_L1_error)
  4175. #endif
  4176. /* "fontTools/varLib/iup.py":140
  4177. *
  4178. * assert len(deltas) == len(out), (len(deltas), len(out))
  4179. * return out # <<<<<<<<<<<<<<
  4180. *
  4181. *
  4182. */
  4183. __Pyx_XDECREF(__pyx_r);
  4184. __Pyx_INCREF(__pyx_v_out);
  4185. __pyx_r = __pyx_v_out;
  4186. goto __pyx_L0;
  4187. /* "fontTools/varLib/iup.py":91
  4188. *
  4189. *
  4190. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  4191. * """For the contour given in `coords`, interpolate any missing
  4192. * delta values in delta vector `deltas`.
  4193. */
  4194. /* function exit code */
  4195. __pyx_L1_error:;
  4196. __Pyx_XDECREF(__pyx_t_4);
  4197. __Pyx_XDECREF(__pyx_t_5);
  4198. __Pyx_XDECREF(__pyx_t_6);
  4199. __Pyx_XDECREF(__pyx_t_8);
  4200. __Pyx_XDECREF(__pyx_t_10);
  4201. __Pyx_XDECREF(__pyx_t_11);
  4202. __Pyx_XDECREF(__pyx_t_13);
  4203. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4204. __pyx_r = NULL;
  4205. __pyx_L0:;
  4206. __Pyx_XDECREF(__pyx_v_n);
  4207. __Pyx_XDECREF(__pyx_v_indices);
  4208. __Pyx_XDECREF(__pyx_v_out);
  4209. __Pyx_XDECREF(__pyx_v_it);
  4210. __Pyx_XDECREF(__pyx_v_start);
  4211. __Pyx_XDECREF(__pyx_v_i1);
  4212. __Pyx_XDECREF(__pyx_v_i2);
  4213. __Pyx_XDECREF(__pyx_v_ri1);
  4214. __Pyx_XDECREF(__pyx_v_ri2);
  4215. __Pyx_XDECREF(__pyx_v_end);
  4216. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
  4217. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v);
  4218. __Pyx_XGIVEREF(__pyx_r);
  4219. __Pyx_RefNannyFinishContext();
  4220. return __pyx_r;
  4221. }
  4222. /* "fontTools/varLib/iup.py":143
  4223. *
  4224. *
  4225. * def iup_delta( # <<<<<<<<<<<<<<
  4226. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4227. * ) -> _DeltaSegment:
  4228. */
  4229. /* Python wrapper */
  4230. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_3iup_delta(PyObject *__pyx_self,
  4231. #if CYTHON_METH_FASTCALL
  4232. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4233. #else
  4234. PyObject *__pyx_args, PyObject *__pyx_kwds
  4235. #endif
  4236. ); /*proto*/
  4237. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_2iup_delta, "iup_delta(deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints) -> _DeltaSegment\n\nFor the outline given in `coords`, with contour endpoints given\nin sorted increasing order in `ends`, interpolate any missing\ndelta values in delta vector `deltas`.\n\nReturns fully filled-out delta vector.");
  4238. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_3iup_delta = {"iup_delta", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_3iup_delta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_2iup_delta};
  4239. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_3iup_delta(PyObject *__pyx_self,
  4240. #if CYTHON_METH_FASTCALL
  4241. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4242. #else
  4243. PyObject *__pyx_args, PyObject *__pyx_kwds
  4244. #endif
  4245. ) {
  4246. PyObject *__pyx_v_deltas = 0;
  4247. PyObject *__pyx_v_coords = 0;
  4248. PyObject *__pyx_v_ends = 0;
  4249. #if !CYTHON_METH_FASTCALL
  4250. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4251. #endif
  4252. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4253. PyObject* values[3] = {0,0,0};
  4254. int __pyx_lineno = 0;
  4255. const char *__pyx_filename = NULL;
  4256. int __pyx_clineno = 0;
  4257. PyObject *__pyx_r = 0;
  4258. __Pyx_RefNannyDeclarations
  4259. __Pyx_RefNannySetupContext("iup_delta (wrapper)", 0);
  4260. #if !CYTHON_METH_FASTCALL
  4261. #if CYTHON_ASSUME_SAFE_SIZE
  4262. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4263. #else
  4264. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4265. #endif
  4266. #endif
  4267. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4268. {
  4269. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,&__pyx_mstate_global->__pyx_n_u_ends,0};
  4270. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4271. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 143, __pyx_L3_error)
  4272. if (__pyx_kwds_len > 0) {
  4273. switch (__pyx_nargs) {
  4274. case 3:
  4275. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4276. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 143, __pyx_L3_error)
  4277. CYTHON_FALLTHROUGH;
  4278. case 2:
  4279. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4280. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 143, __pyx_L3_error)
  4281. CYTHON_FALLTHROUGH;
  4282. case 1:
  4283. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4284. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 143, __pyx_L3_error)
  4285. CYTHON_FALLTHROUGH;
  4286. case 0: break;
  4287. default: goto __pyx_L5_argtuple_error;
  4288. }
  4289. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4290. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iup_delta", 0) < (0)) __PYX_ERR(0, 143, __pyx_L3_error)
  4291. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  4292. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, i); __PYX_ERR(0, 143, __pyx_L3_error) }
  4293. }
  4294. } else if (unlikely(__pyx_nargs != 3)) {
  4295. goto __pyx_L5_argtuple_error;
  4296. } else {
  4297. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4298. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 143, __pyx_L3_error)
  4299. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4300. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 143, __pyx_L3_error)
  4301. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4302. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 143, __pyx_L3_error)
  4303. }
  4304. __pyx_v_deltas = values[0];
  4305. __pyx_v_coords = values[1];
  4306. __pyx_v_ends = values[2];
  4307. }
  4308. goto __pyx_L6_skip;
  4309. __pyx_L5_argtuple_error:;
  4310. __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 143, __pyx_L3_error)
  4311. __pyx_L6_skip:;
  4312. goto __pyx_L4_argument_unpacking_done;
  4313. __pyx_L3_error:;
  4314. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4315. Py_XDECREF(values[__pyx_temp]);
  4316. }
  4317. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4318. __Pyx_RefNannyFinishContext();
  4319. return NULL;
  4320. __pyx_L4_argument_unpacking_done:;
  4321. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_2iup_delta(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends);
  4322. /* function exit code */
  4323. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4324. Py_XDECREF(values[__pyx_temp]);
  4325. }
  4326. __Pyx_RefNannyFinishContext();
  4327. return __pyx_r;
  4328. }
  4329. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_2iup_delta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_ends) {
  4330. PyObject *__pyx_v_n = NULL;
  4331. PyObject *__pyx_v_out = NULL;
  4332. PyObject *__pyx_v_start = NULL;
  4333. PyObject *__pyx_v_end = NULL;
  4334. PyObject *__pyx_v_contour = NULL;
  4335. PyObject *__pyx_r = NULL;
  4336. __Pyx_RefNannyDeclarations
  4337. int __pyx_t_1;
  4338. PyObject *__pyx_t_2 = NULL;
  4339. PyObject *__pyx_t_3 = NULL;
  4340. int __pyx_t_4;
  4341. Py_ssize_t __pyx_t_5;
  4342. PyObject *__pyx_t_6 = NULL;
  4343. PyObject *__pyx_t_7 = NULL;
  4344. PyObject *__pyx_t_8 = NULL;
  4345. PyObject *(*__pyx_t_9)(PyObject *);
  4346. PyObject *__pyx_t_10 = NULL;
  4347. size_t __pyx_t_11;
  4348. int __pyx_t_12;
  4349. int __pyx_lineno = 0;
  4350. const char *__pyx_filename = NULL;
  4351. int __pyx_clineno = 0;
  4352. __Pyx_RefNannySetupContext("iup_delta", 0);
  4353. __Pyx_INCREF(__pyx_v_ends);
  4354. /* "fontTools/varLib/iup.py":152
  4355. * Returns fully filled-out delta vector."""
  4356. *
  4357. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  4358. * n = len(coords)
  4359. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4360. */
  4361. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4362. if (unlikely(__pyx_assertions_enabled())) {
  4363. __pyx_t_2 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
  4364. __Pyx_GOTREF(__pyx_t_2);
  4365. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4366. __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_ends, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
  4367. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4368. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4369. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4370. if (__pyx_t_4) {
  4371. } else {
  4372. __pyx_t_1 = __pyx_t_4;
  4373. goto __pyx_L3_bool_binop_done;
  4374. }
  4375. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 152, __pyx_L1_error)
  4376. __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
  4377. __Pyx_GOTREF(__pyx_t_3);
  4378. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4379. if (__pyx_t_4) {
  4380. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_ends, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 152, __pyx_L1_error)
  4381. __Pyx_GOTREF(__pyx_t_6);
  4382. __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error)
  4383. __Pyx_GOTREF(__pyx_t_7);
  4384. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4385. __pyx_t_2 = __pyx_t_7;
  4386. __pyx_t_7 = 0;
  4387. } else {
  4388. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  4389. __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  4390. }
  4391. __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error)
  4392. __Pyx_GOTREF(__pyx_t_7);
  4393. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4394. __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
  4395. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4396. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4397. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4398. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4399. __pyx_t_1 = __pyx_t_4;
  4400. __pyx_L3_bool_binop_done:;
  4401. if (unlikely(!__pyx_t_1)) {
  4402. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  4403. __PYX_ERR(0, 152, __pyx_L1_error)
  4404. }
  4405. }
  4406. #else
  4407. if ((1)); else __PYX_ERR(0, 152, __pyx_L1_error)
  4408. #endif
  4409. /* "fontTools/varLib/iup.py":153
  4410. *
  4411. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4412. * n = len(coords) # <<<<<<<<<<<<<<
  4413. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4414. * out = []
  4415. */
  4416. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 153, __pyx_L1_error)
  4417. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  4418. __Pyx_GOTREF(__pyx_t_2);
  4419. __pyx_v_n = __pyx_t_2;
  4420. __pyx_t_2 = 0;
  4421. /* "fontTools/varLib/iup.py":154
  4422. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4423. * n = len(coords)
  4424. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  4425. * out = []
  4426. * start = 0
  4427. */
  4428. __pyx_t_2 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
  4429. __Pyx_GOTREF(__pyx_t_2);
  4430. __pyx_t_7 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error)
  4431. __Pyx_GOTREF(__pyx_t_7);
  4432. __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
  4433. __Pyx_GOTREF(__pyx_t_3);
  4434. __pyx_t_6 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
  4435. __Pyx_GOTREF(__pyx_t_6);
  4436. __pyx_t_8 = PyList_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __pyx_L1_error)
  4437. __Pyx_GOTREF(__pyx_t_8);
  4438. __Pyx_GIVEREF(__pyx_t_2);
  4439. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4440. __Pyx_GIVEREF(__pyx_t_7);
  4441. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4442. __Pyx_GIVEREF(__pyx_t_3);
  4443. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4444. __Pyx_GIVEREF(__pyx_t_6);
  4445. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4446. __pyx_t_2 = 0;
  4447. __pyx_t_7 = 0;
  4448. __pyx_t_3 = 0;
  4449. __pyx_t_6 = 0;
  4450. __pyx_t_6 = PyNumber_Add(__pyx_v_ends, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
  4451. __Pyx_GOTREF(__pyx_t_6);
  4452. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4453. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_6);
  4454. __pyx_t_6 = 0;
  4455. /* "fontTools/varLib/iup.py":155
  4456. * n = len(coords)
  4457. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4458. * out = [] # <<<<<<<<<<<<<<
  4459. * start = 0
  4460. * for end in ends:
  4461. */
  4462. __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error)
  4463. __Pyx_GOTREF(__pyx_t_6);
  4464. __pyx_v_out = ((PyObject*)__pyx_t_6);
  4465. __pyx_t_6 = 0;
  4466. /* "fontTools/varLib/iup.py":156
  4467. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4468. * out = []
  4469. * start = 0 # <<<<<<<<<<<<<<
  4470. * for end in ends:
  4471. * end += 1
  4472. */
  4473. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  4474. __pyx_v_start = __pyx_mstate_global->__pyx_int_0;
  4475. /* "fontTools/varLib/iup.py":157
  4476. * out = []
  4477. * start = 0
  4478. * for end in ends: # <<<<<<<<<<<<<<
  4479. * end += 1
  4480. * contour = iup_contour(deltas[start:end], coords[start:end])
  4481. */
  4482. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  4483. __pyx_t_6 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_6);
  4484. __pyx_t_5 = 0;
  4485. __pyx_t_9 = NULL;
  4486. } else {
  4487. __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
  4488. __Pyx_GOTREF(__pyx_t_6);
  4489. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 157, __pyx_L1_error)
  4490. }
  4491. for (;;) {
  4492. if (likely(!__pyx_t_9)) {
  4493. if (likely(PyList_CheckExact(__pyx_t_6))) {
  4494. {
  4495. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  4496. #if !CYTHON_ASSUME_SAFE_SIZE
  4497. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 157, __pyx_L1_error)
  4498. #endif
  4499. if (__pyx_t_5 >= __pyx_temp) break;
  4500. }
  4501. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
  4502. ++__pyx_t_5;
  4503. } else {
  4504. {
  4505. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  4506. #if !CYTHON_ASSUME_SAFE_SIZE
  4507. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 157, __pyx_L1_error)
  4508. #endif
  4509. if (__pyx_t_5 >= __pyx_temp) break;
  4510. }
  4511. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4512. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5));
  4513. #else
  4514. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_5);
  4515. #endif
  4516. ++__pyx_t_5;
  4517. }
  4518. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error)
  4519. } else {
  4520. __pyx_t_8 = __pyx_t_9(__pyx_t_6);
  4521. if (unlikely(!__pyx_t_8)) {
  4522. PyObject* exc_type = PyErr_Occurred();
  4523. if (exc_type) {
  4524. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 157, __pyx_L1_error)
  4525. PyErr_Clear();
  4526. }
  4527. break;
  4528. }
  4529. }
  4530. __Pyx_GOTREF(__pyx_t_8);
  4531. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_8);
  4532. __pyx_t_8 = 0;
  4533. /* "fontTools/varLib/iup.py":158
  4534. * start = 0
  4535. * for end in ends:
  4536. * end += 1 # <<<<<<<<<<<<<<
  4537. * contour = iup_contour(deltas[start:end], coords[start:end])
  4538. * out.extend(contour)
  4539. */
  4540. __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_v_end, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 158, __pyx_L1_error)
  4541. __Pyx_GOTREF(__pyx_t_8);
  4542. __Pyx_DECREF_SET(__pyx_v_end, __pyx_t_8);
  4543. __pyx_t_8 = 0;
  4544. /* "fontTools/varLib/iup.py":159
  4545. * for end in ends:
  4546. * end += 1
  4547. * contour = iup_contour(deltas[start:end], coords[start:end]) # <<<<<<<<<<<<<<
  4548. * out.extend(contour)
  4549. * start = end
  4550. */
  4551. __pyx_t_3 = NULL;
  4552. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_iup_contour); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error)
  4553. __Pyx_GOTREF(__pyx_t_7);
  4554. __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_deltas, 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
  4555. __Pyx_GOTREF(__pyx_t_2);
  4556. __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 159, __pyx_L1_error)
  4557. __Pyx_GOTREF(__pyx_t_10);
  4558. __pyx_t_11 = 1;
  4559. #if CYTHON_UNPACK_METHODS
  4560. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  4561. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
  4562. assert(__pyx_t_3);
  4563. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  4564. __Pyx_INCREF(__pyx_t_3);
  4565. __Pyx_INCREF(__pyx__function);
  4566. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  4567. __pyx_t_11 = 0;
  4568. }
  4569. #endif
  4570. {
  4571. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_10};
  4572. __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4573. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4574. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4575. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4576. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4577. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 159, __pyx_L1_error)
  4578. __Pyx_GOTREF(__pyx_t_8);
  4579. }
  4580. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_8);
  4581. __pyx_t_8 = 0;
  4582. /* "fontTools/varLib/iup.py":160
  4583. * end += 1
  4584. * contour = iup_contour(deltas[start:end], coords[start:end])
  4585. * out.extend(contour) # <<<<<<<<<<<<<<
  4586. * start = end
  4587. *
  4588. */
  4589. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_v_contour); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 160, __pyx_L1_error)
  4590. /* "fontTools/varLib/iup.py":161
  4591. * contour = iup_contour(deltas[start:end], coords[start:end])
  4592. * out.extend(contour)
  4593. * start = end # <<<<<<<<<<<<<<
  4594. *
  4595. * return out
  4596. */
  4597. __Pyx_INCREF(__pyx_v_end);
  4598. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4599. /* "fontTools/varLib/iup.py":157
  4600. * out = []
  4601. * start = 0
  4602. * for end in ends: # <<<<<<<<<<<<<<
  4603. * end += 1
  4604. * contour = iup_contour(deltas[start:end], coords[start:end])
  4605. */
  4606. }
  4607. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4608. /* "fontTools/varLib/iup.py":163
  4609. * start = end
  4610. *
  4611. * return out # <<<<<<<<<<<<<<
  4612. *
  4613. *
  4614. */
  4615. __Pyx_XDECREF(__pyx_r);
  4616. __Pyx_INCREF(__pyx_v_out);
  4617. __pyx_r = __pyx_v_out;
  4618. goto __pyx_L0;
  4619. /* "fontTools/varLib/iup.py":143
  4620. *
  4621. *
  4622. * def iup_delta( # <<<<<<<<<<<<<<
  4623. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4624. * ) -> _DeltaSegment:
  4625. */
  4626. /* function exit code */
  4627. __pyx_L1_error:;
  4628. __Pyx_XDECREF(__pyx_t_2);
  4629. __Pyx_XDECREF(__pyx_t_3);
  4630. __Pyx_XDECREF(__pyx_t_6);
  4631. __Pyx_XDECREF(__pyx_t_7);
  4632. __Pyx_XDECREF(__pyx_t_8);
  4633. __Pyx_XDECREF(__pyx_t_10);
  4634. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4635. __pyx_r = NULL;
  4636. __pyx_L0:;
  4637. __Pyx_XDECREF(__pyx_v_n);
  4638. __Pyx_XDECREF(__pyx_v_out);
  4639. __Pyx_XDECREF(__pyx_v_start);
  4640. __Pyx_XDECREF(__pyx_v_end);
  4641. __Pyx_XDECREF(__pyx_v_contour);
  4642. __Pyx_XDECREF(__pyx_v_ends);
  4643. __Pyx_XGIVEREF(__pyx_r);
  4644. __Pyx_RefNannyFinishContext();
  4645. return __pyx_r;
  4646. }
  4647. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  4648. /* "fontTools/varLib/iup.py":197
  4649. *
  4650. * return all(
  4651. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4652. * for (x, y), (p, q) in zip(deltas, interp)
  4653. * )
  4654. */
  4655. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  4656. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  4657. PyObject *__pyx_r = NULL;
  4658. __Pyx_RefNannyDeclarations
  4659. int __pyx_lineno = 0;
  4660. const char *__pyx_filename = NULL;
  4661. int __pyx_clineno = 0;
  4662. __Pyx_RefNannySetupContext("genexpr", 0);
  4663. __pyx_cur_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  4664. if (unlikely(!__pyx_cur_scope)) {
  4665. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)Py_None);
  4666. __Pyx_INCREF(Py_None);
  4667. __PYX_ERR(0, 197, __pyx_L1_error)
  4668. } else {
  4669. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  4670. }
  4671. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *) __pyx_self;
  4672. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4673. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4674. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  4675. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4676. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4677. {
  4678. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_can_iup_in_between_locals_genexp, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 197, __pyx_L1_error)
  4679. __Pyx_DECREF(__pyx_cur_scope);
  4680. __Pyx_RefNannyFinishContext();
  4681. return (PyObject *) gen;
  4682. }
  4683. /* function exit code */
  4684. __pyx_L1_error:;
  4685. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4686. __pyx_r = NULL;
  4687. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  4688. __Pyx_XGIVEREF(__pyx_r);
  4689. __Pyx_RefNannyFinishContext();
  4690. return __pyx_r;
  4691. }
  4692. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  4693. {
  4694. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  4695. PyObject *__pyx_r = NULL;
  4696. PyObject *__pyx_t_1 = NULL;
  4697. Py_ssize_t __pyx_t_2;
  4698. PyObject *(*__pyx_t_3)(PyObject *);
  4699. PyObject *__pyx_t_4 = NULL;
  4700. PyObject *__pyx_t_5 = NULL;
  4701. PyObject *__pyx_t_6 = NULL;
  4702. PyObject *__pyx_t_7 = NULL;
  4703. PyObject *(*__pyx_t_8)(PyObject *);
  4704. PyObject *__pyx_t_9 = NULL;
  4705. PyObject *__pyx_t_10 = NULL;
  4706. double __pyx_t_11;
  4707. double __pyx_t_12;
  4708. size_t __pyx_t_13;
  4709. int __pyx_t_14;
  4710. int __pyx_t_15;
  4711. int __pyx_lineno = 0;
  4712. const char *__pyx_filename = NULL;
  4713. int __pyx_clineno = 0;
  4714. __Pyx_RefNannyDeclarations
  4715. __Pyx_RefNannySetupContext("genexpr", 0);
  4716. switch (__pyx_generator->resume_label) {
  4717. case 0: goto __pyx_L3_first_run;
  4718. default: /* CPython raises the right error here */
  4719. __Pyx_RefNannyFinishContext();
  4720. return NULL;
  4721. }
  4722. __pyx_L3_first_run:;
  4723. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 197, __pyx_L1_error)
  4724. /* "fontTools/varLib/iup.py":198
  4725. * return all(
  4726. * abs(complex(x - p, y - q)) <= tolerance
  4727. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  4728. * )
  4729. *
  4730. */
  4731. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 198, __pyx_L1_error) }
  4732. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  4733. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  4734. __pyx_t_2 = 0;
  4735. __pyx_t_3 = NULL;
  4736. } else {
  4737. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  4738. __Pyx_GOTREF(__pyx_t_1);
  4739. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
  4740. }
  4741. for (;;) {
  4742. if (likely(!__pyx_t_3)) {
  4743. if (likely(PyList_CheckExact(__pyx_t_1))) {
  4744. {
  4745. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  4746. #if !CYTHON_ASSUME_SAFE_SIZE
  4747. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error)
  4748. #endif
  4749. if (__pyx_t_2 >= __pyx_temp) break;
  4750. }
  4751. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  4752. ++__pyx_t_2;
  4753. } else {
  4754. {
  4755. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  4756. #if !CYTHON_ASSUME_SAFE_SIZE
  4757. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error)
  4758. #endif
  4759. if (__pyx_t_2 >= __pyx_temp) break;
  4760. }
  4761. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4762. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  4763. #else
  4764. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  4765. #endif
  4766. ++__pyx_t_2;
  4767. }
  4768. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error)
  4769. } else {
  4770. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  4771. if (unlikely(!__pyx_t_4)) {
  4772. PyObject* exc_type = PyErr_Occurred();
  4773. if (exc_type) {
  4774. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 198, __pyx_L1_error)
  4775. PyErr_Clear();
  4776. }
  4777. break;
  4778. }
  4779. }
  4780. __Pyx_GOTREF(__pyx_t_4);
  4781. if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
  4782. PyObject* sequence = __pyx_t_4;
  4783. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4784. if (unlikely(size != 2)) {
  4785. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4786. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4787. __PYX_ERR(0, 198, __pyx_L1_error)
  4788. }
  4789. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4790. if (likely(PyTuple_CheckExact(sequence))) {
  4791. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  4792. __Pyx_INCREF(__pyx_t_5);
  4793. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  4794. __Pyx_INCREF(__pyx_t_6);
  4795. } else {
  4796. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4797. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  4798. __Pyx_XGOTREF(__pyx_t_5);
  4799. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4800. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
  4801. __Pyx_XGOTREF(__pyx_t_6);
  4802. }
  4803. #else
  4804. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  4805. __Pyx_GOTREF(__pyx_t_5);
  4806. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
  4807. __Pyx_GOTREF(__pyx_t_6);
  4808. #endif
  4809. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4810. } else {
  4811. Py_ssize_t index = -1;
  4812. __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4813. __Pyx_GOTREF(__pyx_t_7);
  4814. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4815. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  4816. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
  4817. __Pyx_GOTREF(__pyx_t_5);
  4818. index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
  4819. __Pyx_GOTREF(__pyx_t_6);
  4820. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4821. __pyx_t_8 = NULL;
  4822. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4823. goto __pyx_L7_unpacking_done;
  4824. __pyx_L6_unpacking_failed:;
  4825. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4826. __pyx_t_8 = NULL;
  4827. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4828. __PYX_ERR(0, 198, __pyx_L1_error)
  4829. __pyx_L7_unpacking_done:;
  4830. }
  4831. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  4832. PyObject* sequence = __pyx_t_5;
  4833. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4834. if (unlikely(size != 2)) {
  4835. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4836. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4837. __PYX_ERR(0, 198, __pyx_L1_error)
  4838. }
  4839. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4840. if (likely(PyTuple_CheckExact(sequence))) {
  4841. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  4842. __Pyx_INCREF(__pyx_t_7);
  4843. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  4844. __Pyx_INCREF(__pyx_t_9);
  4845. } else {
  4846. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4847. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4848. __Pyx_XGOTREF(__pyx_t_7);
  4849. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4850. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4851. __Pyx_XGOTREF(__pyx_t_9);
  4852. }
  4853. #else
  4854. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4855. __Pyx_GOTREF(__pyx_t_7);
  4856. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4857. __Pyx_GOTREF(__pyx_t_9);
  4858. #endif
  4859. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4860. } else {
  4861. Py_ssize_t index = -1;
  4862. __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 198, __pyx_L1_error)
  4863. __Pyx_GOTREF(__pyx_t_10);
  4864. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4865. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  4866. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
  4867. __Pyx_GOTREF(__pyx_t_7);
  4868. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
  4869. __Pyx_GOTREF(__pyx_t_9);
  4870. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4871. __pyx_t_8 = NULL;
  4872. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4873. goto __pyx_L9_unpacking_done;
  4874. __pyx_L8_unpacking_failed:;
  4875. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4876. __pyx_t_8 = NULL;
  4877. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4878. __PYX_ERR(0, 198, __pyx_L1_error)
  4879. __pyx_L9_unpacking_done:;
  4880. }
  4881. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  4882. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4883. __pyx_t_12 = __Pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  4884. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4885. __pyx_cur_scope->__pyx_v_x = __pyx_t_11;
  4886. __pyx_cur_scope->__pyx_v_y = __pyx_t_12;
  4887. if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
  4888. PyObject* sequence = __pyx_t_6;
  4889. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4890. if (unlikely(size != 2)) {
  4891. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4892. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4893. __PYX_ERR(0, 198, __pyx_L1_error)
  4894. }
  4895. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4896. if (likely(PyTuple_CheckExact(sequence))) {
  4897. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  4898. __Pyx_INCREF(__pyx_t_9);
  4899. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  4900. __Pyx_INCREF(__pyx_t_7);
  4901. } else {
  4902. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4903. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4904. __Pyx_XGOTREF(__pyx_t_9);
  4905. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4906. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4907. __Pyx_XGOTREF(__pyx_t_7);
  4908. }
  4909. #else
  4910. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4911. __Pyx_GOTREF(__pyx_t_9);
  4912. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4913. __Pyx_GOTREF(__pyx_t_7);
  4914. #endif
  4915. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4916. } else {
  4917. Py_ssize_t index = -1;
  4918. __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 198, __pyx_L1_error)
  4919. __Pyx_GOTREF(__pyx_t_10);
  4920. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4921. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  4922. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
  4923. __Pyx_GOTREF(__pyx_t_9);
  4924. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
  4925. __Pyx_GOTREF(__pyx_t_7);
  4926. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4927. __pyx_t_8 = NULL;
  4928. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4929. goto __pyx_L11_unpacking_done;
  4930. __pyx_L10_unpacking_failed:;
  4931. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4932. __pyx_t_8 = NULL;
  4933. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4934. __PYX_ERR(0, 198, __pyx_L1_error)
  4935. __pyx_L11_unpacking_done:;
  4936. }
  4937. __pyx_t_12 = __Pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  4938. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4939. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
  4940. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4941. __pyx_cur_scope->__pyx_v_p = __pyx_t_12;
  4942. __pyx_cur_scope->__pyx_v_q = __pyx_t_11;
  4943. /* "fontTools/varLib/iup.py":197
  4944. *
  4945. * return all(
  4946. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4947. * for (x, y), (p, q) in zip(deltas, interp)
  4948. * )
  4949. */
  4950. __pyx_t_6 = NULL;
  4951. __pyx_t_5 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_x - __pyx_cur_scope->__pyx_v_p)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
  4952. __Pyx_GOTREF(__pyx_t_5);
  4953. __pyx_t_7 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_y - __pyx_cur_scope->__pyx_v_q)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
  4954. __Pyx_GOTREF(__pyx_t_7);
  4955. __pyx_t_13 = 1;
  4956. {
  4957. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_7};
  4958. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyComplex_Type), __pyx_callargs+__pyx_t_13, (3-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4959. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4960. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4961. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4962. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
  4963. __Pyx_GOTREF(__pyx_t_4);
  4964. }
  4965. __pyx_t_7 = __Pyx_PyNumber_Absolute(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
  4966. __Pyx_GOTREF(__pyx_t_7);
  4967. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4968. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 197, __pyx_L1_error) }
  4969. __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
  4970. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4971. __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 197, __pyx_L1_error)
  4972. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4973. __pyx_t_15 = (!__pyx_t_14);
  4974. if (__pyx_t_15) {
  4975. /* "fontTools/varLib/iup.py":196
  4976. * deltas = deltas[i + 1 : j]
  4977. *
  4978. * return all( # <<<<<<<<<<<<<<
  4979. * abs(complex(x - p, y - q)) <= tolerance
  4980. * for (x, y), (p, q) in zip(deltas, interp)
  4981. */
  4982. __Pyx_XDECREF(__pyx_r);
  4983. /* "fontTools/varLib/iup.py":197
  4984. *
  4985. * return all(
  4986. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4987. * for (x, y), (p, q) in zip(deltas, interp)
  4988. * )
  4989. */
  4990. __Pyx_INCREF(Py_False);
  4991. __pyx_r = Py_False;
  4992. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4993. goto __pyx_L0;
  4994. }
  4995. /* "fontTools/varLib/iup.py":198
  4996. * return all(
  4997. * abs(complex(x - p, y - q)) <= tolerance
  4998. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  4999. * )
  5000. *
  5001. */
  5002. }
  5003. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5004. /*else*/ {
  5005. /* "fontTools/varLib/iup.py":196
  5006. * deltas = deltas[i + 1 : j]
  5007. *
  5008. * return all( # <<<<<<<<<<<<<<
  5009. * abs(complex(x - p, y - q)) <= tolerance
  5010. * for (x, y), (p, q) in zip(deltas, interp)
  5011. */
  5012. __Pyx_XDECREF(__pyx_r);
  5013. /* "fontTools/varLib/iup.py":197
  5014. *
  5015. * return all(
  5016. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5017. * for (x, y), (p, q) in zip(deltas, interp)
  5018. * )
  5019. */
  5020. __Pyx_INCREF(Py_True);
  5021. __pyx_r = Py_True;
  5022. goto __pyx_L0;
  5023. }
  5024. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  5025. /* function exit code */
  5026. goto __pyx_L0;
  5027. __pyx_L1_error:;
  5028. __Pyx_XDECREF(__pyx_t_1);
  5029. __Pyx_XDECREF(__pyx_t_4);
  5030. __Pyx_XDECREF(__pyx_t_5);
  5031. __Pyx_XDECREF(__pyx_t_6);
  5032. __Pyx_XDECREF(__pyx_t_7);
  5033. __Pyx_XDECREF(__pyx_t_9);
  5034. __Pyx_XDECREF(__pyx_t_10);
  5035. if (__Pyx_PyErr_Occurred()) {
  5036. __Pyx_Generator_Replace_StopIteration(0);
  5037. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5038. }
  5039. __pyx_L0:;
  5040. __Pyx_XGIVEREF(__pyx_r);
  5041. #if !CYTHON_USE_EXC_INFO_STACK
  5042. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  5043. #endif
  5044. __pyx_generator->resume_label = -1;
  5045. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  5046. __Pyx_RefNannyFinishContext();
  5047. return __pyx_r;
  5048. }
  5049. /* "fontTools/varLib/iup.py":169
  5050. *
  5051. *
  5052. * @cython.cfunc # <<<<<<<<<<<<<<
  5053. * @cython.inline
  5054. * @cython.locals(
  5055. */
  5056. static CYTHON_INLINE int __pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_tolerance) {
  5057. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_cur_scope;
  5058. PyObject *__pyx_v_interp = NULL;
  5059. PyObject *__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator = 0;
  5060. int __pyx_r;
  5061. __Pyx_RefNannyDeclarations
  5062. int __pyx_t_1;
  5063. PyObject *__pyx_t_2 = NULL;
  5064. PyObject *__pyx_t_3 = NULL;
  5065. PyObject *__pyx_t_4 = NULL;
  5066. PyObject *__pyx_t_5 = NULL;
  5067. PyObject *__pyx_t_6 = NULL;
  5068. PyObject *__pyx_t_7 = NULL;
  5069. size_t __pyx_t_8;
  5070. int __pyx_t_9;
  5071. int __pyx_lineno = 0;
  5072. const char *__pyx_filename = NULL;
  5073. int __pyx_clineno = 0;
  5074. __Pyx_RefNannySetupContext("can_iup_in_between", 0);
  5075. __pyx_cur_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(__pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  5076. if (unlikely(!__pyx_cur_scope)) {
  5077. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)Py_None);
  5078. __Pyx_INCREF(Py_None);
  5079. __PYX_ERR(0, 169, __pyx_L1_error)
  5080. } else {
  5081. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  5082. }
  5083. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  5084. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  5085. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  5086. __Pyx_INCREF(__pyx_v_deltas);
  5087. /* "fontTools/varLib/iup.py":192
  5088. * provided error tolerance."""
  5089. *
  5090. * assert j - i >= 2 # <<<<<<<<<<<<<<
  5091. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5092. * deltas = deltas[i + 1 : j]
  5093. */
  5094. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5095. if (unlikely(__pyx_assertions_enabled())) {
  5096. __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) >= 2);
  5097. if (unlikely(!__pyx_t_1)) {
  5098. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  5099. __PYX_ERR(0, 192, __pyx_L1_error)
  5100. }
  5101. }
  5102. #else
  5103. if ((1)); else __PYX_ERR(0, 192, __pyx_L1_error)
  5104. #endif
  5105. /* "fontTools/varLib/iup.py":193
  5106. *
  5107. * assert j - i >= 2
  5108. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j]) # <<<<<<<<<<<<<<
  5109. * deltas = deltas[i + 1 : j]
  5110. *
  5111. */
  5112. __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_coords, (__pyx_v_i + 1), __pyx_v_j, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
  5113. __Pyx_GOTREF(__pyx_t_2);
  5114. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_coords, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
  5115. __Pyx_GOTREF(__pyx_t_3);
  5116. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_deltas, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
  5117. __Pyx_GOTREF(__pyx_t_4);
  5118. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_coords, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
  5119. __Pyx_GOTREF(__pyx_t_5);
  5120. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_deltas, __pyx_v_j, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
  5121. __Pyx_GOTREF(__pyx_t_6);
  5122. __pyx_t_7 = __pyx_f_9fontTools_6varLib_3iup_iup_segment(__pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error)
  5123. __Pyx_GOTREF(__pyx_t_7);
  5124. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5125. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5126. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5127. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5128. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5129. __pyx_v_interp = __pyx_t_7;
  5130. __pyx_t_7 = 0;
  5131. /* "fontTools/varLib/iup.py":194
  5132. * assert j - i >= 2
  5133. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5134. * deltas = deltas[i + 1 : j] # <<<<<<<<<<<<<<
  5135. *
  5136. * return all(
  5137. */
  5138. __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_deltas, (__pyx_v_i + 1), __pyx_v_j, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
  5139. __Pyx_GOTREF(__pyx_t_7);
  5140. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_7);
  5141. __pyx_t_7 = 0;
  5142. /* "fontTools/varLib/iup.py":198
  5143. * return all(
  5144. * abs(complex(x - p, y - q)) <= tolerance
  5145. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  5146. * )
  5147. *
  5148. */
  5149. __pyx_t_6 = NULL;
  5150. __pyx_t_8 = 1;
  5151. {
  5152. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_deltas, __pyx_v_interp};
  5153. __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  5154. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  5155. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  5156. __Pyx_GOTREF(__pyx_t_7);
  5157. }
  5158. /* "fontTools/varLib/iup.py":197
  5159. *
  5160. * return all(
  5161. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5162. * for (x, y), (p, q) in zip(deltas, interp)
  5163. * )
  5164. */
  5165. __pyx_t_6 = __pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error)
  5166. __Pyx_GOTREF(__pyx_t_6);
  5167. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5168. __pyx_t_7 = __Pyx_Generator_GetInlinedResult(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
  5169. __Pyx_GOTREF(__pyx_t_7);
  5170. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5171. __pyx_t_9 = __Pyx_PyLong_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
  5172. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5173. __pyx_r = __pyx_t_9;
  5174. goto __pyx_L0;
  5175. /* "fontTools/varLib/iup.py":169
  5176. *
  5177. *
  5178. * @cython.cfunc # <<<<<<<<<<<<<<
  5179. * @cython.inline
  5180. * @cython.locals(
  5181. */
  5182. /* function exit code */
  5183. __pyx_L1_error:;
  5184. __Pyx_XDECREF(__pyx_t_2);
  5185. __Pyx_XDECREF(__pyx_t_3);
  5186. __Pyx_XDECREF(__pyx_t_4);
  5187. __Pyx_XDECREF(__pyx_t_5);
  5188. __Pyx_XDECREF(__pyx_t_6);
  5189. __Pyx_XDECREF(__pyx_t_7);
  5190. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5191. __pyx_r = -1;
  5192. __pyx_L0:;
  5193. __Pyx_XDECREF(__pyx_v_interp);
  5194. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator);
  5195. __Pyx_XDECREF(__pyx_v_deltas);
  5196. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  5197. __Pyx_RefNannyFinishContext();
  5198. return __pyx_r;
  5199. }
  5200. /* "fontTools/varLib/iup.py":202
  5201. *
  5202. *
  5203. * @cython.locals( # <<<<<<<<<<<<<<
  5204. * cj=cython.double,
  5205. * dj=cython.double,
  5206. */
  5207. /* Python wrapper */
  5208. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set(PyObject *__pyx_self,
  5209. #if CYTHON_METH_FASTCALL
  5210. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5211. #else
  5212. PyObject *__pyx_args, PyObject *__pyx_kwds
  5213. #endif
  5214. ); /*proto*/
  5215. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set, "_iup_contour_bound_forced_set(deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0) -> set\n\nThe forced set is a conservative set of points on the contour that must be encoded\nexplicitly (ie. cannot be interpolated). Calculating this set allows for significantly\nspeeding up the dynamic-programming, as well as resolve circularity in DP.\n\nThe set is precise; that is, if an index is in the returned set, then there is no way\nthat IUP can generate delta for that point, given `coords` and `deltas`.");
  5216. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set = {"_iup_contour_bound_forced_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set};
  5217. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set(PyObject *__pyx_self,
  5218. #if CYTHON_METH_FASTCALL
  5219. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5220. #else
  5221. PyObject *__pyx_args, PyObject *__pyx_kwds
  5222. #endif
  5223. ) {
  5224. PyObject *__pyx_v_deltas = 0;
  5225. PyObject *__pyx_v_coords = 0;
  5226. PyObject *__pyx_v_tolerance = 0;
  5227. #if !CYTHON_METH_FASTCALL
  5228. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5229. #endif
  5230. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5231. PyObject* values[3] = {0,0,0};
  5232. int __pyx_lineno = 0;
  5233. const char *__pyx_filename = NULL;
  5234. int __pyx_clineno = 0;
  5235. PyObject *__pyx_r = 0;
  5236. __Pyx_RefNannyDeclarations
  5237. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set (wrapper)", 0);
  5238. #if !CYTHON_METH_FASTCALL
  5239. #if CYTHON_ASSUME_SAFE_SIZE
  5240. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5241. #else
  5242. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5243. #endif
  5244. #endif
  5245. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5246. {
  5247. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,&__pyx_mstate_global->__pyx_n_u_tolerance,0};
  5248. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5249. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 202, __pyx_L3_error)
  5250. if (__pyx_kwds_len > 0) {
  5251. switch (__pyx_nargs) {
  5252. case 3:
  5253. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5254. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 202, __pyx_L3_error)
  5255. CYTHON_FALLTHROUGH;
  5256. case 2:
  5257. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5258. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error)
  5259. CYTHON_FALLTHROUGH;
  5260. case 1:
  5261. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5262. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error)
  5263. CYTHON_FALLTHROUGH;
  5264. case 0: break;
  5265. default: goto __pyx_L5_argtuple_error;
  5266. }
  5267. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5268. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_iup_contour_bound_forced_set", 0) < (0)) __PYX_ERR(0, 202, __pyx_L3_error)
  5269. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
  5270. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  5271. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, i); __PYX_ERR(0, 202, __pyx_L3_error) }
  5272. }
  5273. } else {
  5274. switch (__pyx_nargs) {
  5275. case 3:
  5276. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5277. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 202, __pyx_L3_error)
  5278. CYTHON_FALLTHROUGH;
  5279. case 2:
  5280. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5281. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error)
  5282. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5283. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error)
  5284. break;
  5285. default: goto __pyx_L5_argtuple_error;
  5286. }
  5287. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
  5288. }
  5289. __pyx_v_deltas = values[0];
  5290. __pyx_v_coords = values[1];
  5291. __pyx_v_tolerance = values[2];
  5292. }
  5293. goto __pyx_L6_skip;
  5294. __pyx_L5_argtuple_error:;
  5295. __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 202, __pyx_L3_error)
  5296. __pyx_L6_skip:;
  5297. goto __pyx_L4_argument_unpacking_done;
  5298. __pyx_L3_error:;
  5299. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5300. Py_XDECREF(values[__pyx_temp]);
  5301. }
  5302. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5303. __Pyx_RefNannyFinishContext();
  5304. return NULL;
  5305. __pyx_L4_argument_unpacking_done:;
  5306. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  5307. /* function exit code */
  5308. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5309. Py_XDECREF(values[__pyx_temp]);
  5310. }
  5311. __Pyx_RefNannyFinishContext();
  5312. return __pyx_r;
  5313. }
  5314. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_tolerance) {
  5315. double __pyx_v_cj;
  5316. double __pyx_v_dj;
  5317. double __pyx_v_lcj;
  5318. double __pyx_v_ldj;
  5319. double __pyx_v_ncj;
  5320. double __pyx_v_ndj;
  5321. int __pyx_v_force;
  5322. PyObject *__pyx_v_forced = 0;
  5323. PyObject *__pyx_v_n = NULL;
  5324. PyObject *__pyx_v_i = NULL;
  5325. PyObject *__pyx_v_ld = NULL;
  5326. PyObject *__pyx_v_lc = NULL;
  5327. PyObject *__pyx_v_d = NULL;
  5328. PyObject *__pyx_v_c = NULL;
  5329. PyObject *__pyx_v_nd = NULL;
  5330. PyObject *__pyx_v_nc = NULL;
  5331. long __pyx_v_j;
  5332. double __pyx_v_c1;
  5333. double __pyx_v_c2;
  5334. double __pyx_v_d1;
  5335. double __pyx_v_d2;
  5336. PyObject *__pyx_r = NULL;
  5337. __Pyx_RefNannyDeclarations
  5338. Py_ssize_t __pyx_t_1;
  5339. Py_ssize_t __pyx_t_2;
  5340. int __pyx_t_3;
  5341. PyObject *__pyx_t_4 = NULL;
  5342. PyObject *__pyx_t_5 = NULL;
  5343. PyObject *__pyx_t_6 = NULL;
  5344. size_t __pyx_t_7;
  5345. PyObject *(*__pyx_t_8)(PyObject *);
  5346. PyObject *__pyx_t_9 = NULL;
  5347. long __pyx_t_10;
  5348. double __pyx_t_11;
  5349. double __pyx_t_12;
  5350. int __pyx_t_13;
  5351. double __pyx_t_14;
  5352. PyObject *__pyx_t_15 = NULL;
  5353. PyObject *__pyx_t_16 = NULL;
  5354. PyObject *__pyx_t_17 = NULL;
  5355. int __pyx_t_18;
  5356. int __pyx_lineno = 0;
  5357. const char *__pyx_filename = NULL;
  5358. int __pyx_clineno = 0;
  5359. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set", 0);
  5360. /* "fontTools/varLib/iup.py":222
  5361. * that IUP can generate delta for that point, given `coords` and `deltas`.
  5362. * """
  5363. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  5364. *
  5365. * n = len(deltas)
  5366. */
  5367. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5368. if (unlikely(__pyx_assertions_enabled())) {
  5369. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error)
  5370. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error)
  5371. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  5372. if (unlikely(!__pyx_t_3)) {
  5373. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  5374. __PYX_ERR(0, 222, __pyx_L1_error)
  5375. }
  5376. }
  5377. #else
  5378. if ((1)); else __PYX_ERR(0, 222, __pyx_L1_error)
  5379. #endif
  5380. /* "fontTools/varLib/iup.py":224
  5381. * assert len(deltas) == len(coords)
  5382. *
  5383. * n = len(deltas) # <<<<<<<<<<<<<<
  5384. * forced = set()
  5385. * # Track "last" and "next" points on the contour as we sweep.
  5386. */
  5387. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
  5388. __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
  5389. __Pyx_GOTREF(__pyx_t_4);
  5390. __pyx_v_n = __pyx_t_4;
  5391. __pyx_t_4 = 0;
  5392. /* "fontTools/varLib/iup.py":225
  5393. *
  5394. * n = len(deltas)
  5395. * forced = set() # <<<<<<<<<<<<<<
  5396. * # Track "last" and "next" points on the contour as we sweep.
  5397. * for i in range(len(deltas) - 1, -1, -1):
  5398. */
  5399. __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
  5400. __Pyx_GOTREF(__pyx_t_4);
  5401. __pyx_v_forced = ((PyObject*)__pyx_t_4);
  5402. __pyx_t_4 = 0;
  5403. /* "fontTools/varLib/iup.py":227
  5404. * forced = set()
  5405. * # Track "last" and "next" points on the contour as we sweep.
  5406. * for i in range(len(deltas) - 1, -1, -1): # <<<<<<<<<<<<<<
  5407. * ld, lc = deltas[i - 1], coords[i - 1]
  5408. * d, c = deltas[i], coords[i]
  5409. */
  5410. __pyx_t_5 = NULL;
  5411. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 227, __pyx_L1_error)
  5412. __pyx_t_6 = PyLong_FromSsize_t((__pyx_t_2 - 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
  5413. __Pyx_GOTREF(__pyx_t_6);
  5414. __pyx_t_7 = 1;
  5415. {
  5416. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_6, __pyx_mstate_global->__pyx_int_neg_1, __pyx_mstate_global->__pyx_int_neg_1};
  5417. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  5418. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  5419. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5420. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
  5421. __Pyx_GOTREF(__pyx_t_4);
  5422. }
  5423. __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
  5424. __Pyx_GOTREF(__pyx_t_6);
  5425. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 227, __pyx_L1_error)
  5426. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5427. for (;;) {
  5428. {
  5429. __pyx_t_4 = __pyx_t_8(__pyx_t_6);
  5430. if (unlikely(!__pyx_t_4)) {
  5431. PyObject* exc_type = PyErr_Occurred();
  5432. if (exc_type) {
  5433. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 227, __pyx_L1_error)
  5434. PyErr_Clear();
  5435. }
  5436. break;
  5437. }
  5438. }
  5439. __Pyx_GOTREF(__pyx_t_4);
  5440. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
  5441. __pyx_t_4 = 0;
  5442. /* "fontTools/varLib/iup.py":228
  5443. * # Track "last" and "next" points on the contour as we sweep.
  5444. * for i in range(len(deltas) - 1, -1, -1):
  5445. * ld, lc = deltas[i - 1], coords[i - 1] # <<<<<<<<<<<<<<
  5446. * d, c = deltas[i], coords[i]
  5447. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5448. */
  5449. __pyx_t_4 = __Pyx_PyLong_SubtractObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
  5450. __Pyx_GOTREF(__pyx_t_4);
  5451. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error)
  5452. __Pyx_GOTREF(__pyx_t_5);
  5453. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5454. __pyx_t_4 = __Pyx_PyLong_SubtractObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
  5455. __Pyx_GOTREF(__pyx_t_4);
  5456. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 228, __pyx_L1_error)
  5457. __Pyx_GOTREF(__pyx_t_9);
  5458. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5459. __Pyx_XDECREF_SET(__pyx_v_ld, __pyx_t_5);
  5460. __pyx_t_5 = 0;
  5461. __Pyx_XDECREF_SET(__pyx_v_lc, __pyx_t_9);
  5462. __pyx_t_9 = 0;
  5463. /* "fontTools/varLib/iup.py":229
  5464. * for i in range(len(deltas) - 1, -1, -1):
  5465. * ld, lc = deltas[i - 1], coords[i - 1]
  5466. * d, c = deltas[i], coords[i] # <<<<<<<<<<<<<<
  5467. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5468. *
  5469. */
  5470. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 229, __pyx_L1_error)
  5471. __Pyx_GOTREF(__pyx_t_9);
  5472. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  5473. __Pyx_GOTREF(__pyx_t_5);
  5474. __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_9);
  5475. __pyx_t_9 = 0;
  5476. __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5);
  5477. __pyx_t_5 = 0;
  5478. /* "fontTools/varLib/iup.py":230
  5479. * ld, lc = deltas[i - 1], coords[i - 1]
  5480. * d, c = deltas[i], coords[i]
  5481. * nd, nc = deltas[i - n + 1], coords[i - n + 1] # <<<<<<<<<<<<<<
  5482. *
  5483. * for j in (0, 1): # For X and for Y
  5484. */
  5485. __pyx_t_5 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5486. __Pyx_GOTREF(__pyx_t_5);
  5487. __pyx_t_9 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 230, __pyx_L1_error)
  5488. __Pyx_GOTREF(__pyx_t_9);
  5489. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5490. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5491. __Pyx_GOTREF(__pyx_t_5);
  5492. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5493. __pyx_t_9 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 230, __pyx_L1_error)
  5494. __Pyx_GOTREF(__pyx_t_9);
  5495. __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_t_9, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
  5496. __Pyx_GOTREF(__pyx_t_4);
  5497. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5498. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 230, __pyx_L1_error)
  5499. __Pyx_GOTREF(__pyx_t_9);
  5500. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5501. __Pyx_XDECREF_SET(__pyx_v_nd, __pyx_t_5);
  5502. __pyx_t_5 = 0;
  5503. __Pyx_XDECREF_SET(__pyx_v_nc, __pyx_t_9);
  5504. __pyx_t_9 = 0;
  5505. /* "fontTools/varLib/iup.py":232
  5506. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5507. *
  5508. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  5509. * cj = c[j]
  5510. * dj = d[j]
  5511. */
  5512. __pyx_t_9 = __pyx_mstate_global->__pyx_tuple[0]; __Pyx_INCREF(__pyx_t_9);
  5513. __pyx_t_2 = 0;
  5514. for (;;) {
  5515. if (__pyx_t_2 >= 2) break;
  5516. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5517. __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2));
  5518. #else
  5519. __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_2);
  5520. #endif
  5521. ++__pyx_t_2;
  5522. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
  5523. __Pyx_GOTREF(__pyx_t_5);
  5524. __pyx_t_10 = __Pyx_PyLong_As_long(__pyx_t_5); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
  5525. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5526. __pyx_v_j = __pyx_t_10;
  5527. /* "fontTools/varLib/iup.py":233
  5528. *
  5529. * for j in (0, 1): # For X and for Y
  5530. * cj = c[j] # <<<<<<<<<<<<<<
  5531. * dj = d[j]
  5532. * lcj = lc[j]
  5533. */
  5534. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_c, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
  5535. __Pyx_GOTREF(__pyx_t_5);
  5536. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
  5537. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5538. __pyx_v_cj = __pyx_t_11;
  5539. /* "fontTools/varLib/iup.py":234
  5540. * for j in (0, 1): # For X and for Y
  5541. * cj = c[j]
  5542. * dj = d[j] # <<<<<<<<<<<<<<
  5543. * lcj = lc[j]
  5544. * ldj = ld[j]
  5545. */
  5546. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_d, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
  5547. __Pyx_GOTREF(__pyx_t_5);
  5548. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
  5549. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5550. __pyx_v_dj = __pyx_t_11;
  5551. /* "fontTools/varLib/iup.py":235
  5552. * cj = c[j]
  5553. * dj = d[j]
  5554. * lcj = lc[j] # <<<<<<<<<<<<<<
  5555. * ldj = ld[j]
  5556. * ncj = nc[j]
  5557. */
  5558. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_lc, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
  5559. __Pyx_GOTREF(__pyx_t_5);
  5560. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error)
  5561. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5562. __pyx_v_lcj = __pyx_t_11;
  5563. /* "fontTools/varLib/iup.py":236
  5564. * dj = d[j]
  5565. * lcj = lc[j]
  5566. * ldj = ld[j] # <<<<<<<<<<<<<<
  5567. * ncj = nc[j]
  5568. * ndj = nd[j]
  5569. */
  5570. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ld, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
  5571. __Pyx_GOTREF(__pyx_t_5);
  5572. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
  5573. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5574. __pyx_v_ldj = __pyx_t_11;
  5575. /* "fontTools/varLib/iup.py":237
  5576. * lcj = lc[j]
  5577. * ldj = ld[j]
  5578. * ncj = nc[j] # <<<<<<<<<<<<<<
  5579. * ndj = nd[j]
  5580. *
  5581. */
  5582. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nc, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 237, __pyx_L1_error)
  5583. __Pyx_GOTREF(__pyx_t_5);
  5584. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
  5585. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5586. __pyx_v_ncj = __pyx_t_11;
  5587. /* "fontTools/varLib/iup.py":238
  5588. * ldj = ld[j]
  5589. * ncj = nc[j]
  5590. * ndj = nd[j] # <<<<<<<<<<<<<<
  5591. *
  5592. * if lcj <= ncj:
  5593. */
  5594. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nd, __pyx_v_j, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error)
  5595. __Pyx_GOTREF(__pyx_t_5);
  5596. __pyx_t_11 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error)
  5597. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5598. __pyx_v_ndj = __pyx_t_11;
  5599. /* "fontTools/varLib/iup.py":240
  5600. * ndj = nd[j]
  5601. *
  5602. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5603. * c1, c2 = lcj, ncj
  5604. * d1, d2 = ldj, ndj
  5605. */
  5606. __pyx_t_3 = (__pyx_v_lcj <= __pyx_v_ncj);
  5607. if (__pyx_t_3) {
  5608. /* "fontTools/varLib/iup.py":241
  5609. *
  5610. * if lcj <= ncj:
  5611. * c1, c2 = lcj, ncj # <<<<<<<<<<<<<<
  5612. * d1, d2 = ldj, ndj
  5613. * else:
  5614. */
  5615. __pyx_t_11 = __pyx_v_lcj;
  5616. __pyx_t_12 = __pyx_v_ncj;
  5617. __pyx_v_c1 = __pyx_t_11;
  5618. __pyx_v_c2 = __pyx_t_12;
  5619. /* "fontTools/varLib/iup.py":242
  5620. * if lcj <= ncj:
  5621. * c1, c2 = lcj, ncj
  5622. * d1, d2 = ldj, ndj # <<<<<<<<<<<<<<
  5623. * else:
  5624. * c1, c2 = ncj, lcj
  5625. */
  5626. __pyx_t_12 = __pyx_v_ldj;
  5627. __pyx_t_11 = __pyx_v_ndj;
  5628. __pyx_v_d1 = __pyx_t_12;
  5629. __pyx_v_d2 = __pyx_t_11;
  5630. /* "fontTools/varLib/iup.py":240
  5631. * ndj = nd[j]
  5632. *
  5633. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5634. * c1, c2 = lcj, ncj
  5635. * d1, d2 = ldj, ndj
  5636. */
  5637. goto __pyx_L7;
  5638. }
  5639. /* "fontTools/varLib/iup.py":244
  5640. * d1, d2 = ldj, ndj
  5641. * else:
  5642. * c1, c2 = ncj, lcj # <<<<<<<<<<<<<<
  5643. * d1, d2 = ndj, ldj
  5644. *
  5645. */
  5646. /*else*/ {
  5647. __pyx_t_11 = __pyx_v_ncj;
  5648. __pyx_t_12 = __pyx_v_lcj;
  5649. __pyx_v_c1 = __pyx_t_11;
  5650. __pyx_v_c2 = __pyx_t_12;
  5651. /* "fontTools/varLib/iup.py":245
  5652. * else:
  5653. * c1, c2 = ncj, lcj
  5654. * d1, d2 = ndj, ldj # <<<<<<<<<<<<<<
  5655. *
  5656. * force = False
  5657. */
  5658. __pyx_t_12 = __pyx_v_ndj;
  5659. __pyx_t_11 = __pyx_v_ldj;
  5660. __pyx_v_d1 = __pyx_t_12;
  5661. __pyx_v_d2 = __pyx_t_11;
  5662. }
  5663. __pyx_L7:;
  5664. /* "fontTools/varLib/iup.py":247
  5665. * d1, d2 = ndj, ldj
  5666. *
  5667. * force = False # <<<<<<<<<<<<<<
  5668. *
  5669. * # If the two coordinates are the same, then the interpolation
  5670. */
  5671. __pyx_v_force = 0;
  5672. /* "fontTools/varLib/iup.py":254
  5673. * #
  5674. * # This test has to be before the next one.
  5675. * if c1 == c2: # <<<<<<<<<<<<<<
  5676. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  5677. * force = True
  5678. */
  5679. __pyx_t_3 = (__pyx_v_c1 == __pyx_v_c2);
  5680. if (__pyx_t_3) {
  5681. /* "fontTools/varLib/iup.py":255
  5682. * # This test has to be before the next one.
  5683. * if c1 == c2:
  5684. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  5685. * force = True
  5686. *
  5687. */
  5688. __pyx_t_11 = fabs((__pyx_v_d1 - __pyx_v_d2));
  5689. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
  5690. __Pyx_GOTREF(__pyx_t_5);
  5691. __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
  5692. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5693. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 255, __pyx_L1_error)
  5694. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5695. if (__pyx_t_13) {
  5696. } else {
  5697. __pyx_t_3 = __pyx_t_13;
  5698. goto __pyx_L10_bool_binop_done;
  5699. }
  5700. __pyx_t_11 = fabs(__pyx_v_dj);
  5701. __pyx_t_4 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
  5702. __Pyx_GOTREF(__pyx_t_4);
  5703. __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
  5704. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5705. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 255, __pyx_L1_error)
  5706. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5707. __pyx_t_3 = __pyx_t_13;
  5708. __pyx_L10_bool_binop_done:;
  5709. if (__pyx_t_3) {
  5710. /* "fontTools/varLib/iup.py":256
  5711. * if c1 == c2:
  5712. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  5713. * force = True # <<<<<<<<<<<<<<
  5714. *
  5715. * # If coordinate for current point is between coordinate of adjacent
  5716. */
  5717. __pyx_v_force = 1;
  5718. /* "fontTools/varLib/iup.py":255
  5719. * # This test has to be before the next one.
  5720. * if c1 == c2:
  5721. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  5722. * force = True
  5723. *
  5724. */
  5725. }
  5726. /* "fontTools/varLib/iup.py":254
  5727. * #
  5728. * # This test has to be before the next one.
  5729. * if c1 == c2: # <<<<<<<<<<<<<<
  5730. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  5731. * force = True
  5732. */
  5733. goto __pyx_L8;
  5734. }
  5735. /* "fontTools/varLib/iup.py":263
  5736. * # allowance), then there is no way that current point can be IUP-ed.
  5737. * # Mark it forced.
  5738. * elif c1 <= cj <= c2: # and c1 != c2 # <<<<<<<<<<<<<<
  5739. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  5740. * force = True
  5741. */
  5742. __pyx_t_3 = (__pyx_v_c1 <= __pyx_v_cj);
  5743. if (__pyx_t_3) {
  5744. __pyx_t_3 = (__pyx_v_cj <= __pyx_v_c2);
  5745. }
  5746. if (__pyx_t_3) {
  5747. /* "fontTools/varLib/iup.py":264
  5748. * # Mark it forced.
  5749. * elif c1 <= cj <= c2: # and c1 != c2
  5750. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance): # <<<<<<<<<<<<<<
  5751. * force = True
  5752. *
  5753. */
  5754. __pyx_t_11 = __pyx_v_d2;
  5755. __pyx_t_12 = __pyx_v_d1;
  5756. __pyx_t_3 = (__pyx_t_11 < __pyx_t_12);
  5757. if (__pyx_t_3) {
  5758. __pyx_t_14 = __pyx_t_11;
  5759. } else {
  5760. __pyx_t_14 = __pyx_t_12;
  5761. }
  5762. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
  5763. __Pyx_GOTREF(__pyx_t_5);
  5764. __pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
  5765. __Pyx_GOTREF(__pyx_t_4);
  5766. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5767. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
  5768. __Pyx_GOTREF(__pyx_t_5);
  5769. __pyx_t_15 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 264, __pyx_L1_error)
  5770. if (__Pyx_PyObject_IsTrue(__pyx_t_15)) {
  5771. __Pyx_DECREF(__pyx_t_15);
  5772. __pyx_t_14 = __pyx_v_d2;
  5773. __pyx_t_11 = __pyx_v_d1;
  5774. __pyx_t_3 = (__pyx_t_14 > __pyx_t_11);
  5775. if (__pyx_t_3) {
  5776. __pyx_t_12 = __pyx_t_14;
  5777. } else {
  5778. __pyx_t_12 = __pyx_t_11;
  5779. }
  5780. __pyx_t_16 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 264, __pyx_L1_error)
  5781. __Pyx_GOTREF(__pyx_t_16);
  5782. __pyx_t_17 = PyNumber_Add(__pyx_t_16, __pyx_v_tolerance); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 264, __pyx_L1_error)
  5783. __Pyx_GOTREF(__pyx_t_17);
  5784. __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  5785. __pyx_t_15 = PyObject_RichCompare(__pyx_t_5, __pyx_t_17, Py_LE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 264, __pyx_L1_error)
  5786. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  5787. }
  5788. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5789. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5790. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 264, __pyx_L1_error)
  5791. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5792. __pyx_t_13 = (!__pyx_t_3);
  5793. if (__pyx_t_13) {
  5794. /* "fontTools/varLib/iup.py":265
  5795. * elif c1 <= cj <= c2: # and c1 != c2
  5796. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  5797. * force = True # <<<<<<<<<<<<<<
  5798. *
  5799. * # Otherwise, the delta should either match the closest, or have the
  5800. */
  5801. __pyx_v_force = 1;
  5802. /* "fontTools/varLib/iup.py":264
  5803. * # Mark it forced.
  5804. * elif c1 <= cj <= c2: # and c1 != c2
  5805. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance): # <<<<<<<<<<<<<<
  5806. * force = True
  5807. *
  5808. */
  5809. }
  5810. /* "fontTools/varLib/iup.py":263
  5811. * # allowance), then there is no way that current point can be IUP-ed.
  5812. * # Mark it forced.
  5813. * elif c1 <= cj <= c2: # and c1 != c2 # <<<<<<<<<<<<<<
  5814. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  5815. * force = True
  5816. */
  5817. goto __pyx_L8;
  5818. }
  5819. /* "fontTools/varLib/iup.py":270
  5820. * # same sign as the interpolation of the two deltas.
  5821. * else: # cj < c1 or c2 < cj
  5822. * if d1 != d2: # <<<<<<<<<<<<<<
  5823. * if cj < c1:
  5824. * if (
  5825. */
  5826. /*else*/ {
  5827. __pyx_t_13 = (__pyx_v_d1 != __pyx_v_d2);
  5828. if (__pyx_t_13) {
  5829. /* "fontTools/varLib/iup.py":271
  5830. * else: # cj < c1 or c2 < cj
  5831. * if d1 != d2:
  5832. * if cj < c1: # <<<<<<<<<<<<<<
  5833. * if (
  5834. * abs(dj) > tolerance
  5835. */
  5836. __pyx_t_13 = (__pyx_v_cj < __pyx_v_c1);
  5837. if (__pyx_t_13) {
  5838. /* "fontTools/varLib/iup.py":273
  5839. * if cj < c1:
  5840. * if (
  5841. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  5842. * and abs(dj - d1) > tolerance
  5843. * and ((dj - tolerance < d1) != (d1 < d2))
  5844. */
  5845. __pyx_t_12 = fabs(__pyx_v_dj);
  5846. __pyx_t_15 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 273, __pyx_L1_error)
  5847. __Pyx_GOTREF(__pyx_t_15);
  5848. __pyx_t_5 = PyObject_RichCompare(__pyx_t_15, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 273, __pyx_L1_error)
  5849. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5850. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 273, __pyx_L1_error)
  5851. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5852. if (__pyx_t_3) {
  5853. } else {
  5854. __pyx_t_13 = __pyx_t_3;
  5855. goto __pyx_L16_bool_binop_done;
  5856. }
  5857. /* "fontTools/varLib/iup.py":274
  5858. * if (
  5859. * abs(dj) > tolerance
  5860. * and abs(dj - d1) > tolerance # <<<<<<<<<<<<<<
  5861. * and ((dj - tolerance < d1) != (d1 < d2))
  5862. * ):
  5863. */
  5864. __pyx_t_12 = fabs((__pyx_v_dj - __pyx_v_d1));
  5865. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error)
  5866. __Pyx_GOTREF(__pyx_t_5);
  5867. __pyx_t_15 = PyObject_RichCompare(__pyx_t_5, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 274, __pyx_L1_error)
  5868. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5869. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 274, __pyx_L1_error)
  5870. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5871. if (__pyx_t_3) {
  5872. } else {
  5873. __pyx_t_13 = __pyx_t_3;
  5874. goto __pyx_L16_bool_binop_done;
  5875. }
  5876. /* "fontTools/varLib/iup.py":275
  5877. * abs(dj) > tolerance
  5878. * and abs(dj - d1) > tolerance
  5879. * and ((dj - tolerance < d1) != (d1 < d2)) # <<<<<<<<<<<<<<
  5880. * ):
  5881. * force = True
  5882. */
  5883. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5884. __Pyx_GOTREF(__pyx_t_15);
  5885. __pyx_t_5 = PyNumber_Subtract(__pyx_t_15, __pyx_v_tolerance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  5886. __Pyx_GOTREF(__pyx_t_5);
  5887. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5888. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5889. __Pyx_GOTREF(__pyx_t_15);
  5890. __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
  5891. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5892. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5893. __pyx_t_15 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5894. __Pyx_GOTREF(__pyx_t_15);
  5895. __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_15, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  5896. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5897. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5898. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 275, __pyx_L1_error)
  5899. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5900. __pyx_t_13 = __pyx_t_3;
  5901. __pyx_L16_bool_binop_done:;
  5902. /* "fontTools/varLib/iup.py":272
  5903. * if d1 != d2:
  5904. * if cj < c1:
  5905. * if ( # <<<<<<<<<<<<<<
  5906. * abs(dj) > tolerance
  5907. * and abs(dj - d1) > tolerance
  5908. */
  5909. if (__pyx_t_13) {
  5910. /* "fontTools/varLib/iup.py":277
  5911. * and ((dj - tolerance < d1) != (d1 < d2))
  5912. * ):
  5913. * force = True # <<<<<<<<<<<<<<
  5914. * else: # c2 < cj
  5915. * if (
  5916. */
  5917. __pyx_v_force = 1;
  5918. /* "fontTools/varLib/iup.py":272
  5919. * if d1 != d2:
  5920. * if cj < c1:
  5921. * if ( # <<<<<<<<<<<<<<
  5922. * abs(dj) > tolerance
  5923. * and abs(dj - d1) > tolerance
  5924. */
  5925. }
  5926. /* "fontTools/varLib/iup.py":271
  5927. * else: # cj < c1 or c2 < cj
  5928. * if d1 != d2:
  5929. * if cj < c1: # <<<<<<<<<<<<<<
  5930. * if (
  5931. * abs(dj) > tolerance
  5932. */
  5933. goto __pyx_L14;
  5934. }
  5935. /* "fontTools/varLib/iup.py":279
  5936. * force = True
  5937. * else: # c2 < cj
  5938. * if ( # <<<<<<<<<<<<<<
  5939. * abs(dj) > tolerance
  5940. * and abs(dj - d2) > tolerance
  5941. */
  5942. /*else*/ {
  5943. /* "fontTools/varLib/iup.py":280
  5944. * else: # c2 < cj
  5945. * if (
  5946. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  5947. * and abs(dj - d2) > tolerance
  5948. * and ((d2 < dj + tolerance) != (d1 < d2))
  5949. */
  5950. __pyx_t_12 = fabs(__pyx_v_dj);
  5951. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error)
  5952. __Pyx_GOTREF(__pyx_t_5);
  5953. __pyx_t_15 = PyObject_RichCompare(__pyx_t_5, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 280, __pyx_L1_error)
  5954. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5955. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 280, __pyx_L1_error)
  5956. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5957. if (__pyx_t_3) {
  5958. } else {
  5959. __pyx_t_13 = __pyx_t_3;
  5960. goto __pyx_L20_bool_binop_done;
  5961. }
  5962. /* "fontTools/varLib/iup.py":281
  5963. * if (
  5964. * abs(dj) > tolerance
  5965. * and abs(dj - d2) > tolerance # <<<<<<<<<<<<<<
  5966. * and ((d2 < dj + tolerance) != (d1 < d2))
  5967. * ):
  5968. */
  5969. __pyx_t_12 = fabs((__pyx_v_dj - __pyx_v_d2));
  5970. __pyx_t_15 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 281, __pyx_L1_error)
  5971. __Pyx_GOTREF(__pyx_t_15);
  5972. __pyx_t_5 = PyObject_RichCompare(__pyx_t_15, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
  5973. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5974. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 281, __pyx_L1_error)
  5975. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5976. if (__pyx_t_3) {
  5977. } else {
  5978. __pyx_t_13 = __pyx_t_3;
  5979. goto __pyx_L20_bool_binop_done;
  5980. }
  5981. /* "fontTools/varLib/iup.py":282
  5982. * abs(dj) > tolerance
  5983. * and abs(dj - d2) > tolerance
  5984. * and ((d2 < dj + tolerance) != (d1 < d2)) # <<<<<<<<<<<<<<
  5985. * ):
  5986. * force = True
  5987. */
  5988. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_d2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
  5989. __Pyx_GOTREF(__pyx_t_5);
  5990. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
  5991. __Pyx_GOTREF(__pyx_t_15);
  5992. __pyx_t_4 = PyNumber_Add(__pyx_t_15, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  5993. __Pyx_GOTREF(__pyx_t_4);
  5994. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5995. __pyx_t_15 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
  5996. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5997. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5998. __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  5999. __Pyx_GOTREF(__pyx_t_4);
  6000. __pyx_t_5 = PyObject_RichCompare(__pyx_t_15, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
  6001. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  6002. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6003. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 282, __pyx_L1_error)
  6004. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6005. __pyx_t_13 = __pyx_t_3;
  6006. __pyx_L20_bool_binop_done:;
  6007. /* "fontTools/varLib/iup.py":279
  6008. * force = True
  6009. * else: # c2 < cj
  6010. * if ( # <<<<<<<<<<<<<<
  6011. * abs(dj) > tolerance
  6012. * and abs(dj - d2) > tolerance
  6013. */
  6014. if (__pyx_t_13) {
  6015. /* "fontTools/varLib/iup.py":284
  6016. * and ((d2 < dj + tolerance) != (d1 < d2))
  6017. * ):
  6018. * force = True # <<<<<<<<<<<<<<
  6019. *
  6020. * if force:
  6021. */
  6022. __pyx_v_force = 1;
  6023. /* "fontTools/varLib/iup.py":279
  6024. * force = True
  6025. * else: # c2 < cj
  6026. * if ( # <<<<<<<<<<<<<<
  6027. * abs(dj) > tolerance
  6028. * and abs(dj - d2) > tolerance
  6029. */
  6030. }
  6031. }
  6032. __pyx_L14:;
  6033. /* "fontTools/varLib/iup.py":270
  6034. * # same sign as the interpolation of the two deltas.
  6035. * else: # cj < c1 or c2 < cj
  6036. * if d1 != d2: # <<<<<<<<<<<<<<
  6037. * if cj < c1:
  6038. * if (
  6039. */
  6040. }
  6041. }
  6042. __pyx_L8:;
  6043. /* "fontTools/varLib/iup.py":286
  6044. * force = True
  6045. *
  6046. * if force: # <<<<<<<<<<<<<<
  6047. * forced.add(i)
  6048. * break
  6049. */
  6050. __pyx_t_13 = (__pyx_v_force != 0);
  6051. if (__pyx_t_13) {
  6052. /* "fontTools/varLib/iup.py":287
  6053. *
  6054. * if force:
  6055. * forced.add(i) # <<<<<<<<<<<<<<
  6056. * break
  6057. *
  6058. */
  6059. __pyx_t_18 = PySet_Add(__pyx_v_forced, __pyx_v_i); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
  6060. /* "fontTools/varLib/iup.py":288
  6061. * if force:
  6062. * forced.add(i)
  6063. * break # <<<<<<<<<<<<<<
  6064. *
  6065. * return forced
  6066. */
  6067. goto __pyx_L6_break;
  6068. /* "fontTools/varLib/iup.py":286
  6069. * force = True
  6070. *
  6071. * if force: # <<<<<<<<<<<<<<
  6072. * forced.add(i)
  6073. * break
  6074. */
  6075. }
  6076. /* "fontTools/varLib/iup.py":232
  6077. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  6078. *
  6079. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  6080. * cj = c[j]
  6081. * dj = d[j]
  6082. */
  6083. }
  6084. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6085. goto __pyx_L24_for_end;
  6086. __pyx_L6_break:;
  6087. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6088. goto __pyx_L24_for_end;
  6089. __pyx_L24_for_end:;
  6090. /* "fontTools/varLib/iup.py":227
  6091. * forced = set()
  6092. * # Track "last" and "next" points on the contour as we sweep.
  6093. * for i in range(len(deltas) - 1, -1, -1): # <<<<<<<<<<<<<<
  6094. * ld, lc = deltas[i - 1], coords[i - 1]
  6095. * d, c = deltas[i], coords[i]
  6096. */
  6097. }
  6098. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6099. /* "fontTools/varLib/iup.py":290
  6100. * break
  6101. *
  6102. * return forced # <<<<<<<<<<<<<<
  6103. *
  6104. *
  6105. */
  6106. __Pyx_XDECREF(__pyx_r);
  6107. __Pyx_INCREF(__pyx_v_forced);
  6108. __pyx_r = __pyx_v_forced;
  6109. goto __pyx_L0;
  6110. /* "fontTools/varLib/iup.py":202
  6111. *
  6112. *
  6113. * @cython.locals( # <<<<<<<<<<<<<<
  6114. * cj=cython.double,
  6115. * dj=cython.double,
  6116. */
  6117. /* function exit code */
  6118. __pyx_L1_error:;
  6119. __Pyx_XDECREF(__pyx_t_4);
  6120. __Pyx_XDECREF(__pyx_t_5);
  6121. __Pyx_XDECREF(__pyx_t_6);
  6122. __Pyx_XDECREF(__pyx_t_9);
  6123. __Pyx_XDECREF(__pyx_t_15);
  6124. __Pyx_XDECREF(__pyx_t_16);
  6125. __Pyx_XDECREF(__pyx_t_17);
  6126. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6127. __pyx_r = NULL;
  6128. __pyx_L0:;
  6129. __Pyx_XDECREF(__pyx_v_forced);
  6130. __Pyx_XDECREF(__pyx_v_n);
  6131. __Pyx_XDECREF(__pyx_v_i);
  6132. __Pyx_XDECREF(__pyx_v_ld);
  6133. __Pyx_XDECREF(__pyx_v_lc);
  6134. __Pyx_XDECREF(__pyx_v_d);
  6135. __Pyx_XDECREF(__pyx_v_c);
  6136. __Pyx_XDECREF(__pyx_v_nd);
  6137. __Pyx_XDECREF(__pyx_v_nc);
  6138. __Pyx_XGIVEREF(__pyx_r);
  6139. __Pyx_RefNannyFinishContext();
  6140. return __pyx_r;
  6141. }
  6142. /* "fontTools/varLib/iup.py":293
  6143. *
  6144. *
  6145. * @cython.locals( # <<<<<<<<<<<<<<
  6146. * i=cython.int,
  6147. * j=cython.int,
  6148. */
  6149. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  6150. PyObject *__pyx_r = NULL;
  6151. __Pyx_RefNannyDeclarations
  6152. PyObject *__pyx_t_1 = NULL;
  6153. PyObject *__pyx_t_2 = NULL;
  6154. int __pyx_lineno = 0;
  6155. const char *__pyx_filename = NULL;
  6156. int __pyx_clineno = 0;
  6157. __Pyx_RefNannySetupContext("__defaults__", 0);
  6158. __Pyx_XDECREF(__pyx_r);
  6159. /* "fontTools/varLib/iup.py":306
  6160. * coords: _PointSegment,
  6161. * forced=set(),
  6162. * tolerance: Real = 0, # <<<<<<<<<<<<<<
  6163. * lookback: Integral = None,
  6164. * ):
  6165. */
  6166. __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
  6167. __Pyx_GOTREF(__pyx_t_1);
  6168. /* "fontTools/varLib/iup.py":293
  6169. *
  6170. *
  6171. * @cython.locals( # <<<<<<<<<<<<<<
  6172. * i=cython.int,
  6173. * j=cython.int,
  6174. */
  6175. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
  6176. __Pyx_GOTREF(__pyx_t_2);
  6177. __Pyx_INCREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  6178. __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  6179. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6180. __Pyx_GIVEREF(__pyx_t_1);
  6181. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6182. __Pyx_INCREF(Py_None);
  6183. __Pyx_GIVEREF(Py_None);
  6184. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6185. __pyx_t_1 = 0;
  6186. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  6187. __Pyx_GOTREF(__pyx_t_1);
  6188. __Pyx_GIVEREF(__pyx_t_2);
  6189. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6190. __Pyx_INCREF(Py_None);
  6191. __Pyx_GIVEREF(Py_None);
  6192. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6193. __pyx_t_2 = 0;
  6194. __pyx_r = __pyx_t_1;
  6195. __pyx_t_1 = 0;
  6196. goto __pyx_L0;
  6197. /* function exit code */
  6198. __pyx_L1_error:;
  6199. __Pyx_XDECREF(__pyx_t_1);
  6200. __Pyx_XDECREF(__pyx_t_2);
  6201. __Pyx_AddTraceback("fontTools.varLib.iup.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6202. __pyx_r = NULL;
  6203. __pyx_L0:;
  6204. __Pyx_XGIVEREF(__pyx_r);
  6205. __Pyx_RefNannyFinishContext();
  6206. return __pyx_r;
  6207. }
  6208. /* Python wrapper */
  6209. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp(PyObject *__pyx_self,
  6210. #if CYTHON_METH_FASTCALL
  6211. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6212. #else
  6213. PyObject *__pyx_args, PyObject *__pyx_kwds
  6214. #endif
  6215. ); /*proto*/
  6216. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_6_iup_contour_optimize_dp, "_iup_contour_optimize_dp(deltas: _DeltaSegment, coords: _PointSegment, set forced=set(), double tolerance: Real = 0, lookback: Integral = None)\n\nStraightforward Dynamic-Programming. For each index i, find least-costly encoding of\npoints 0 to i where i is explicitly encoded. We find this by considering all previous\nexplicit points j and check whether interpolation can fill points between j and i.\n\nNote that solution always encodes last point explicitly. Higher-level is responsible\nfor removing that restriction.\n\nAs major speedup, we stop looking further whenever we see a \"forced\" point.");
  6217. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp = {"_iup_contour_optimize_dp", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_6_iup_contour_optimize_dp};
  6218. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp(PyObject *__pyx_self,
  6219. #if CYTHON_METH_FASTCALL
  6220. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6221. #else
  6222. PyObject *__pyx_args, PyObject *__pyx_kwds
  6223. #endif
  6224. ) {
  6225. PyObject *__pyx_v_deltas = 0;
  6226. PyObject *__pyx_v_coords = 0;
  6227. PyObject *__pyx_v_forced = 0;
  6228. double __pyx_v_tolerance;
  6229. PyObject *__pyx_v_lookback = 0;
  6230. #if !CYTHON_METH_FASTCALL
  6231. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6232. #endif
  6233. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6234. PyObject* values[5] = {0,0,0,0,0};
  6235. int __pyx_lineno = 0;
  6236. const char *__pyx_filename = NULL;
  6237. int __pyx_clineno = 0;
  6238. PyObject *__pyx_r = 0;
  6239. __Pyx_RefNannyDeclarations
  6240. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp (wrapper)", 0);
  6241. #if !CYTHON_METH_FASTCALL
  6242. #if CYTHON_ASSUME_SAFE_SIZE
  6243. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6244. #else
  6245. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6246. #endif
  6247. #endif
  6248. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6249. {
  6250. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,&__pyx_mstate_global->__pyx_n_u_forced,&__pyx_mstate_global->__pyx_n_u_tolerance,&__pyx_mstate_global->__pyx_n_u_lookback,0};
  6251. struct __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self);
  6252. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6253. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 293, __pyx_L3_error)
  6254. if (__pyx_kwds_len > 0) {
  6255. switch (__pyx_nargs) {
  6256. case 5:
  6257. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  6258. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 293, __pyx_L3_error)
  6259. CYTHON_FALLTHROUGH;
  6260. case 4:
  6261. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6262. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 293, __pyx_L3_error)
  6263. CYTHON_FALLTHROUGH;
  6264. case 3:
  6265. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6266. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 293, __pyx_L3_error)
  6267. CYTHON_FALLTHROUGH;
  6268. case 2:
  6269. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6270. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 293, __pyx_L3_error)
  6271. CYTHON_FALLTHROUGH;
  6272. case 1:
  6273. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6274. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 293, __pyx_L3_error)
  6275. CYTHON_FALLTHROUGH;
  6276. case 0: break;
  6277. default: goto __pyx_L5_argtuple_error;
  6278. }
  6279. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6280. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_iup_contour_optimize_dp", 0) < (0)) __PYX_ERR(0, 293, __pyx_L3_error)
  6281. if (!values[2]) values[2] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  6282. /* "fontTools/varLib/iup.py":307
  6283. * forced=set(),
  6284. * tolerance: Real = 0,
  6285. * lookback: Integral = None, # <<<<<<<<<<<<<<
  6286. * ):
  6287. * """Straightforward Dynamic-Programming. For each index i, find least-costly encoding of
  6288. */
  6289. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  6290. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  6291. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, i); __PYX_ERR(0, 293, __pyx_L3_error) }
  6292. }
  6293. } else {
  6294. switch (__pyx_nargs) {
  6295. case 5:
  6296. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  6297. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 293, __pyx_L3_error)
  6298. CYTHON_FALLTHROUGH;
  6299. case 4:
  6300. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6301. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 293, __pyx_L3_error)
  6302. CYTHON_FALLTHROUGH;
  6303. case 3:
  6304. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6305. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 293, __pyx_L3_error)
  6306. CYTHON_FALLTHROUGH;
  6307. case 2:
  6308. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6309. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 293, __pyx_L3_error)
  6310. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6311. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 293, __pyx_L3_error)
  6312. break;
  6313. default: goto __pyx_L5_argtuple_error;
  6314. }
  6315. if (!values[2]) values[2] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  6316. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  6317. }
  6318. __pyx_v_deltas = values[0];
  6319. __pyx_v_coords = values[1];
  6320. __pyx_v_forced = ((PyObject*)values[2]);
  6321. if (values[3]) {
  6322. __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error)
  6323. } else {
  6324. __pyx_v_tolerance = ((double)((double)0.0));
  6325. }
  6326. __pyx_v_lookback = values[4];
  6327. }
  6328. goto __pyx_L6_skip;
  6329. __pyx_L5_argtuple_error:;
  6330. __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 293, __pyx_L3_error)
  6331. __pyx_L6_skip:;
  6332. goto __pyx_L4_argument_unpacking_done;
  6333. __pyx_L3_error:;
  6334. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6335. Py_XDECREF(values[__pyx_temp]);
  6336. }
  6337. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6338. __Pyx_RefNannyFinishContext();
  6339. return NULL;
  6340. __pyx_L4_argument_unpacking_done:;
  6341. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_forced), (&PySet_Type), 1, "forced", 1))) __PYX_ERR(0, 305, __pyx_L1_error)
  6342. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_6_iup_contour_optimize_dp(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_forced, __pyx_v_tolerance, __pyx_v_lookback);
  6343. /* "fontTools/varLib/iup.py":293
  6344. *
  6345. *
  6346. * @cython.locals( # <<<<<<<<<<<<<<
  6347. * i=cython.int,
  6348. * j=cython.int,
  6349. */
  6350. /* function exit code */
  6351. goto __pyx_L0;
  6352. __pyx_L1_error:;
  6353. __pyx_r = NULL;
  6354. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6355. Py_XDECREF(values[__pyx_temp]);
  6356. }
  6357. goto __pyx_L7_cleaned_up;
  6358. __pyx_L0:;
  6359. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6360. Py_XDECREF(values[__pyx_temp]);
  6361. }
  6362. __pyx_L7_cleaned_up:;
  6363. __Pyx_RefNannyFinishContext();
  6364. return __pyx_r;
  6365. }
  6366. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_6_iup_contour_optimize_dp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_forced, double __pyx_v_tolerance, PyObject *__pyx_v_lookback) {
  6367. int __pyx_v_i;
  6368. int __pyx_v_j;
  6369. double __pyx_v_best_cost;
  6370. double __pyx_v_cost;
  6371. Py_ssize_t __pyx_v_n;
  6372. PyObject *__pyx_v_costs = NULL;
  6373. PyObject *__pyx_v_chain = NULL;
  6374. PyObject *__pyx_r = NULL;
  6375. __Pyx_RefNannyDeclarations
  6376. Py_ssize_t __pyx_t_1;
  6377. int __pyx_t_2;
  6378. PyObject *__pyx_t_3 = NULL;
  6379. PyObject *__pyx_t_4 = NULL;
  6380. PyObject *__pyx_t_5 = NULL;
  6381. PyObject *__pyx_t_6 = NULL;
  6382. Py_ssize_t __pyx_t_7;
  6383. int __pyx_t_8;
  6384. double __pyx_t_9;
  6385. long __pyx_t_10;
  6386. Py_ssize_t __pyx_t_11;
  6387. Py_ssize_t __pyx_t_12;
  6388. int __pyx_t_13;
  6389. int __pyx_t_14;
  6390. int __pyx_t_15;
  6391. int __pyx_lineno = 0;
  6392. const char *__pyx_filename = NULL;
  6393. int __pyx_clineno = 0;
  6394. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp", 0);
  6395. __Pyx_INCREF(__pyx_v_lookback);
  6396. /* "fontTools/varLib/iup.py":318
  6397. * As major speedup, we stop looking further whenever we see a "forced" point."""
  6398. *
  6399. * n = len(deltas) # <<<<<<<<<<<<<<
  6400. * if lookback is None:
  6401. * lookback = n
  6402. */
  6403. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
  6404. __pyx_v_n = __pyx_t_1;
  6405. /* "fontTools/varLib/iup.py":319
  6406. *
  6407. * n = len(deltas)
  6408. * if lookback is None: # <<<<<<<<<<<<<<
  6409. * lookback = n
  6410. * lookback = min(lookback, MAX_LOOKBACK)
  6411. */
  6412. __pyx_t_2 = (__pyx_v_lookback == Py_None);
  6413. if (__pyx_t_2) {
  6414. /* "fontTools/varLib/iup.py":320
  6415. * n = len(deltas)
  6416. * if lookback is None:
  6417. * lookback = n # <<<<<<<<<<<<<<
  6418. * lookback = min(lookback, MAX_LOOKBACK)
  6419. * costs = {-1: 0}
  6420. */
  6421. __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
  6422. __Pyx_GOTREF(__pyx_t_3);
  6423. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6424. __pyx_t_3 = 0;
  6425. /* "fontTools/varLib/iup.py":319
  6426. *
  6427. * n = len(deltas)
  6428. * if lookback is None: # <<<<<<<<<<<<<<
  6429. * lookback = n
  6430. * lookback = min(lookback, MAX_LOOKBACK)
  6431. */
  6432. }
  6433. /* "fontTools/varLib/iup.py":321
  6434. * if lookback is None:
  6435. * lookback = n
  6436. * lookback = min(lookback, MAX_LOOKBACK) # <<<<<<<<<<<<<<
  6437. * costs = {-1: 0}
  6438. * chain = {-1: None}
  6439. */
  6440. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MAX_LOOKBACK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
  6441. __Pyx_GOTREF(__pyx_t_3);
  6442. __Pyx_INCREF(__pyx_v_lookback);
  6443. __pyx_t_4 = __pyx_v_lookback;
  6444. __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error)
  6445. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 321, __pyx_L1_error)
  6446. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6447. if (__pyx_t_2) {
  6448. __Pyx_INCREF(__pyx_t_3);
  6449. __pyx_t_5 = __pyx_t_3;
  6450. } else {
  6451. __Pyx_INCREF(__pyx_t_4);
  6452. __pyx_t_5 = __pyx_t_4;
  6453. }
  6454. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6455. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6456. __pyx_t_3 = __pyx_t_5;
  6457. __Pyx_INCREF(__pyx_t_3);
  6458. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6459. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6460. __pyx_t_3 = 0;
  6461. /* "fontTools/varLib/iup.py":322
  6462. * lookback = n
  6463. * lookback = min(lookback, MAX_LOOKBACK)
  6464. * costs = {-1: 0} # <<<<<<<<<<<<<<
  6465. * chain = {-1: None}
  6466. * for i in range(0, n):
  6467. */
  6468. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
  6469. __Pyx_GOTREF(__pyx_t_3);
  6470. if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_int_neg_1, __pyx_mstate_global->__pyx_int_0) < (0)) __PYX_ERR(0, 322, __pyx_L1_error)
  6471. __pyx_v_costs = ((PyObject*)__pyx_t_3);
  6472. __pyx_t_3 = 0;
  6473. /* "fontTools/varLib/iup.py":323
  6474. * lookback = min(lookback, MAX_LOOKBACK)
  6475. * costs = {-1: 0}
  6476. * chain = {-1: None} # <<<<<<<<<<<<<<
  6477. * for i in range(0, n):
  6478. * best_cost = costs[i - 1] + 1
  6479. */
  6480. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
  6481. __Pyx_GOTREF(__pyx_t_3);
  6482. if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_int_neg_1, Py_None) < (0)) __PYX_ERR(0, 323, __pyx_L1_error)
  6483. __pyx_v_chain = ((PyObject*)__pyx_t_3);
  6484. __pyx_t_3 = 0;
  6485. /* "fontTools/varLib/iup.py":324
  6486. * costs = {-1: 0}
  6487. * chain = {-1: None}
  6488. * for i in range(0, n): # <<<<<<<<<<<<<<
  6489. * best_cost = costs[i - 1] + 1
  6490. *
  6491. */
  6492. __pyx_t_1 = __pyx_v_n;
  6493. __pyx_t_7 = __pyx_t_1;
  6494. for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
  6495. __pyx_v_i = __pyx_t_8;
  6496. /* "fontTools/varLib/iup.py":325
  6497. * chain = {-1: None}
  6498. * for i in range(0, n):
  6499. * best_cost = costs[i - 1] + 1 # <<<<<<<<<<<<<<
  6500. *
  6501. * costs[i] = best_cost
  6502. */
  6503. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  6504. __Pyx_GOTREF(__pyx_t_3);
  6505. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 325, __pyx_L1_error)
  6506. __Pyx_GOTREF(__pyx_t_5);
  6507. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6508. __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  6509. __Pyx_GOTREF(__pyx_t_3);
  6510. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6511. __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error)
  6512. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6513. __pyx_v_best_cost = __pyx_t_9;
  6514. /* "fontTools/varLib/iup.py":327
  6515. * best_cost = costs[i - 1] + 1
  6516. *
  6517. * costs[i] = best_cost # <<<<<<<<<<<<<<
  6518. * chain[i] = i - 1
  6519. *
  6520. */
  6521. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_best_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
  6522. __Pyx_GOTREF(__pyx_t_3);
  6523. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
  6524. __Pyx_GOTREF(__pyx_t_5);
  6525. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 327, __pyx_L1_error)
  6526. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6527. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6528. /* "fontTools/varLib/iup.py":328
  6529. *
  6530. * costs[i] = best_cost
  6531. * chain[i] = i - 1 # <<<<<<<<<<<<<<
  6532. *
  6533. * if i - 1 in forced:
  6534. */
  6535. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
  6536. __Pyx_GOTREF(__pyx_t_3);
  6537. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
  6538. __Pyx_GOTREF(__pyx_t_5);
  6539. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 328, __pyx_L1_error)
  6540. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6541. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6542. /* "fontTools/varLib/iup.py":330
  6543. * chain[i] = i - 1
  6544. *
  6545. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6546. * continue
  6547. *
  6548. */
  6549. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  6550. __Pyx_GOTREF(__pyx_t_3);
  6551. if (unlikely(__pyx_v_forced == Py_None)) {
  6552. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6553. __PYX_ERR(0, 330, __pyx_L1_error)
  6554. }
  6555. __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_forced, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 330, __pyx_L1_error)
  6556. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6557. if (__pyx_t_2) {
  6558. /* "fontTools/varLib/iup.py":331
  6559. *
  6560. * if i - 1 in forced:
  6561. * continue # <<<<<<<<<<<<<<
  6562. *
  6563. * for j in range(i - 2, max(i - lookback, -2), -1):
  6564. */
  6565. goto __pyx_L4_continue;
  6566. /* "fontTools/varLib/iup.py":330
  6567. * chain[i] = i - 1
  6568. *
  6569. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6570. * continue
  6571. *
  6572. */
  6573. }
  6574. /* "fontTools/varLib/iup.py":333
  6575. * continue
  6576. *
  6577. * for j in range(i - 2, max(i - lookback, -2), -1): # <<<<<<<<<<<<<<
  6578. * cost = costs[j] + 1
  6579. *
  6580. */
  6581. __pyx_t_10 = -2L;
  6582. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  6583. __Pyx_GOTREF(__pyx_t_3);
  6584. __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_v_lookback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
  6585. __Pyx_GOTREF(__pyx_t_5);
  6586. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6587. __pyx_t_4 = __Pyx_PyLong_From_long(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
  6588. __Pyx_GOTREF(__pyx_t_4);
  6589. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
  6590. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6591. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 333, __pyx_L1_error)
  6592. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6593. if (__pyx_t_2) {
  6594. __pyx_t_6 = __Pyx_PyLong_From_long(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
  6595. __Pyx_GOTREF(__pyx_t_6);
  6596. __pyx_t_3 = __pyx_t_6;
  6597. __pyx_t_6 = 0;
  6598. } else {
  6599. __Pyx_INCREF(__pyx_t_5);
  6600. __pyx_t_3 = __pyx_t_5;
  6601. }
  6602. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6603. __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error)
  6604. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6605. __pyx_t_12 = __pyx_t_11;
  6606. for (__pyx_t_13 = (__pyx_v_i - 2); __pyx_t_13 > __pyx_t_12; __pyx_t_13-=1) {
  6607. __pyx_v_j = __pyx_t_13;
  6608. /* "fontTools/varLib/iup.py":334
  6609. *
  6610. * for j in range(i - 2, max(i - lookback, -2), -1):
  6611. * cost = costs[j] + 1 # <<<<<<<<<<<<<<
  6612. *
  6613. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6614. */
  6615. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
  6616. __Pyx_GOTREF(__pyx_t_3);
  6617. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
  6618. __Pyx_GOTREF(__pyx_t_5);
  6619. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6620. __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
  6621. __Pyx_GOTREF(__pyx_t_3);
  6622. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6623. __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 334, __pyx_L1_error)
  6624. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6625. __pyx_v_cost = __pyx_t_9;
  6626. /* "fontTools/varLib/iup.py":336
  6627. * cost = costs[j] + 1
  6628. *
  6629. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  6630. * costs[i] = best_cost = cost
  6631. * chain[i] = j
  6632. */
  6633. __pyx_t_14 = (__pyx_v_cost < __pyx_v_best_cost);
  6634. if (__pyx_t_14) {
  6635. } else {
  6636. __pyx_t_2 = __pyx_t_14;
  6637. goto __pyx_L10_bool_binop_done;
  6638. }
  6639. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
  6640. __Pyx_GOTREF(__pyx_t_3);
  6641. __pyx_t_15 = __pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(__pyx_v_deltas, __pyx_v_coords, __pyx_v_j, __pyx_v_i, __pyx_t_3); if (unlikely(__pyx_t_15 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 336, __pyx_L1_error)
  6642. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6643. __pyx_t_14 = (__pyx_t_15 != 0);
  6644. __pyx_t_2 = __pyx_t_14;
  6645. __pyx_L10_bool_binop_done:;
  6646. if (__pyx_t_2) {
  6647. /* "fontTools/varLib/iup.py":337
  6648. *
  6649. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6650. * costs[i] = best_cost = cost # <<<<<<<<<<<<<<
  6651. * chain[i] = j
  6652. *
  6653. */
  6654. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
  6655. __Pyx_GOTREF(__pyx_t_3);
  6656. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
  6657. __Pyx_GOTREF(__pyx_t_5);
  6658. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 337, __pyx_L1_error)
  6659. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6660. __pyx_v_best_cost = __pyx_v_cost;
  6661. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6662. /* "fontTools/varLib/iup.py":338
  6663. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6664. * costs[i] = best_cost = cost
  6665. * chain[i] = j # <<<<<<<<<<<<<<
  6666. *
  6667. * if j in forced:
  6668. */
  6669. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
  6670. __Pyx_GOTREF(__pyx_t_3);
  6671. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
  6672. __Pyx_GOTREF(__pyx_t_5);
  6673. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 338, __pyx_L1_error)
  6674. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6675. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6676. /* "fontTools/varLib/iup.py":336
  6677. * cost = costs[j] + 1
  6678. *
  6679. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  6680. * costs[i] = best_cost = cost
  6681. * chain[i] = j
  6682. */
  6683. }
  6684. /* "fontTools/varLib/iup.py":340
  6685. * chain[i] = j
  6686. *
  6687. * if j in forced: # <<<<<<<<<<<<<<
  6688. * break
  6689. *
  6690. */
  6691. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
  6692. __Pyx_GOTREF(__pyx_t_3);
  6693. if (unlikely(__pyx_v_forced == Py_None)) {
  6694. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6695. __PYX_ERR(0, 340, __pyx_L1_error)
  6696. }
  6697. __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_forced, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 340, __pyx_L1_error)
  6698. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6699. if (__pyx_t_2) {
  6700. /* "fontTools/varLib/iup.py":341
  6701. *
  6702. * if j in forced:
  6703. * break # <<<<<<<<<<<<<<
  6704. *
  6705. * return chain, costs
  6706. */
  6707. goto __pyx_L8_break;
  6708. /* "fontTools/varLib/iup.py":340
  6709. * chain[i] = j
  6710. *
  6711. * if j in forced: # <<<<<<<<<<<<<<
  6712. * break
  6713. *
  6714. */
  6715. }
  6716. }
  6717. __pyx_L8_break:;
  6718. __pyx_L4_continue:;
  6719. }
  6720. /* "fontTools/varLib/iup.py":343
  6721. * break
  6722. *
  6723. * return chain, costs # <<<<<<<<<<<<<<
  6724. *
  6725. *
  6726. */
  6727. __Pyx_XDECREF(__pyx_r);
  6728. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
  6729. __Pyx_GOTREF(__pyx_t_3);
  6730. __Pyx_INCREF(__pyx_v_chain);
  6731. __Pyx_GIVEREF(__pyx_v_chain);
  6732. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chain) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
  6733. __Pyx_INCREF(__pyx_v_costs);
  6734. __Pyx_GIVEREF(__pyx_v_costs);
  6735. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_costs) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
  6736. __pyx_r = __pyx_t_3;
  6737. __pyx_t_3 = 0;
  6738. goto __pyx_L0;
  6739. /* "fontTools/varLib/iup.py":293
  6740. *
  6741. *
  6742. * @cython.locals( # <<<<<<<<<<<<<<
  6743. * i=cython.int,
  6744. * j=cython.int,
  6745. */
  6746. /* function exit code */
  6747. __pyx_L1_error:;
  6748. __Pyx_XDECREF(__pyx_t_3);
  6749. __Pyx_XDECREF(__pyx_t_4);
  6750. __Pyx_XDECREF(__pyx_t_5);
  6751. __Pyx_XDECREF(__pyx_t_6);
  6752. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6753. __pyx_r = NULL;
  6754. __pyx_L0:;
  6755. __Pyx_XDECREF(__pyx_v_costs);
  6756. __Pyx_XDECREF(__pyx_v_chain);
  6757. __Pyx_XDECREF(__pyx_v_lookback);
  6758. __Pyx_XGIVEREF(__pyx_r);
  6759. __Pyx_RefNannyFinishContext();
  6760. return __pyx_r;
  6761. }
  6762. /* "fontTools/varLib/iup.py":346
  6763. *
  6764. *
  6765. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  6766. * """Rotate list by k items forward. Ie. item at position 0 will be
  6767. * at position k in returned list. Negative k is allowed."""
  6768. */
  6769. /* Python wrapper */
  6770. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_9_rot_list(PyObject *__pyx_self,
  6771. #if CYTHON_METH_FASTCALL
  6772. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6773. #else
  6774. PyObject *__pyx_args, PyObject *__pyx_kwds
  6775. #endif
  6776. ); /*proto*/
  6777. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_8_rot_list, "_rot_list(list l: list, int k: int)\n\nRotate list by k items forward. Ie. item at position 0 will be\nat position k in returned list. Negative k is allowed.");
  6778. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_9_rot_list = {"_rot_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_9_rot_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_8_rot_list};
  6779. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_9_rot_list(PyObject *__pyx_self,
  6780. #if CYTHON_METH_FASTCALL
  6781. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6782. #else
  6783. PyObject *__pyx_args, PyObject *__pyx_kwds
  6784. #endif
  6785. ) {
  6786. PyObject *__pyx_v_l = 0;
  6787. PyObject *__pyx_v_k = 0;
  6788. #if !CYTHON_METH_FASTCALL
  6789. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6790. #endif
  6791. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6792. PyObject* values[2] = {0,0};
  6793. int __pyx_lineno = 0;
  6794. const char *__pyx_filename = NULL;
  6795. int __pyx_clineno = 0;
  6796. PyObject *__pyx_r = 0;
  6797. __Pyx_RefNannyDeclarations
  6798. __Pyx_RefNannySetupContext("_rot_list (wrapper)", 0);
  6799. #if !CYTHON_METH_FASTCALL
  6800. #if CYTHON_ASSUME_SAFE_SIZE
  6801. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6802. #else
  6803. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6804. #endif
  6805. #endif
  6806. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6807. {
  6808. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_l,&__pyx_mstate_global->__pyx_n_u_k,0};
  6809. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6810. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 346, __pyx_L3_error)
  6811. if (__pyx_kwds_len > 0) {
  6812. switch (__pyx_nargs) {
  6813. case 2:
  6814. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6815. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 346, __pyx_L3_error)
  6816. CYTHON_FALLTHROUGH;
  6817. case 1:
  6818. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6819. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error)
  6820. CYTHON_FALLTHROUGH;
  6821. case 0: break;
  6822. default: goto __pyx_L5_argtuple_error;
  6823. }
  6824. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6825. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_rot_list", 0) < (0)) __PYX_ERR(0, 346, __pyx_L3_error)
  6826. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  6827. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, i); __PYX_ERR(0, 346, __pyx_L3_error) }
  6828. }
  6829. } else if (unlikely(__pyx_nargs != 2)) {
  6830. goto __pyx_L5_argtuple_error;
  6831. } else {
  6832. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6833. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error)
  6834. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6835. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 346, __pyx_L3_error)
  6836. }
  6837. __pyx_v_l = ((PyObject*)values[0]);
  6838. if (__Pyx_PyInt_FromNumber(&values[1], "k", 0) < (0)) __PYX_ERR(0, 346, __pyx_L3_error)
  6839. __pyx_v_k = ((PyObject*)values[1]);
  6840. }
  6841. goto __pyx_L6_skip;
  6842. __pyx_L5_argtuple_error:;
  6843. __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 346, __pyx_L3_error)
  6844. __pyx_L6_skip:;
  6845. goto __pyx_L4_argument_unpacking_done;
  6846. __pyx_L3_error:;
  6847. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6848. Py_XDECREF(values[__pyx_temp]);
  6849. }
  6850. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6851. __Pyx_RefNannyFinishContext();
  6852. return NULL;
  6853. __pyx_L4_argument_unpacking_done:;
  6854. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l), (&PyList_Type), 0, "l", 2))) __PYX_ERR(0, 346, __pyx_L1_error)
  6855. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyLong_Type), 0, "k", 2))) __PYX_ERR(0, 346, __pyx_L1_error)
  6856. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_8_rot_list(__pyx_self, __pyx_v_l, __pyx_v_k);
  6857. /* function exit code */
  6858. goto __pyx_L0;
  6859. __pyx_L1_error:;
  6860. __pyx_r = NULL;
  6861. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6862. Py_XDECREF(values[__pyx_temp]);
  6863. }
  6864. goto __pyx_L7_cleaned_up;
  6865. __pyx_L0:;
  6866. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6867. Py_XDECREF(values[__pyx_temp]);
  6868. }
  6869. __pyx_L7_cleaned_up:;
  6870. __Pyx_RefNannyFinishContext();
  6871. return __pyx_r;
  6872. }
  6873. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k) {
  6874. PyObject *__pyx_v_n = NULL;
  6875. PyObject *__pyx_r = NULL;
  6876. __Pyx_RefNannyDeclarations
  6877. Py_ssize_t __pyx_t_1;
  6878. PyObject *__pyx_t_2 = NULL;
  6879. int __pyx_t_3;
  6880. int __pyx_t_4;
  6881. Py_ssize_t __pyx_t_5;
  6882. PyObject *__pyx_t_6 = NULL;
  6883. PyObject *__pyx_t_7 = NULL;
  6884. int __pyx_lineno = 0;
  6885. const char *__pyx_filename = NULL;
  6886. int __pyx_clineno = 0;
  6887. __Pyx_RefNannySetupContext("_rot_list", 0);
  6888. __Pyx_INCREF(__pyx_v_k);
  6889. /* "fontTools/varLib/iup.py":349
  6890. * """Rotate list by k items forward. Ie. item at position 0 will be
  6891. * at position k in returned list. Negative k is allowed."""
  6892. * n = len(l) # <<<<<<<<<<<<<<
  6893. * k %= n
  6894. * if not k:
  6895. */
  6896. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_l); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 349, __pyx_L1_error)
  6897. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  6898. __Pyx_GOTREF(__pyx_t_2);
  6899. __pyx_v_n = __pyx_t_2;
  6900. __pyx_t_2 = 0;
  6901. /* "fontTools/varLib/iup.py":350
  6902. * at position k in returned list. Negative k is allowed."""
  6903. * n = len(l)
  6904. * k %= n # <<<<<<<<<<<<<<
  6905. * if not k:
  6906. * return l
  6907. */
  6908. __pyx_t_2 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
  6909. __Pyx_GOTREF(__pyx_t_2);
  6910. if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 350, __pyx_L1_error)
  6911. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_2));
  6912. __pyx_t_2 = 0;
  6913. /* "fontTools/varLib/iup.py":351
  6914. * n = len(l)
  6915. * k %= n
  6916. * if not k: # <<<<<<<<<<<<<<
  6917. * return l
  6918. * return l[n - k :] + l[: n - k]
  6919. */
  6920. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 351, __pyx_L1_error)
  6921. __pyx_t_4 = (!__pyx_t_3);
  6922. if (__pyx_t_4) {
  6923. /* "fontTools/varLib/iup.py":352
  6924. * k %= n
  6925. * if not k:
  6926. * return l # <<<<<<<<<<<<<<
  6927. * return l[n - k :] + l[: n - k]
  6928. *
  6929. */
  6930. __Pyx_XDECREF(__pyx_r);
  6931. __Pyx_INCREF(__pyx_v_l);
  6932. __pyx_r = __pyx_v_l;
  6933. goto __pyx_L0;
  6934. /* "fontTools/varLib/iup.py":351
  6935. * n = len(l)
  6936. * k %= n
  6937. * if not k: # <<<<<<<<<<<<<<
  6938. * return l
  6939. * return l[n - k :] + l[: n - k]
  6940. */
  6941. }
  6942. /* "fontTools/varLib/iup.py":353
  6943. * if not k:
  6944. * return l
  6945. * return l[n - k :] + l[: n - k] # <<<<<<<<<<<<<<
  6946. *
  6947. *
  6948. */
  6949. __Pyx_XDECREF(__pyx_r);
  6950. __pyx_t_2 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
  6951. __Pyx_GOTREF(__pyx_t_2);
  6952. __pyx_t_4 = (__pyx_t_2 == Py_None);
  6953. if (__pyx_t_4) {
  6954. __pyx_t_1 = 0;
  6955. } else {
  6956. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L1_error)
  6957. __pyx_t_1 = __pyx_t_5;
  6958. }
  6959. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6960. __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_l, __pyx_t_1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
  6961. __Pyx_GOTREF(__pyx_t_2);
  6962. __pyx_t_6 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error)
  6963. __Pyx_GOTREF(__pyx_t_6);
  6964. __pyx_t_4 = (__pyx_t_6 == Py_None);
  6965. if (__pyx_t_4) {
  6966. __pyx_t_1 = PY_SSIZE_T_MAX;
  6967. } else {
  6968. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L1_error)
  6969. __pyx_t_1 = __pyx_t_5;
  6970. }
  6971. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6972. __pyx_t_6 = __Pyx_PyList_GetSlice(__pyx_v_l, 0, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error)
  6973. __Pyx_GOTREF(__pyx_t_6);
  6974. __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error)
  6975. __Pyx_GOTREF(__pyx_t_7);
  6976. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6977. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6978. __pyx_r = __pyx_t_7;
  6979. __pyx_t_7 = 0;
  6980. goto __pyx_L0;
  6981. /* "fontTools/varLib/iup.py":346
  6982. *
  6983. *
  6984. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  6985. * """Rotate list by k items forward. Ie. item at position 0 will be
  6986. * at position k in returned list. Negative k is allowed."""
  6987. */
  6988. /* function exit code */
  6989. __pyx_L1_error:;
  6990. __Pyx_XDECREF(__pyx_t_2);
  6991. __Pyx_XDECREF(__pyx_t_6);
  6992. __Pyx_XDECREF(__pyx_t_7);
  6993. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6994. __pyx_r = NULL;
  6995. __pyx_L0:;
  6996. __Pyx_XDECREF(__pyx_v_n);
  6997. __Pyx_XDECREF(__pyx_v_k);
  6998. __Pyx_XGIVEREF(__pyx_r);
  6999. __Pyx_RefNannyFinishContext();
  7000. return __pyx_r;
  7001. }
  7002. /* "fontTools/varLib/iup.py":356
  7003. *
  7004. *
  7005. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  7006. * k %= n
  7007. * if not k:
  7008. */
  7009. /* Python wrapper */
  7010. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_11_rot_set(PyObject *__pyx_self,
  7011. #if CYTHON_METH_FASTCALL
  7012. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7013. #else
  7014. PyObject *__pyx_args, PyObject *__pyx_kwds
  7015. #endif
  7016. ); /*proto*/
  7017. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_10_rot_set, "_rot_set(set s: set, int k: int, int n: int)");
  7018. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_11_rot_set = {"_rot_set", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_11_rot_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_10_rot_set};
  7019. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_11_rot_set(PyObject *__pyx_self,
  7020. #if CYTHON_METH_FASTCALL
  7021. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7022. #else
  7023. PyObject *__pyx_args, PyObject *__pyx_kwds
  7024. #endif
  7025. ) {
  7026. PyObject *__pyx_v_s = 0;
  7027. PyObject *__pyx_v_k = 0;
  7028. PyObject *__pyx_v_n = 0;
  7029. #if !CYTHON_METH_FASTCALL
  7030. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7031. #endif
  7032. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7033. PyObject* values[3] = {0,0,0};
  7034. int __pyx_lineno = 0;
  7035. const char *__pyx_filename = NULL;
  7036. int __pyx_clineno = 0;
  7037. PyObject *__pyx_r = 0;
  7038. __Pyx_RefNannyDeclarations
  7039. __Pyx_RefNannySetupContext("_rot_set (wrapper)", 0);
  7040. #if !CYTHON_METH_FASTCALL
  7041. #if CYTHON_ASSUME_SAFE_SIZE
  7042. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7043. #else
  7044. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7045. #endif
  7046. #endif
  7047. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7048. {
  7049. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_s,&__pyx_mstate_global->__pyx_n_u_k,&__pyx_mstate_global->__pyx_n_u_n,0};
  7050. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7051. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 356, __pyx_L3_error)
  7052. if (__pyx_kwds_len > 0) {
  7053. switch (__pyx_nargs) {
  7054. case 3:
  7055. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7056. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 356, __pyx_L3_error)
  7057. CYTHON_FALLTHROUGH;
  7058. case 2:
  7059. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7060. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 356, __pyx_L3_error)
  7061. CYTHON_FALLTHROUGH;
  7062. case 1:
  7063. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7064. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 356, __pyx_L3_error)
  7065. CYTHON_FALLTHROUGH;
  7066. case 0: break;
  7067. default: goto __pyx_L5_argtuple_error;
  7068. }
  7069. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7070. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_rot_set", 0) < (0)) __PYX_ERR(0, 356, __pyx_L3_error)
  7071. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  7072. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, i); __PYX_ERR(0, 356, __pyx_L3_error) }
  7073. }
  7074. } else if (unlikely(__pyx_nargs != 3)) {
  7075. goto __pyx_L5_argtuple_error;
  7076. } else {
  7077. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7078. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 356, __pyx_L3_error)
  7079. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7080. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 356, __pyx_L3_error)
  7081. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7082. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 356, __pyx_L3_error)
  7083. }
  7084. __pyx_v_s = ((PyObject*)values[0]);
  7085. if (__Pyx_PyInt_FromNumber(&values[1], "k", 0) < (0)) __PYX_ERR(0, 356, __pyx_L3_error)
  7086. __pyx_v_k = ((PyObject*)values[1]);
  7087. if (__Pyx_PyInt_FromNumber(&values[2], "n", 0) < (0)) __PYX_ERR(0, 356, __pyx_L3_error)
  7088. __pyx_v_n = ((PyObject*)values[2]);
  7089. }
  7090. goto __pyx_L6_skip;
  7091. __pyx_L5_argtuple_error:;
  7092. __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 356, __pyx_L3_error)
  7093. __pyx_L6_skip:;
  7094. goto __pyx_L4_argument_unpacking_done;
  7095. __pyx_L3_error:;
  7096. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7097. Py_XDECREF(values[__pyx_temp]);
  7098. }
  7099. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7100. __Pyx_RefNannyFinishContext();
  7101. return NULL;
  7102. __pyx_L4_argument_unpacking_done:;
  7103. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PySet_Type), 0, "s", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7104. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyLong_Type), 0, "k", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7105. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), (&PyLong_Type), 0, "n", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7106. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_10_rot_set(__pyx_self, __pyx_v_s, __pyx_v_k, __pyx_v_n);
  7107. /* function exit code */
  7108. goto __pyx_L0;
  7109. __pyx_L1_error:;
  7110. __pyx_r = NULL;
  7111. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7112. Py_XDECREF(values[__pyx_temp]);
  7113. }
  7114. goto __pyx_L7_cleaned_up;
  7115. __pyx_L0:;
  7116. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7117. Py_XDECREF(values[__pyx_temp]);
  7118. }
  7119. __pyx_L7_cleaned_up:;
  7120. __Pyx_RefNannyFinishContext();
  7121. return __pyx_r;
  7122. }
  7123. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_10_rot_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_k, PyObject *__pyx_v_n) {
  7124. PyObject *__pyx_8genexpr2__pyx_v_v = NULL;
  7125. PyObject *__pyx_r = NULL;
  7126. __Pyx_RefNannyDeclarations
  7127. PyObject *__pyx_t_1 = NULL;
  7128. int __pyx_t_2;
  7129. int __pyx_t_3;
  7130. PyObject *__pyx_t_4 = NULL;
  7131. Py_ssize_t __pyx_t_5;
  7132. Py_ssize_t __pyx_t_6;
  7133. int __pyx_t_7;
  7134. PyObject *__pyx_t_8 = NULL;
  7135. int __pyx_t_9;
  7136. PyObject *__pyx_t_10 = NULL;
  7137. int __pyx_lineno = 0;
  7138. const char *__pyx_filename = NULL;
  7139. int __pyx_clineno = 0;
  7140. __Pyx_RefNannySetupContext("_rot_set", 0);
  7141. __Pyx_INCREF(__pyx_v_k);
  7142. /* "fontTools/varLib/iup.py":357
  7143. *
  7144. * def _rot_set(s: set, k: int, n: int):
  7145. * k %= n # <<<<<<<<<<<<<<
  7146. * if not k:
  7147. * return s
  7148. */
  7149. __pyx_t_1 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  7150. __Pyx_GOTREF(__pyx_t_1);
  7151. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_1));
  7152. __pyx_t_1 = 0;
  7153. /* "fontTools/varLib/iup.py":358
  7154. * def _rot_set(s: set, k: int, n: int):
  7155. * k %= n
  7156. * if not k: # <<<<<<<<<<<<<<
  7157. * return s
  7158. * return {(v + k) % n for v in s}
  7159. */
  7160. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 358, __pyx_L1_error)
  7161. __pyx_t_3 = (!__pyx_t_2);
  7162. if (__pyx_t_3) {
  7163. /* "fontTools/varLib/iup.py":359
  7164. * k %= n
  7165. * if not k:
  7166. * return s # <<<<<<<<<<<<<<
  7167. * return {(v + k) % n for v in s}
  7168. *
  7169. */
  7170. __Pyx_XDECREF(__pyx_r);
  7171. __Pyx_INCREF(__pyx_v_s);
  7172. __pyx_r = __pyx_v_s;
  7173. goto __pyx_L0;
  7174. /* "fontTools/varLib/iup.py":358
  7175. * def _rot_set(s: set, k: int, n: int):
  7176. * k %= n
  7177. * if not k: # <<<<<<<<<<<<<<
  7178. * return s
  7179. * return {(v + k) % n for v in s}
  7180. */
  7181. }
  7182. /* "fontTools/varLib/iup.py":360
  7183. * if not k:
  7184. * return s
  7185. * return {(v + k) % n for v in s} # <<<<<<<<<<<<<<
  7186. *
  7187. *
  7188. */
  7189. __Pyx_XDECREF(__pyx_r);
  7190. { /* enter inner scope */
  7191. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L6_error)
  7192. __Pyx_GOTREF(__pyx_t_1);
  7193. __pyx_t_5 = 0;
  7194. __pyx_t_8 = __Pyx_set_iterator(__pyx_v_s, 1, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L6_error)
  7195. __Pyx_GOTREF(__pyx_t_8);
  7196. __Pyx_XDECREF(__pyx_t_4);
  7197. __pyx_t_4 = __pyx_t_8;
  7198. __pyx_t_8 = 0;
  7199. while (1) {
  7200. __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, __pyx_t_7);
  7201. if (unlikely(__pyx_t_9 == 0)) break;
  7202. if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 360, __pyx_L6_error)
  7203. __Pyx_GOTREF(__pyx_t_8);
  7204. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_v, __pyx_t_8);
  7205. __pyx_t_8 = 0;
  7206. __pyx_t_8 = PyNumber_Add(__pyx_8genexpr2__pyx_v_v, __pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L6_error)
  7207. __Pyx_GOTREF(__pyx_t_8);
  7208. __pyx_t_10 = PyNumber_Remainder(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 360, __pyx_L6_error)
  7209. __Pyx_GOTREF(__pyx_t_10);
  7210. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7211. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 360, __pyx_L6_error)
  7212. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7213. }
  7214. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7215. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7216. goto __pyx_L9_exit_scope;
  7217. __pyx_L6_error:;
  7218. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7219. goto __pyx_L1_error;
  7220. __pyx_L9_exit_scope:;
  7221. } /* exit inner scope */
  7222. __pyx_r = __pyx_t_1;
  7223. __pyx_t_1 = 0;
  7224. goto __pyx_L0;
  7225. /* "fontTools/varLib/iup.py":356
  7226. *
  7227. *
  7228. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  7229. * k %= n
  7230. * if not k:
  7231. */
  7232. /* function exit code */
  7233. __pyx_L1_error:;
  7234. __Pyx_XDECREF(__pyx_t_1);
  7235. __Pyx_XDECREF(__pyx_t_4);
  7236. __Pyx_XDECREF(__pyx_t_8);
  7237. __Pyx_XDECREF(__pyx_t_10);
  7238. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7239. __pyx_r = NULL;
  7240. __pyx_L0:;
  7241. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v);
  7242. __Pyx_XDECREF(__pyx_v_k);
  7243. __Pyx_XGIVEREF(__pyx_r);
  7244. __Pyx_RefNannyFinishContext();
  7245. return __pyx_r;
  7246. }
  7247. /* "fontTools/varLib/iup.py":363
  7248. *
  7249. *
  7250. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  7251. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  7252. * ) -> _DeltaOrNoneSegment:
  7253. */
  7254. /* Python wrapper */
  7255. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize(PyObject *__pyx_self,
  7256. #if CYTHON_METH_FASTCALL
  7257. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7258. #else
  7259. PyObject *__pyx_args, PyObject *__pyx_kwds
  7260. #endif
  7261. ); /*proto*/
  7262. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_12iup_contour_optimize, "iup_contour_optimize(deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0) -> _DeltaOrNoneSegment\n\nFor contour with coordinates `coords`, optimize a set of delta\nvalues `deltas` within error `tolerance`.\n\nReturns delta vector that has most number of None items instead of\nthe input delta.");
  7263. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_13iup_contour_optimize = {"iup_contour_optimize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_12iup_contour_optimize};
  7264. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize(PyObject *__pyx_self,
  7265. #if CYTHON_METH_FASTCALL
  7266. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7267. #else
  7268. PyObject *__pyx_args, PyObject *__pyx_kwds
  7269. #endif
  7270. ) {
  7271. PyObject *__pyx_v_deltas = 0;
  7272. PyObject *__pyx_v_coords = 0;
  7273. PyObject *__pyx_v_tolerance = 0;
  7274. #if !CYTHON_METH_FASTCALL
  7275. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7276. #endif
  7277. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7278. PyObject* values[3] = {0,0,0};
  7279. int __pyx_lineno = 0;
  7280. const char *__pyx_filename = NULL;
  7281. int __pyx_clineno = 0;
  7282. PyObject *__pyx_r = 0;
  7283. __Pyx_RefNannyDeclarations
  7284. __Pyx_RefNannySetupContext("iup_contour_optimize (wrapper)", 0);
  7285. #if !CYTHON_METH_FASTCALL
  7286. #if CYTHON_ASSUME_SAFE_SIZE
  7287. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7288. #else
  7289. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7290. #endif
  7291. #endif
  7292. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7293. {
  7294. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,&__pyx_mstate_global->__pyx_n_u_tolerance,0};
  7295. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7296. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 363, __pyx_L3_error)
  7297. if (__pyx_kwds_len > 0) {
  7298. switch (__pyx_nargs) {
  7299. case 3:
  7300. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7301. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 363, __pyx_L3_error)
  7302. CYTHON_FALLTHROUGH;
  7303. case 2:
  7304. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7305. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 363, __pyx_L3_error)
  7306. CYTHON_FALLTHROUGH;
  7307. case 1:
  7308. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7309. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 363, __pyx_L3_error)
  7310. CYTHON_FALLTHROUGH;
  7311. case 0: break;
  7312. default: goto __pyx_L5_argtuple_error;
  7313. }
  7314. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7315. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iup_contour_optimize", 0) < (0)) __PYX_ERR(0, 363, __pyx_L3_error)
  7316. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  7317. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  7318. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, i); __PYX_ERR(0, 363, __pyx_L3_error) }
  7319. }
  7320. } else {
  7321. switch (__pyx_nargs) {
  7322. case 3:
  7323. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7324. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 363, __pyx_L3_error)
  7325. CYTHON_FALLTHROUGH;
  7326. case 2:
  7327. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7328. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 363, __pyx_L3_error)
  7329. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7330. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 363, __pyx_L3_error)
  7331. break;
  7332. default: goto __pyx_L5_argtuple_error;
  7333. }
  7334. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  7335. }
  7336. __pyx_v_deltas = values[0];
  7337. __pyx_v_coords = values[1];
  7338. __pyx_v_tolerance = values[2];
  7339. }
  7340. goto __pyx_L6_skip;
  7341. __pyx_L5_argtuple_error:;
  7342. __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 363, __pyx_L3_error)
  7343. __pyx_L6_skip:;
  7344. goto __pyx_L4_argument_unpacking_done;
  7345. __pyx_L3_error:;
  7346. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7347. Py_XDECREF(values[__pyx_temp]);
  7348. }
  7349. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7350. __Pyx_RefNannyFinishContext();
  7351. return NULL;
  7352. __pyx_L4_argument_unpacking_done:;
  7353. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_12iup_contour_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  7354. /* function exit code */
  7355. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7356. Py_XDECREF(values[__pyx_temp]);
  7357. }
  7358. __Pyx_RefNannyFinishContext();
  7359. return __pyx_r;
  7360. }
  7361. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  7362. /* "fontTools/varLib/iup.py":378
  7363. *
  7364. * # If all are within tolerance distance of 0, encode nothing:
  7365. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7366. * return [None] * n
  7367. *
  7368. */
  7369. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7370. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  7371. PyObject *__pyx_r = NULL;
  7372. __Pyx_RefNannyDeclarations
  7373. int __pyx_lineno = 0;
  7374. const char *__pyx_filename = NULL;
  7375. int __pyx_clineno = 0;
  7376. __Pyx_RefNannySetupContext("genexpr", 0);
  7377. __pyx_cur_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  7378. if (unlikely(!__pyx_cur_scope)) {
  7379. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)Py_None);
  7380. __Pyx_INCREF(Py_None);
  7381. __PYX_ERR(0, 378, __pyx_L1_error)
  7382. } else {
  7383. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7384. }
  7385. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7386. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7387. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7388. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7389. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7390. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7391. {
  7392. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_locals_gene, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 378, __pyx_L1_error)
  7393. __Pyx_DECREF(__pyx_cur_scope);
  7394. __Pyx_RefNannyFinishContext();
  7395. return (PyObject *) gen;
  7396. }
  7397. /* function exit code */
  7398. __pyx_L1_error:;
  7399. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7400. __pyx_r = NULL;
  7401. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  7402. __Pyx_XGIVEREF(__pyx_r);
  7403. __Pyx_RefNannyFinishContext();
  7404. return __pyx_r;
  7405. }
  7406. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  7407. {
  7408. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  7409. PyObject *__pyx_r = NULL;
  7410. PyObject *__pyx_t_1 = NULL;
  7411. Py_ssize_t __pyx_t_2;
  7412. PyObject *(*__pyx_t_3)(PyObject *);
  7413. PyObject *__pyx_t_4 = NULL;
  7414. PyObject *__pyx_t_5 = NULL;
  7415. int __pyx_t_6;
  7416. int __pyx_t_7;
  7417. int __pyx_lineno = 0;
  7418. const char *__pyx_filename = NULL;
  7419. int __pyx_clineno = 0;
  7420. __Pyx_RefNannyDeclarations
  7421. __Pyx_RefNannySetupContext("genexpr", 0);
  7422. switch (__pyx_generator->resume_label) {
  7423. case 0: goto __pyx_L3_first_run;
  7424. default: /* CPython raises the right error here */
  7425. __Pyx_RefNannyFinishContext();
  7426. return NULL;
  7427. }
  7428. __pyx_L3_first_run:;
  7429. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 378, __pyx_L1_error)
  7430. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 378, __pyx_L1_error) }
  7431. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  7432. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  7433. __pyx_t_2 = 0;
  7434. __pyx_t_3 = NULL;
  7435. } else {
  7436. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
  7437. __Pyx_GOTREF(__pyx_t_1);
  7438. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
  7439. }
  7440. for (;;) {
  7441. if (likely(!__pyx_t_3)) {
  7442. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7443. {
  7444. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  7445. #if !CYTHON_ASSUME_SAFE_SIZE
  7446. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7447. #endif
  7448. if (__pyx_t_2 >= __pyx_temp) break;
  7449. }
  7450. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  7451. ++__pyx_t_2;
  7452. } else {
  7453. {
  7454. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  7455. #if !CYTHON_ASSUME_SAFE_SIZE
  7456. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7457. #endif
  7458. if (__pyx_t_2 >= __pyx_temp) break;
  7459. }
  7460. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7461. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  7462. #else
  7463. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  7464. #endif
  7465. ++__pyx_t_2;
  7466. }
  7467. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7468. } else {
  7469. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7470. if (unlikely(!__pyx_t_4)) {
  7471. PyObject* exc_type = PyErr_Occurred();
  7472. if (exc_type) {
  7473. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 378, __pyx_L1_error)
  7474. PyErr_Clear();
  7475. }
  7476. break;
  7477. }
  7478. }
  7479. __Pyx_GOTREF(__pyx_t_4);
  7480. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);
  7481. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_4);
  7482. __Pyx_GIVEREF(__pyx_t_4);
  7483. __pyx_t_4 = 0;
  7484. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_cur_scope->__pyx_v_p); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7485. __Pyx_GOTREF(__pyx_t_4);
  7486. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
  7487. __Pyx_GOTREF(__pyx_t_5);
  7488. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7489. __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7490. __Pyx_GOTREF(__pyx_t_4);
  7491. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7492. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 378, __pyx_L1_error) }
  7493. __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
  7494. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7495. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7496. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7497. __pyx_t_7 = (!__pyx_t_6);
  7498. if (__pyx_t_7) {
  7499. __Pyx_XDECREF(__pyx_r);
  7500. __Pyx_INCREF(Py_False);
  7501. __pyx_r = Py_False;
  7502. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7503. goto __pyx_L0;
  7504. }
  7505. }
  7506. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7507. /*else*/ {
  7508. __Pyx_XDECREF(__pyx_r);
  7509. __Pyx_INCREF(Py_True);
  7510. __pyx_r = Py_True;
  7511. goto __pyx_L0;
  7512. }
  7513. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  7514. /* function exit code */
  7515. goto __pyx_L0;
  7516. __pyx_L1_error:;
  7517. __Pyx_XDECREF(__pyx_t_1);
  7518. __Pyx_XDECREF(__pyx_t_4);
  7519. __Pyx_XDECREF(__pyx_t_5);
  7520. if (__Pyx_PyErr_Occurred()) {
  7521. __Pyx_Generator_Replace_StopIteration(0);
  7522. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7523. }
  7524. __pyx_L0:;
  7525. __Pyx_XGIVEREF(__pyx_r);
  7526. #if !CYTHON_USE_EXC_INFO_STACK
  7527. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  7528. #endif
  7529. __pyx_generator->resume_label = -1;
  7530. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  7531. __Pyx_RefNannyFinishContext();
  7532. return __pyx_r;
  7533. }
  7534. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  7535. /* "fontTools/varLib/iup.py":387
  7536. * # If all deltas are exactly the same, return just one (the first one):
  7537. * d0 = deltas[0]
  7538. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7539. * return [d0] + [None] * (n - 1)
  7540. *
  7541. */
  7542. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7543. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  7544. PyObject *__pyx_r = NULL;
  7545. __Pyx_RefNannyDeclarations
  7546. int __pyx_lineno = 0;
  7547. const char *__pyx_filename = NULL;
  7548. int __pyx_clineno = 0;
  7549. __Pyx_RefNannySetupContext("genexpr", 0);
  7550. __pyx_cur_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  7551. if (unlikely(!__pyx_cur_scope)) {
  7552. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)Py_None);
  7553. __Pyx_INCREF(Py_None);
  7554. __PYX_ERR(0, 387, __pyx_L1_error)
  7555. } else {
  7556. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7557. }
  7558. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7559. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7560. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7561. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7562. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7563. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7564. {
  7565. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_locals_gene, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 387, __pyx_L1_error)
  7566. __Pyx_DECREF(__pyx_cur_scope);
  7567. __Pyx_RefNannyFinishContext();
  7568. return (PyObject *) gen;
  7569. }
  7570. /* function exit code */
  7571. __pyx_L1_error:;
  7572. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7573. __pyx_r = NULL;
  7574. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  7575. __Pyx_XGIVEREF(__pyx_r);
  7576. __Pyx_RefNannyFinishContext();
  7577. return __pyx_r;
  7578. }
  7579. static PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  7580. {
  7581. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  7582. PyObject *__pyx_r = NULL;
  7583. PyObject *__pyx_t_1 = NULL;
  7584. Py_ssize_t __pyx_t_2;
  7585. PyObject *(*__pyx_t_3)(PyObject *);
  7586. PyObject *__pyx_t_4 = NULL;
  7587. int __pyx_t_5;
  7588. int __pyx_t_6;
  7589. int __pyx_lineno = 0;
  7590. const char *__pyx_filename = NULL;
  7591. int __pyx_clineno = 0;
  7592. __Pyx_RefNannyDeclarations
  7593. __Pyx_RefNannySetupContext("genexpr", 0);
  7594. switch (__pyx_generator->resume_label) {
  7595. case 0: goto __pyx_L3_first_run;
  7596. default: /* CPython raises the right error here */
  7597. __Pyx_RefNannyFinishContext();
  7598. return NULL;
  7599. }
  7600. __pyx_L3_first_run:;
  7601. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 387, __pyx_L1_error)
  7602. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 387, __pyx_L1_error) }
  7603. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  7604. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  7605. __pyx_t_2 = 0;
  7606. __pyx_t_3 = NULL;
  7607. } else {
  7608. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
  7609. __Pyx_GOTREF(__pyx_t_1);
  7610. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
  7611. }
  7612. for (;;) {
  7613. if (likely(!__pyx_t_3)) {
  7614. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7615. {
  7616. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  7617. #if !CYTHON_ASSUME_SAFE_SIZE
  7618. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7619. #endif
  7620. if (__pyx_t_2 >= __pyx_temp) break;
  7621. }
  7622. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  7623. ++__pyx_t_2;
  7624. } else {
  7625. {
  7626. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  7627. #if !CYTHON_ASSUME_SAFE_SIZE
  7628. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7629. #endif
  7630. if (__pyx_t_2 >= __pyx_temp) break;
  7631. }
  7632. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7633. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  7634. #else
  7635. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  7636. #endif
  7637. ++__pyx_t_2;
  7638. }
  7639. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
  7640. } else {
  7641. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7642. if (unlikely(!__pyx_t_4)) {
  7643. PyObject* exc_type = PyErr_Occurred();
  7644. if (exc_type) {
  7645. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 387, __pyx_L1_error)
  7646. PyErr_Clear();
  7647. }
  7648. break;
  7649. }
  7650. }
  7651. __Pyx_GOTREF(__pyx_t_4);
  7652. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_d);
  7653. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_4);
  7654. __Pyx_GIVEREF(__pyx_t_4);
  7655. __pyx_t_4 = 0;
  7656. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_d0)) { __Pyx_RaiseClosureNameError("d0"); __PYX_ERR(0, 387, __pyx_L1_error) }
  7657. __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_d0, __pyx_cur_scope->__pyx_v_d, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
  7658. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7659. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7660. __pyx_t_6 = (!__pyx_t_5);
  7661. if (__pyx_t_6) {
  7662. __Pyx_XDECREF(__pyx_r);
  7663. __Pyx_INCREF(Py_False);
  7664. __pyx_r = Py_False;
  7665. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7666. goto __pyx_L0;
  7667. }
  7668. }
  7669. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7670. /*else*/ {
  7671. __Pyx_XDECREF(__pyx_r);
  7672. __Pyx_INCREF(Py_True);
  7673. __pyx_r = Py_True;
  7674. goto __pyx_L0;
  7675. }
  7676. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  7677. /* function exit code */
  7678. goto __pyx_L0;
  7679. __pyx_L1_error:;
  7680. __Pyx_XDECREF(__pyx_t_1);
  7681. __Pyx_XDECREF(__pyx_t_4);
  7682. if (__Pyx_PyErr_Occurred()) {
  7683. __Pyx_Generator_Replace_StopIteration(0);
  7684. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7685. }
  7686. __pyx_L0:;
  7687. __Pyx_XGIVEREF(__pyx_r);
  7688. #if !CYTHON_USE_EXC_INFO_STACK
  7689. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  7690. #endif
  7691. __pyx_generator->resume_label = -1;
  7692. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  7693. __Pyx_RefNannyFinishContext();
  7694. return __pyx_r;
  7695. }
  7696. /* "fontTools/varLib/iup.py":363
  7697. *
  7698. *
  7699. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  7700. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  7701. * ) -> _DeltaOrNoneSegment:
  7702. */
  7703. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_12iup_contour_optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_tolerance) {
  7704. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_cur_scope;
  7705. PyObject *__pyx_v_n = NULL;
  7706. PyObject *__pyx_v_forced = NULL;
  7707. PyObject *__pyx_v_k = NULL;
  7708. PyObject *__pyx_v_chain = NULL;
  7709. PyObject *__pyx_v_costs = NULL;
  7710. PyObject *__pyx_v_solution = NULL;
  7711. PyObject *__pyx_v_i = NULL;
  7712. PyObject *__pyx_v_best_sol = NULL;
  7713. PyObject *__pyx_v_best_cost = NULL;
  7714. PyObject *__pyx_v_start = NULL;
  7715. PyObject *__pyx_v_cost = NULL;
  7716. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1 = 0;
  7717. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2 = 0;
  7718. PyObject *__pyx_8genexpr5__pyx_v_i = NULL;
  7719. PyObject *__pyx_8genexpr6__pyx_v_i = NULL;
  7720. PyObject *__pyx_r = NULL;
  7721. __Pyx_RefNannyDeclarations
  7722. Py_ssize_t __pyx_t_1;
  7723. PyObject *__pyx_t_2 = NULL;
  7724. PyObject *__pyx_t_3 = NULL;
  7725. int __pyx_t_4;
  7726. PyObject *__pyx_t_5 = NULL;
  7727. size_t __pyx_t_6;
  7728. PyObject *__pyx_t_7 = NULL;
  7729. PyObject *(*__pyx_t_8)(PyObject *);
  7730. int __pyx_t_9;
  7731. PyObject *(*__pyx_t_10)(PyObject *);
  7732. PyObject *__pyx_t_11 = NULL;
  7733. int __pyx_lineno = 0;
  7734. const char *__pyx_filename = NULL;
  7735. int __pyx_clineno = 0;
  7736. __Pyx_RefNannySetupContext("iup_contour_optimize", 0);
  7737. __pyx_cur_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(__pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  7738. if (unlikely(!__pyx_cur_scope)) {
  7739. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)Py_None);
  7740. __Pyx_INCREF(Py_None);
  7741. __PYX_ERR(0, 363, __pyx_L1_error)
  7742. } else {
  7743. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7744. }
  7745. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  7746. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  7747. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  7748. __Pyx_INCREF(__pyx_v_deltas);
  7749. __Pyx_INCREF(__pyx_v_coords);
  7750. /* "fontTools/varLib/iup.py":373
  7751. * """
  7752. *
  7753. * n = len(deltas) # <<<<<<<<<<<<<<
  7754. *
  7755. * # Get the easy cases out of the way:
  7756. */
  7757. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 373, __pyx_L1_error)
  7758. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
  7759. __Pyx_GOTREF(__pyx_t_2);
  7760. __pyx_v_n = __pyx_t_2;
  7761. __pyx_t_2 = 0;
  7762. /* "fontTools/varLib/iup.py":378
  7763. *
  7764. * # If all are within tolerance distance of 0, encode nothing:
  7765. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7766. * return [None] * n
  7767. *
  7768. */
  7769. __pyx_t_2 = __pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_deltas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
  7770. __Pyx_GOTREF(__pyx_t_2);
  7771. __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
  7772. __Pyx_GOTREF(__pyx_t_3);
  7773. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7774. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7775. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7776. if (__pyx_t_4) {
  7777. /* "fontTools/varLib/iup.py":379
  7778. * # If all are within tolerance distance of 0, encode nothing:
  7779. * if all(abs(complex(*p)) <= tolerance for p in deltas):
  7780. * return [None] * n # <<<<<<<<<<<<<<
  7781. *
  7782. * # If there's exactly one point, return it:
  7783. */
  7784. __Pyx_XDECREF(__pyx_r);
  7785. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  7786. __Pyx_GOTREF(__pyx_t_3);
  7787. __Pyx_INCREF(Py_None);
  7788. __Pyx_GIVEREF(Py_None);
  7789. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  7790. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 379, __pyx_L1_error)
  7791. __Pyx_GOTREF(__pyx_temp);
  7792. __Pyx_DECREF(__pyx_t_3);
  7793. __pyx_t_3 = __pyx_temp;
  7794. }
  7795. __pyx_r = __pyx_t_3;
  7796. __pyx_t_3 = 0;
  7797. goto __pyx_L0;
  7798. /* "fontTools/varLib/iup.py":378
  7799. *
  7800. * # If all are within tolerance distance of 0, encode nothing:
  7801. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7802. * return [None] * n
  7803. *
  7804. */
  7805. }
  7806. /* "fontTools/varLib/iup.py":382
  7807. *
  7808. * # If there's exactly one point, return it:
  7809. * if n == 1: # <<<<<<<<<<<<<<
  7810. * return deltas
  7811. *
  7812. */
  7813. __pyx_t_4 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 382, __pyx_L1_error)
  7814. if (__pyx_t_4) {
  7815. /* "fontTools/varLib/iup.py":383
  7816. * # If there's exactly one point, return it:
  7817. * if n == 1:
  7818. * return deltas # <<<<<<<<<<<<<<
  7819. *
  7820. * # If all deltas are exactly the same, return just one (the first one):
  7821. */
  7822. __Pyx_XDECREF(__pyx_r);
  7823. __Pyx_INCREF(__pyx_v_deltas);
  7824. __pyx_r = __pyx_v_deltas;
  7825. goto __pyx_L0;
  7826. /* "fontTools/varLib/iup.py":382
  7827. *
  7828. * # If there's exactly one point, return it:
  7829. * if n == 1: # <<<<<<<<<<<<<<
  7830. * return deltas
  7831. *
  7832. */
  7833. }
  7834. /* "fontTools/varLib/iup.py":386
  7835. *
  7836. * # If all deltas are exactly the same, return just one (the first one):
  7837. * d0 = deltas[0] # <<<<<<<<<<<<<<
  7838. * if all(d0 == d for d in deltas):
  7839. * return [d0] + [None] * (n - 1)
  7840. */
  7841. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_deltas, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
  7842. __Pyx_GOTREF(__pyx_t_3);
  7843. __Pyx_GIVEREF(__pyx_t_3);
  7844. __pyx_cur_scope->__pyx_v_d0 = __pyx_t_3;
  7845. __pyx_t_3 = 0;
  7846. /* "fontTools/varLib/iup.py":387
  7847. * # If all deltas are exactly the same, return just one (the first one):
  7848. * d0 = deltas[0]
  7849. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7850. * return [d0] + [None] * (n - 1)
  7851. *
  7852. */
  7853. __pyx_t_3 = __pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_deltas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
  7854. __Pyx_GOTREF(__pyx_t_3);
  7855. __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
  7856. __Pyx_GOTREF(__pyx_t_2);
  7857. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7858. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7859. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7860. if (__pyx_t_4) {
  7861. /* "fontTools/varLib/iup.py":388
  7862. * d0 = deltas[0]
  7863. * if all(d0 == d for d in deltas):
  7864. * return [d0] + [None] * (n - 1) # <<<<<<<<<<<<<<
  7865. *
  7866. * # Else, solve the general problem using Dynamic Programming.
  7867. */
  7868. __Pyx_XDECREF(__pyx_r);
  7869. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  7870. __Pyx_GOTREF(__pyx_t_2);
  7871. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_d0);
  7872. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_d0);
  7873. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_d0) != (0)) __PYX_ERR(0, 388, __pyx_L1_error);
  7874. __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  7875. __Pyx_GOTREF(__pyx_t_3);
  7876. __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
  7877. __Pyx_GOTREF(__pyx_t_5);
  7878. __Pyx_INCREF(Py_None);
  7879. __Pyx_GIVEREF(Py_None);
  7880. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, Py_None) != (0)) __PYX_ERR(0, 388, __pyx_L1_error);
  7881. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 388, __pyx_L1_error)
  7882. __Pyx_GOTREF(__pyx_temp);
  7883. __Pyx_DECREF(__pyx_t_5);
  7884. __pyx_t_5 = __pyx_temp;
  7885. }
  7886. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7887. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  7888. __Pyx_GOTREF(__pyx_t_3);
  7889. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7890. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7891. __pyx_r = __pyx_t_3;
  7892. __pyx_t_3 = 0;
  7893. goto __pyx_L0;
  7894. /* "fontTools/varLib/iup.py":387
  7895. * # If all deltas are exactly the same, return just one (the first one):
  7896. * d0 = deltas[0]
  7897. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7898. * return [d0] + [None] * (n - 1)
  7899. *
  7900. */
  7901. }
  7902. /* "fontTools/varLib/iup.py":392
  7903. * # Else, solve the general problem using Dynamic Programming.
  7904. *
  7905. * forced = _iup_contour_bound_forced_set(deltas, coords, tolerance) # <<<<<<<<<<<<<<
  7906. * # The _iup_contour_optimize_dp() routine returns the optimal encoding
  7907. * # solution given the constraint that the last point is always encoded.
  7908. */
  7909. __pyx_t_5 = NULL;
  7910. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_iup_contour_bound_forced_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
  7911. __Pyx_GOTREF(__pyx_t_2);
  7912. __pyx_t_6 = 1;
  7913. #if CYTHON_UNPACK_METHODS
  7914. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  7915. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  7916. assert(__pyx_t_5);
  7917. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  7918. __Pyx_INCREF(__pyx_t_5);
  7919. __Pyx_INCREF(__pyx__function);
  7920. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  7921. __pyx_t_6 = 0;
  7922. }
  7923. #endif
  7924. {
  7925. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_deltas, __pyx_v_coords, __pyx_cur_scope->__pyx_v_tolerance};
  7926. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7927. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7928. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7929. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
  7930. __Pyx_GOTREF(__pyx_t_3);
  7931. }
  7932. __pyx_v_forced = __pyx_t_3;
  7933. __pyx_t_3 = 0;
  7934. /* "fontTools/varLib/iup.py":401
  7935. * # if the font size changes (reduced); that would mean the forced-set
  7936. * # has members it should not have.
  7937. * if forced: # <<<<<<<<<<<<<<
  7938. * # Forced set is non-empty: rotate the contour start point
  7939. * # such that the last point in the list is a forced point.
  7940. */
  7941. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_forced); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
  7942. if (__pyx_t_4) {
  7943. /* "fontTools/varLib/iup.py":404
  7944. * # Forced set is non-empty: rotate the contour start point
  7945. * # such that the last point in the list is a forced point.
  7946. * k = (n - 1) - max(forced) # <<<<<<<<<<<<<<
  7947. * assert k >= 0
  7948. *
  7949. */
  7950. __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error)
  7951. __Pyx_GOTREF(__pyx_t_3);
  7952. __pyx_t_5 = NULL;
  7953. __pyx_t_6 = 1;
  7954. {
  7955. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_forced};
  7956. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_max, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7957. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7958. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  7959. __Pyx_GOTREF(__pyx_t_2);
  7960. }
  7961. __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error)
  7962. __Pyx_GOTREF(__pyx_t_5);
  7963. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7964. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7965. __pyx_v_k = __pyx_t_5;
  7966. __pyx_t_5 = 0;
  7967. /* "fontTools/varLib/iup.py":405
  7968. * # such that the last point in the list is a forced point.
  7969. * k = (n - 1) - max(forced)
  7970. * assert k >= 0 # <<<<<<<<<<<<<<
  7971. *
  7972. * deltas = _rot_list(deltas, k)
  7973. */
  7974. #ifndef CYTHON_WITHOUT_ASSERTIONS
  7975. if (unlikely(__pyx_assertions_enabled())) {
  7976. __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L1_error)
  7977. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 405, __pyx_L1_error)
  7978. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7979. if (unlikely(!__pyx_t_4)) {
  7980. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  7981. __PYX_ERR(0, 405, __pyx_L1_error)
  7982. }
  7983. }
  7984. #else
  7985. if ((1)); else __PYX_ERR(0, 405, __pyx_L1_error)
  7986. #endif
  7987. /* "fontTools/varLib/iup.py":407
  7988. * assert k >= 0
  7989. *
  7990. * deltas = _rot_list(deltas, k) # <<<<<<<<<<<<<<
  7991. * coords = _rot_list(coords, k)
  7992. * forced = _rot_set(forced, k, n)
  7993. */
  7994. __pyx_t_2 = NULL;
  7995. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_rot_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
  7996. __Pyx_GOTREF(__pyx_t_3);
  7997. __pyx_t_6 = 1;
  7998. #if CYTHON_UNPACK_METHODS
  7999. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  8000. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  8001. assert(__pyx_t_2);
  8002. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8003. __Pyx_INCREF(__pyx_t_2);
  8004. __Pyx_INCREF(__pyx__function);
  8005. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  8006. __pyx_t_6 = 0;
  8007. }
  8008. #endif
  8009. {
  8010. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_deltas, __pyx_v_k};
  8011. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8012. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8013. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8014. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L1_error)
  8015. __Pyx_GOTREF(__pyx_t_5);
  8016. }
  8017. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_5);
  8018. __pyx_t_5 = 0;
  8019. /* "fontTools/varLib/iup.py":408
  8020. *
  8021. * deltas = _rot_list(deltas, k)
  8022. * coords = _rot_list(coords, k) # <<<<<<<<<<<<<<
  8023. * forced = _rot_set(forced, k, n)
  8024. *
  8025. */
  8026. __pyx_t_3 = NULL;
  8027. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rot_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  8028. __Pyx_GOTREF(__pyx_t_2);
  8029. __pyx_t_6 = 1;
  8030. #if CYTHON_UNPACK_METHODS
  8031. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8032. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  8033. assert(__pyx_t_3);
  8034. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8035. __Pyx_INCREF(__pyx_t_3);
  8036. __Pyx_INCREF(__pyx__function);
  8037. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8038. __pyx_t_6 = 0;
  8039. }
  8040. #endif
  8041. {
  8042. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_coords, __pyx_v_k};
  8043. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8044. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8045. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8046. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error)
  8047. __Pyx_GOTREF(__pyx_t_5);
  8048. }
  8049. __Pyx_DECREF_SET(__pyx_v_coords, __pyx_t_5);
  8050. __pyx_t_5 = 0;
  8051. /* "fontTools/varLib/iup.py":409
  8052. * deltas = _rot_list(deltas, k)
  8053. * coords = _rot_list(coords, k)
  8054. * forced = _rot_set(forced, k, n) # <<<<<<<<<<<<<<
  8055. *
  8056. * # Debugging: Pass a set() instead of forced variable to the next call
  8057. */
  8058. __pyx_t_2 = NULL;
  8059. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_rot_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
  8060. __Pyx_GOTREF(__pyx_t_3);
  8061. __pyx_t_6 = 1;
  8062. #if CYTHON_UNPACK_METHODS
  8063. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  8064. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  8065. assert(__pyx_t_2);
  8066. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8067. __Pyx_INCREF(__pyx_t_2);
  8068. __Pyx_INCREF(__pyx__function);
  8069. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  8070. __pyx_t_6 = 0;
  8071. }
  8072. #endif
  8073. {
  8074. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_forced, __pyx_v_k, __pyx_v_n};
  8075. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8076. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8077. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8078. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  8079. __Pyx_GOTREF(__pyx_t_5);
  8080. }
  8081. __Pyx_DECREF_SET(__pyx_v_forced, __pyx_t_5);
  8082. __pyx_t_5 = 0;
  8083. /* "fontTools/varLib/iup.py":413
  8084. * # Debugging: Pass a set() instead of forced variable to the next call
  8085. * # to exercise forced-set computation for under-counting.
  8086. * chain, costs = _iup_contour_optimize_dp(deltas, coords, forced, tolerance) # <<<<<<<<<<<<<<
  8087. *
  8088. * # Assemble solution.
  8089. */
  8090. __pyx_t_3 = NULL;
  8091. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_dp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8092. __Pyx_GOTREF(__pyx_t_2);
  8093. __pyx_t_6 = 1;
  8094. #if CYTHON_UNPACK_METHODS
  8095. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8096. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  8097. assert(__pyx_t_3);
  8098. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8099. __Pyx_INCREF(__pyx_t_3);
  8100. __Pyx_INCREF(__pyx__function);
  8101. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8102. __pyx_t_6 = 0;
  8103. }
  8104. #endif
  8105. {
  8106. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_deltas, __pyx_v_coords, __pyx_v_forced, __pyx_cur_scope->__pyx_v_tolerance};
  8107. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8108. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8109. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8110. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error)
  8111. __Pyx_GOTREF(__pyx_t_5);
  8112. }
  8113. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  8114. PyObject* sequence = __pyx_t_5;
  8115. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8116. if (unlikely(size != 2)) {
  8117. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8118. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8119. __PYX_ERR(0, 413, __pyx_L1_error)
  8120. }
  8121. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8122. if (likely(PyTuple_CheckExact(sequence))) {
  8123. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  8124. __Pyx_INCREF(__pyx_t_2);
  8125. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
  8126. __Pyx_INCREF(__pyx_t_3);
  8127. } else {
  8128. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8129. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8130. __Pyx_XGOTREF(__pyx_t_2);
  8131. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8132. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
  8133. __Pyx_XGOTREF(__pyx_t_3);
  8134. }
  8135. #else
  8136. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8137. __Pyx_GOTREF(__pyx_t_2);
  8138. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
  8139. __Pyx_GOTREF(__pyx_t_3);
  8140. #endif
  8141. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8142. } else {
  8143. Py_ssize_t index = -1;
  8144. __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 413, __pyx_L1_error)
  8145. __Pyx_GOTREF(__pyx_t_7);
  8146. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8147. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  8148. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  8149. __Pyx_GOTREF(__pyx_t_2);
  8150. index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
  8151. __Pyx_GOTREF(__pyx_t_3);
  8152. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 413, __pyx_L1_error)
  8153. __pyx_t_8 = NULL;
  8154. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8155. goto __pyx_L8_unpacking_done;
  8156. __pyx_L7_unpacking_failed:;
  8157. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8158. __pyx_t_8 = NULL;
  8159. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8160. __PYX_ERR(0, 413, __pyx_L1_error)
  8161. __pyx_L8_unpacking_done:;
  8162. }
  8163. __pyx_v_chain = __pyx_t_2;
  8164. __pyx_t_2 = 0;
  8165. __pyx_v_costs = __pyx_t_3;
  8166. __pyx_t_3 = 0;
  8167. /* "fontTools/varLib/iup.py":416
  8168. *
  8169. * # Assemble solution.
  8170. * solution = set() # <<<<<<<<<<<<<<
  8171. * i = n - 1
  8172. * while i is not None:
  8173. */
  8174. __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error)
  8175. __Pyx_GOTREF(__pyx_t_5);
  8176. __pyx_v_solution = ((PyObject*)__pyx_t_5);
  8177. __pyx_t_5 = 0;
  8178. /* "fontTools/varLib/iup.py":417
  8179. * # Assemble solution.
  8180. * solution = set()
  8181. * i = n - 1 # <<<<<<<<<<<<<<
  8182. * while i is not None:
  8183. * solution.add(i)
  8184. */
  8185. __pyx_t_5 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 417, __pyx_L1_error)
  8186. __Pyx_GOTREF(__pyx_t_5);
  8187. __pyx_v_i = __pyx_t_5;
  8188. __pyx_t_5 = 0;
  8189. /* "fontTools/varLib/iup.py":418
  8190. * solution = set()
  8191. * i = n - 1
  8192. * while i is not None: # <<<<<<<<<<<<<<
  8193. * solution.add(i)
  8194. * i = chain[i]
  8195. */
  8196. while (1) {
  8197. __pyx_t_4 = (__pyx_v_i != Py_None);
  8198. if (!__pyx_t_4) break;
  8199. /* "fontTools/varLib/iup.py":419
  8200. * i = n - 1
  8201. * while i is not None:
  8202. * solution.add(i) # <<<<<<<<<<<<<<
  8203. * i = chain[i]
  8204. * solution.remove(-1)
  8205. */
  8206. __pyx_t_9 = PySet_Add(__pyx_v_solution, __pyx_v_i); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 419, __pyx_L1_error)
  8207. /* "fontTools/varLib/iup.py":420
  8208. * while i is not None:
  8209. * solution.add(i)
  8210. * i = chain[i] # <<<<<<<<<<<<<<
  8211. * solution.remove(-1)
  8212. *
  8213. */
  8214. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error)
  8215. __Pyx_GOTREF(__pyx_t_5);
  8216. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_5);
  8217. __pyx_t_5 = 0;
  8218. }
  8219. /* "fontTools/varLib/iup.py":421
  8220. * solution.add(i)
  8221. * i = chain[i]
  8222. * solution.remove(-1) # <<<<<<<<<<<<<<
  8223. *
  8224. * # if not forced <= solution:
  8225. */
  8226. __pyx_t_9 = __Pyx_PySet_Remove(__pyx_v_solution, __pyx_mstate_global->__pyx_int_neg_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 421, __pyx_L1_error)
  8227. /* "fontTools/varLib/iup.py":427
  8228. * # print("deltas", deltas)
  8229. * # print("len", len(deltas))
  8230. * assert forced <= solution, (forced, solution) # <<<<<<<<<<<<<<
  8231. *
  8232. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8233. */
  8234. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8235. if (unlikely(__pyx_assertions_enabled())) {
  8236. __pyx_t_5 = PyObject_RichCompare(__pyx_v_forced, __pyx_v_solution, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  8237. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 427, __pyx_L1_error)
  8238. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8239. if (unlikely(!__pyx_t_4)) {
  8240. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  8241. __Pyx_GOTREF(__pyx_t_5);
  8242. __Pyx_INCREF(__pyx_v_forced);
  8243. __Pyx_GIVEREF(__pyx_v_forced);
  8244. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_forced) != (0)) __PYX_ERR(0, 427, __pyx_L1_error);
  8245. __Pyx_INCREF(__pyx_v_solution);
  8246. __Pyx_GIVEREF(__pyx_v_solution);
  8247. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_solution) != (0)) __PYX_ERR(0, 427, __pyx_L1_error);
  8248. __pyx_t_3 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
  8249. __Pyx_GOTREF(__pyx_t_3);
  8250. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8251. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
  8252. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8253. __PYX_ERR(0, 427, __pyx_L1_error)
  8254. }
  8255. }
  8256. #else
  8257. if ((1)); else __PYX_ERR(0, 427, __pyx_L1_error)
  8258. #endif
  8259. /* "fontTools/varLib/iup.py":429
  8260. * assert forced <= solution, (forced, solution)
  8261. *
  8262. * deltas = [deltas[i] if i in solution else None for i in range(n)] # <<<<<<<<<<<<<<
  8263. *
  8264. * deltas = _rot_list(deltas, -k)
  8265. */
  8266. { /* enter inner scope */
  8267. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L13_error)
  8268. __Pyx_GOTREF(__pyx_t_3);
  8269. __pyx_t_2 = NULL;
  8270. __pyx_t_6 = 1;
  8271. {
  8272. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_n};
  8273. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8274. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8275. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L13_error)
  8276. __Pyx_GOTREF(__pyx_t_5);
  8277. }
  8278. __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L13_error)
  8279. __Pyx_GOTREF(__pyx_t_2);
  8280. __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 429, __pyx_L13_error)
  8281. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8282. for (;;) {
  8283. {
  8284. __pyx_t_5 = __pyx_t_10(__pyx_t_2);
  8285. if (unlikely(!__pyx_t_5)) {
  8286. PyObject* exc_type = PyErr_Occurred();
  8287. if (exc_type) {
  8288. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 429, __pyx_L13_error)
  8289. PyErr_Clear();
  8290. }
  8291. break;
  8292. }
  8293. }
  8294. __Pyx_GOTREF(__pyx_t_5);
  8295. __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_i, __pyx_t_5);
  8296. __pyx_t_5 = 0;
  8297. __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr5__pyx_v_i, __pyx_v_solution, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 429, __pyx_L13_error)
  8298. if (__pyx_t_4) {
  8299. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_8genexpr5__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L13_error)
  8300. __Pyx_GOTREF(__pyx_t_7);
  8301. __pyx_t_5 = __pyx_t_7;
  8302. __pyx_t_7 = 0;
  8303. } else {
  8304. __Pyx_INCREF(Py_None);
  8305. __pyx_t_5 = Py_None;
  8306. }
  8307. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 429, __pyx_L13_error)
  8308. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8309. }
  8310. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8311. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8312. goto __pyx_L17_exit_scope;
  8313. __pyx_L13_error:;
  8314. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8315. goto __pyx_L1_error;
  8316. __pyx_L17_exit_scope:;
  8317. } /* exit inner scope */
  8318. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8319. __pyx_t_3 = 0;
  8320. /* "fontTools/varLib/iup.py":431
  8321. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8322. *
  8323. * deltas = _rot_list(deltas, -k) # <<<<<<<<<<<<<<
  8324. * else:
  8325. * # Repeat the contour an extra time, solve the new case, then look for solutions of the
  8326. */
  8327. __pyx_t_2 = NULL;
  8328. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_rot_list); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error)
  8329. __Pyx_GOTREF(__pyx_t_5);
  8330. __pyx_t_7 = PyNumber_Negative(__pyx_v_k); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
  8331. __Pyx_GOTREF(__pyx_t_7);
  8332. __pyx_t_6 = 1;
  8333. #if CYTHON_UNPACK_METHODS
  8334. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8335. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
  8336. assert(__pyx_t_2);
  8337. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8338. __Pyx_INCREF(__pyx_t_2);
  8339. __Pyx_INCREF(__pyx__function);
  8340. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  8341. __pyx_t_6 = 0;
  8342. }
  8343. #endif
  8344. {
  8345. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_deltas, __pyx_t_7};
  8346. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8347. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8348. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8349. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8350. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error)
  8351. __Pyx_GOTREF(__pyx_t_3);
  8352. }
  8353. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8354. __pyx_t_3 = 0;
  8355. /* "fontTools/varLib/iup.py":401
  8356. * # if the font size changes (reduced); that would mean the forced-set
  8357. * # has members it should not have.
  8358. * if forced: # <<<<<<<<<<<<<<
  8359. * # Forced set is non-empty: rotate the contour start point
  8360. * # such that the last point in the list is a forced point.
  8361. */
  8362. goto __pyx_L6;
  8363. }
  8364. /* "fontTools/varLib/iup.py":436
  8365. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8366. * # this always produces the optimal solution...
  8367. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8368. * deltas + deltas, coords + coords, forced, tolerance, n
  8369. * )
  8370. */
  8371. /*else*/ {
  8372. __pyx_t_5 = NULL;
  8373. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_dp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L1_error)
  8374. __Pyx_GOTREF(__pyx_t_7);
  8375. /* "fontTools/varLib/iup.py":437
  8376. * # this always produces the optimal solution...
  8377. * chain, costs = _iup_contour_optimize_dp(
  8378. * deltas + deltas, coords + coords, forced, tolerance, n # <<<<<<<<<<<<<<
  8379. * )
  8380. * best_sol, best_cost = None, n + 1
  8381. */
  8382. __pyx_t_2 = PyNumber_Add(__pyx_v_deltas, __pyx_v_deltas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error)
  8383. __Pyx_GOTREF(__pyx_t_2);
  8384. __pyx_t_11 = PyNumber_Add(__pyx_v_coords, __pyx_v_coords); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 437, __pyx_L1_error)
  8385. __Pyx_GOTREF(__pyx_t_11);
  8386. __pyx_t_6 = 1;
  8387. #if CYTHON_UNPACK_METHODS
  8388. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  8389. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
  8390. assert(__pyx_t_5);
  8391. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  8392. __Pyx_INCREF(__pyx_t_5);
  8393. __Pyx_INCREF(__pyx__function);
  8394. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  8395. __pyx_t_6 = 0;
  8396. }
  8397. #endif
  8398. {
  8399. PyObject *__pyx_callargs[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_11, __pyx_v_forced, __pyx_cur_scope->__pyx_v_tolerance, __pyx_v_n};
  8400. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8401. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  8402. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8403. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8404. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8405. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
  8406. __Pyx_GOTREF(__pyx_t_3);
  8407. }
  8408. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  8409. PyObject* sequence = __pyx_t_3;
  8410. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8411. if (unlikely(size != 2)) {
  8412. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8413. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8414. __PYX_ERR(0, 436, __pyx_L1_error)
  8415. }
  8416. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8417. if (likely(PyTuple_CheckExact(sequence))) {
  8418. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  8419. __Pyx_INCREF(__pyx_t_7);
  8420. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
  8421. __Pyx_INCREF(__pyx_t_11);
  8422. } else {
  8423. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8424. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L1_error)
  8425. __Pyx_XGOTREF(__pyx_t_7);
  8426. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8427. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 436, __pyx_L1_error)
  8428. __Pyx_XGOTREF(__pyx_t_11);
  8429. }
  8430. #else
  8431. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L1_error)
  8432. __Pyx_GOTREF(__pyx_t_7);
  8433. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 436, __pyx_L1_error)
  8434. __Pyx_GOTREF(__pyx_t_11);
  8435. #endif
  8436. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8437. } else {
  8438. Py_ssize_t index = -1;
  8439. __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  8440. __Pyx_GOTREF(__pyx_t_2);
  8441. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8442. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
  8443. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
  8444. __Pyx_GOTREF(__pyx_t_7);
  8445. index = 1; __pyx_t_11 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed;
  8446. __Pyx_GOTREF(__pyx_t_11);
  8447. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 436, __pyx_L1_error)
  8448. __pyx_t_8 = NULL;
  8449. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8450. goto __pyx_L19_unpacking_done;
  8451. __pyx_L18_unpacking_failed:;
  8452. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8453. __pyx_t_8 = NULL;
  8454. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8455. __PYX_ERR(0, 436, __pyx_L1_error)
  8456. __pyx_L19_unpacking_done:;
  8457. }
  8458. /* "fontTools/varLib/iup.py":436
  8459. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8460. * # this always produces the optimal solution...
  8461. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8462. * deltas + deltas, coords + coords, forced, tolerance, n
  8463. * )
  8464. */
  8465. __pyx_v_chain = __pyx_t_7;
  8466. __pyx_t_7 = 0;
  8467. __pyx_v_costs = __pyx_t_11;
  8468. __pyx_t_11 = 0;
  8469. /* "fontTools/varLib/iup.py":439
  8470. * deltas + deltas, coords + coords, forced, tolerance, n
  8471. * )
  8472. * best_sol, best_cost = None, n + 1 # <<<<<<<<<<<<<<
  8473. *
  8474. * for start in range(n - 1, len(costs) - 1):
  8475. */
  8476. __pyx_t_3 = Py_None;
  8477. __Pyx_INCREF(__pyx_t_3);
  8478. __pyx_t_11 = __Pyx_PyLong_AddObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 439, __pyx_L1_error)
  8479. __Pyx_GOTREF(__pyx_t_11);
  8480. __pyx_v_best_sol = ((PyObject*)__pyx_t_3);
  8481. __pyx_t_3 = 0;
  8482. __pyx_v_best_cost = __pyx_t_11;
  8483. __pyx_t_11 = 0;
  8484. /* "fontTools/varLib/iup.py":441
  8485. * best_sol, best_cost = None, n + 1
  8486. *
  8487. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  8488. * # Assemble solution.
  8489. * solution = set()
  8490. */
  8491. __pyx_t_3 = NULL;
  8492. __pyx_t_7 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
  8493. __Pyx_GOTREF(__pyx_t_7);
  8494. __pyx_t_1 = PyObject_Length(__pyx_v_costs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 441, __pyx_L1_error)
  8495. __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_1 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  8496. __Pyx_GOTREF(__pyx_t_2);
  8497. __pyx_t_6 = 1;
  8498. {
  8499. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_2};
  8500. __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8501. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8502. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8503. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8504. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 441, __pyx_L1_error)
  8505. __Pyx_GOTREF(__pyx_t_11);
  8506. }
  8507. __pyx_t_2 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  8508. __Pyx_GOTREF(__pyx_t_2);
  8509. __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 441, __pyx_L1_error)
  8510. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8511. for (;;) {
  8512. {
  8513. __pyx_t_11 = __pyx_t_10(__pyx_t_2);
  8514. if (unlikely(!__pyx_t_11)) {
  8515. PyObject* exc_type = PyErr_Occurred();
  8516. if (exc_type) {
  8517. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 441, __pyx_L1_error)
  8518. PyErr_Clear();
  8519. }
  8520. break;
  8521. }
  8522. }
  8523. __Pyx_GOTREF(__pyx_t_11);
  8524. __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_11);
  8525. __pyx_t_11 = 0;
  8526. /* "fontTools/varLib/iup.py":443
  8527. * for start in range(n - 1, len(costs) - 1):
  8528. * # Assemble solution.
  8529. * solution = set() # <<<<<<<<<<<<<<
  8530. * i = start
  8531. * while i > start - n:
  8532. */
  8533. __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 443, __pyx_L1_error)
  8534. __Pyx_GOTREF(__pyx_t_11);
  8535. __Pyx_XDECREF_SET(__pyx_v_solution, ((PyObject*)__pyx_t_11));
  8536. __pyx_t_11 = 0;
  8537. /* "fontTools/varLib/iup.py":444
  8538. * # Assemble solution.
  8539. * solution = set()
  8540. * i = start # <<<<<<<<<<<<<<
  8541. * while i > start - n:
  8542. * solution.add(i % n)
  8543. */
  8544. __Pyx_INCREF(__pyx_v_start);
  8545. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_v_start);
  8546. /* "fontTools/varLib/iup.py":445
  8547. * solution = set()
  8548. * i = start
  8549. * while i > start - n: # <<<<<<<<<<<<<<
  8550. * solution.add(i % n)
  8551. * i = chain[i]
  8552. */
  8553. while (1) {
  8554. __pyx_t_11 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
  8555. __Pyx_GOTREF(__pyx_t_11);
  8556. __pyx_t_7 = PyObject_RichCompare(__pyx_v_i, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
  8557. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8558. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 445, __pyx_L1_error)
  8559. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8560. if (!__pyx_t_4) break;
  8561. /* "fontTools/varLib/iup.py":446
  8562. * i = start
  8563. * while i > start - n:
  8564. * solution.add(i % n) # <<<<<<<<<<<<<<
  8565. * i = chain[i]
  8566. * if i == start - n:
  8567. */
  8568. __pyx_t_7 = PyNumber_Remainder(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error)
  8569. __Pyx_GOTREF(__pyx_t_7);
  8570. __pyx_t_9 = PySet_Add(__pyx_v_solution, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 446, __pyx_L1_error)
  8571. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8572. /* "fontTools/varLib/iup.py":447
  8573. * while i > start - n:
  8574. * solution.add(i % n)
  8575. * i = chain[i] # <<<<<<<<<<<<<<
  8576. * if i == start - n:
  8577. * cost = costs[start] - costs[start - n]
  8578. */
  8579. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error)
  8580. __Pyx_GOTREF(__pyx_t_7);
  8581. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_7);
  8582. __pyx_t_7 = 0;
  8583. }
  8584. /* "fontTools/varLib/iup.py":448
  8585. * solution.add(i % n)
  8586. * i = chain[i]
  8587. * if i == start - n: # <<<<<<<<<<<<<<
  8588. * cost = costs[start] - costs[start - n]
  8589. * if cost <= best_cost:
  8590. */
  8591. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error)
  8592. __Pyx_GOTREF(__pyx_t_7);
  8593. __pyx_t_11 = PyObject_RichCompare(__pyx_v_i, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 448, __pyx_L1_error)
  8594. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8595. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 448, __pyx_L1_error)
  8596. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8597. if (__pyx_t_4) {
  8598. /* "fontTools/varLib/iup.py":449
  8599. * i = chain[i]
  8600. * if i == start - n:
  8601. * cost = costs[start] - costs[start - n] # <<<<<<<<<<<<<<
  8602. * if cost <= best_cost:
  8603. * best_sol, best_cost = solution, cost
  8604. */
  8605. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 449, __pyx_L1_error)
  8606. __Pyx_GOTREF(__pyx_t_11);
  8607. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error)
  8608. __Pyx_GOTREF(__pyx_t_7);
  8609. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
  8610. __Pyx_GOTREF(__pyx_t_3);
  8611. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8612. __pyx_t_7 = PyNumber_Subtract(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error)
  8613. __Pyx_GOTREF(__pyx_t_7);
  8614. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8615. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8616. __Pyx_XDECREF_SET(__pyx_v_cost, __pyx_t_7);
  8617. __pyx_t_7 = 0;
  8618. /* "fontTools/varLib/iup.py":450
  8619. * if i == start - n:
  8620. * cost = costs[start] - costs[start - n]
  8621. * if cost <= best_cost: # <<<<<<<<<<<<<<
  8622. * best_sol, best_cost = solution, cost
  8623. *
  8624. */
  8625. __pyx_t_7 = PyObject_RichCompare(__pyx_v_cost, __pyx_v_best_cost, Py_LE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 450, __pyx_L1_error)
  8626. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 450, __pyx_L1_error)
  8627. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8628. if (__pyx_t_4) {
  8629. /* "fontTools/varLib/iup.py":451
  8630. * cost = costs[start] - costs[start - n]
  8631. * if cost <= best_cost:
  8632. * best_sol, best_cost = solution, cost # <<<<<<<<<<<<<<
  8633. *
  8634. * # if not forced <= best_sol:
  8635. */
  8636. __pyx_t_7 = __pyx_v_solution;
  8637. __Pyx_INCREF(__pyx_t_7);
  8638. __pyx_t_3 = __pyx_v_cost;
  8639. __Pyx_INCREF(__pyx_t_3);
  8640. __Pyx_DECREF_SET(__pyx_v_best_sol, ((PyObject*)__pyx_t_7));
  8641. __pyx_t_7 = 0;
  8642. __Pyx_DECREF_SET(__pyx_v_best_cost, __pyx_t_3);
  8643. __pyx_t_3 = 0;
  8644. /* "fontTools/varLib/iup.py":450
  8645. * if i == start - n:
  8646. * cost = costs[start] - costs[start - n]
  8647. * if cost <= best_cost: # <<<<<<<<<<<<<<
  8648. * best_sol, best_cost = solution, cost
  8649. *
  8650. */
  8651. }
  8652. /* "fontTools/varLib/iup.py":448
  8653. * solution.add(i % n)
  8654. * i = chain[i]
  8655. * if i == start - n: # <<<<<<<<<<<<<<
  8656. * cost = costs[start] - costs[start - n]
  8657. * if cost <= best_cost:
  8658. */
  8659. }
  8660. /* "fontTools/varLib/iup.py":441
  8661. * best_sol, best_cost = None, n + 1
  8662. *
  8663. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  8664. * # Assemble solution.
  8665. * solution = set()
  8666. */
  8667. }
  8668. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8669. /* "fontTools/varLib/iup.py":457
  8670. * # print("deltas", deltas)
  8671. * # print("len", len(deltas))
  8672. * assert forced <= best_sol, (forced, best_sol) # <<<<<<<<<<<<<<
  8673. *
  8674. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  8675. */
  8676. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8677. if (unlikely(__pyx_assertions_enabled())) {
  8678. __pyx_t_2 = PyObject_RichCompare(__pyx_v_forced, __pyx_v_best_sol, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
  8679. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 457, __pyx_L1_error)
  8680. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8681. if (unlikely(!__pyx_t_4)) {
  8682. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
  8683. __Pyx_GOTREF(__pyx_t_2);
  8684. __Pyx_INCREF(__pyx_v_forced);
  8685. __Pyx_GIVEREF(__pyx_v_forced);
  8686. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_forced) != (0)) __PYX_ERR(0, 457, __pyx_L1_error);
  8687. __Pyx_INCREF(__pyx_v_best_sol);
  8688. __Pyx_GIVEREF(__pyx_v_best_sol);
  8689. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_best_sol) != (0)) __PYX_ERR(0, 457, __pyx_L1_error);
  8690. __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error)
  8691. __Pyx_GOTREF(__pyx_t_3);
  8692. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8693. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
  8694. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8695. __PYX_ERR(0, 457, __pyx_L1_error)
  8696. }
  8697. }
  8698. #else
  8699. if ((1)); else __PYX_ERR(0, 457, __pyx_L1_error)
  8700. #endif
  8701. /* "fontTools/varLib/iup.py":459
  8702. * assert forced <= best_sol, (forced, best_sol)
  8703. *
  8704. * deltas = [deltas[i] if i in best_sol else None for i in range(n)] # <<<<<<<<<<<<<<
  8705. *
  8706. * return deltas
  8707. */
  8708. { /* enter inner scope */
  8709. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L29_error)
  8710. __Pyx_GOTREF(__pyx_t_3);
  8711. __pyx_t_7 = NULL;
  8712. __pyx_t_6 = 1;
  8713. {
  8714. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_n};
  8715. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8716. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  8717. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L29_error)
  8718. __Pyx_GOTREF(__pyx_t_2);
  8719. }
  8720. __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 459, __pyx_L29_error)
  8721. __Pyx_GOTREF(__pyx_t_7);
  8722. __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 459, __pyx_L29_error)
  8723. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8724. for (;;) {
  8725. {
  8726. __pyx_t_2 = __pyx_t_10(__pyx_t_7);
  8727. if (unlikely(!__pyx_t_2)) {
  8728. PyObject* exc_type = PyErr_Occurred();
  8729. if (exc_type) {
  8730. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 459, __pyx_L29_error)
  8731. PyErr_Clear();
  8732. }
  8733. break;
  8734. }
  8735. }
  8736. __Pyx_GOTREF(__pyx_t_2);
  8737. __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_i, __pyx_t_2);
  8738. __pyx_t_2 = 0;
  8739. if (unlikely(__pyx_v_best_sol == Py_None)) {
  8740. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  8741. __PYX_ERR(0, 459, __pyx_L29_error)
  8742. }
  8743. __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr6__pyx_v_i, __pyx_v_best_sol, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 459, __pyx_L29_error)
  8744. if (__pyx_t_4) {
  8745. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_8genexpr6__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 459, __pyx_L29_error)
  8746. __Pyx_GOTREF(__pyx_t_11);
  8747. __pyx_t_2 = __pyx_t_11;
  8748. __pyx_t_11 = 0;
  8749. } else {
  8750. __Pyx_INCREF(Py_None);
  8751. __pyx_t_2 = Py_None;
  8752. }
  8753. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 459, __pyx_L29_error)
  8754. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8755. }
  8756. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8757. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  8758. goto __pyx_L33_exit_scope;
  8759. __pyx_L29_error:;
  8760. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  8761. goto __pyx_L1_error;
  8762. __pyx_L33_exit_scope:;
  8763. } /* exit inner scope */
  8764. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8765. __pyx_t_3 = 0;
  8766. }
  8767. __pyx_L6:;
  8768. /* "fontTools/varLib/iup.py":461
  8769. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  8770. *
  8771. * return deltas # <<<<<<<<<<<<<<
  8772. *
  8773. *
  8774. */
  8775. __Pyx_XDECREF(__pyx_r);
  8776. __Pyx_INCREF(__pyx_v_deltas);
  8777. __pyx_r = __pyx_v_deltas;
  8778. goto __pyx_L0;
  8779. /* "fontTools/varLib/iup.py":363
  8780. *
  8781. *
  8782. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  8783. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  8784. * ) -> _DeltaOrNoneSegment:
  8785. */
  8786. /* function exit code */
  8787. __pyx_L1_error:;
  8788. __Pyx_XDECREF(__pyx_t_2);
  8789. __Pyx_XDECREF(__pyx_t_3);
  8790. __Pyx_XDECREF(__pyx_t_5);
  8791. __Pyx_XDECREF(__pyx_t_7);
  8792. __Pyx_XDECREF(__pyx_t_11);
  8793. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8794. __pyx_r = NULL;
  8795. __pyx_L0:;
  8796. __Pyx_XDECREF(__pyx_v_n);
  8797. __Pyx_XDECREF(__pyx_v_forced);
  8798. __Pyx_XDECREF(__pyx_v_k);
  8799. __Pyx_XDECREF(__pyx_v_chain);
  8800. __Pyx_XDECREF(__pyx_v_costs);
  8801. __Pyx_XDECREF(__pyx_v_solution);
  8802. __Pyx_XDECREF(__pyx_v_i);
  8803. __Pyx_XDECREF(__pyx_v_best_sol);
  8804. __Pyx_XDECREF(__pyx_v_best_cost);
  8805. __Pyx_XDECREF(__pyx_v_start);
  8806. __Pyx_XDECREF(__pyx_v_cost);
  8807. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1);
  8808. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2);
  8809. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i);
  8810. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i);
  8811. __Pyx_XDECREF(__pyx_v_deltas);
  8812. __Pyx_XDECREF(__pyx_v_coords);
  8813. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  8814. __Pyx_XGIVEREF(__pyx_r);
  8815. __Pyx_RefNannyFinishContext();
  8816. return __pyx_r;
  8817. }
  8818. /* "fontTools/varLib/iup.py":464
  8819. *
  8820. *
  8821. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  8822. * deltas: _DeltaSegment,
  8823. * coords: _PointSegment,
  8824. */
  8825. /* Python wrapper */
  8826. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize(PyObject *__pyx_self,
  8827. #if CYTHON_METH_FASTCALL
  8828. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8829. #else
  8830. PyObject *__pyx_args, PyObject *__pyx_kwds
  8831. #endif
  8832. ); /*proto*/
  8833. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_14iup_delta_optimize, "iup_delta_optimize(deltas: _DeltaSegment, coords: _PointSegment, ends: _Endpoints, tolerance: Real = 0.0) -> _DeltaOrNoneSegment\n\nFor the outline given in `coords`, with contour endpoints given\nin sorted increasing order in `ends`, optimize a set of delta\nvalues `deltas` within error `tolerance`.\n\nReturns delta vector that has most number of None items instead of\nthe input delta.");
  8834. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_15iup_delta_optimize = {"iup_delta_optimize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_14iup_delta_optimize};
  8835. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize(PyObject *__pyx_self,
  8836. #if CYTHON_METH_FASTCALL
  8837. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8838. #else
  8839. PyObject *__pyx_args, PyObject *__pyx_kwds
  8840. #endif
  8841. ) {
  8842. PyObject *__pyx_v_deltas = 0;
  8843. PyObject *__pyx_v_coords = 0;
  8844. PyObject *__pyx_v_ends = 0;
  8845. PyObject *__pyx_v_tolerance = 0;
  8846. #if !CYTHON_METH_FASTCALL
  8847. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  8848. #endif
  8849. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  8850. PyObject* values[4] = {0,0,0,0};
  8851. int __pyx_lineno = 0;
  8852. const char *__pyx_filename = NULL;
  8853. int __pyx_clineno = 0;
  8854. PyObject *__pyx_r = 0;
  8855. __Pyx_RefNannyDeclarations
  8856. __Pyx_RefNannySetupContext("iup_delta_optimize (wrapper)", 0);
  8857. #if !CYTHON_METH_FASTCALL
  8858. #if CYTHON_ASSUME_SAFE_SIZE
  8859. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  8860. #else
  8861. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  8862. #endif
  8863. #endif
  8864. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  8865. {
  8866. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,&__pyx_mstate_global->__pyx_n_u_ends,&__pyx_mstate_global->__pyx_n_u_tolerance,0};
  8867. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  8868. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 464, __pyx_L3_error)
  8869. if (__pyx_kwds_len > 0) {
  8870. switch (__pyx_nargs) {
  8871. case 4:
  8872. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8873. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
  8874. CYTHON_FALLTHROUGH;
  8875. case 3:
  8876. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8877. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
  8878. CYTHON_FALLTHROUGH;
  8879. case 2:
  8880. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8881. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
  8882. CYTHON_FALLTHROUGH;
  8883. case 1:
  8884. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8885. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
  8886. CYTHON_FALLTHROUGH;
  8887. case 0: break;
  8888. default: goto __pyx_L5_argtuple_error;
  8889. }
  8890. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  8891. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iup_delta_optimize", 0) < (0)) __PYX_ERR(0, 464, __pyx_L3_error)
  8892. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  8893. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  8894. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, i); __PYX_ERR(0, 464, __pyx_L3_error) }
  8895. }
  8896. } else {
  8897. switch (__pyx_nargs) {
  8898. case 4:
  8899. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8900. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
  8901. CYTHON_FALLTHROUGH;
  8902. case 3:
  8903. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8904. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
  8905. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8906. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
  8907. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8908. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
  8909. break;
  8910. default: goto __pyx_L5_argtuple_error;
  8911. }
  8912. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  8913. }
  8914. __pyx_v_deltas = values[0];
  8915. __pyx_v_coords = values[1];
  8916. __pyx_v_ends = values[2];
  8917. __pyx_v_tolerance = values[3];
  8918. }
  8919. goto __pyx_L6_skip;
  8920. __pyx_L5_argtuple_error:;
  8921. __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 464, __pyx_L3_error)
  8922. __pyx_L6_skip:;
  8923. goto __pyx_L4_argument_unpacking_done;
  8924. __pyx_L3_error:;
  8925. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8926. Py_XDECREF(values[__pyx_temp]);
  8927. }
  8928. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8929. __Pyx_RefNannyFinishContext();
  8930. return NULL;
  8931. __pyx_L4_argument_unpacking_done:;
  8932. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_14iup_delta_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends, __pyx_v_tolerance);
  8933. /* function exit code */
  8934. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8935. Py_XDECREF(values[__pyx_temp]);
  8936. }
  8937. __Pyx_RefNannyFinishContext();
  8938. return __pyx_r;
  8939. }
  8940. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_14iup_delta_optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords, PyObject *__pyx_v_ends, PyObject *__pyx_v_tolerance) {
  8941. PyObject *__pyx_v_n = NULL;
  8942. PyObject *__pyx_v_out = NULL;
  8943. PyObject *__pyx_v_start = NULL;
  8944. PyObject *__pyx_v_end = NULL;
  8945. PyObject *__pyx_v_contour = NULL;
  8946. PyObject *__pyx_r = NULL;
  8947. __Pyx_RefNannyDeclarations
  8948. int __pyx_t_1;
  8949. PyObject *__pyx_t_2 = NULL;
  8950. PyObject *__pyx_t_3 = NULL;
  8951. int __pyx_t_4;
  8952. Py_ssize_t __pyx_t_5;
  8953. PyObject *__pyx_t_6 = NULL;
  8954. PyObject *__pyx_t_7 = NULL;
  8955. PyObject *__pyx_t_8 = NULL;
  8956. PyObject *(*__pyx_t_9)(PyObject *);
  8957. PyObject *__pyx_t_10 = NULL;
  8958. PyObject *__pyx_t_11 = NULL;
  8959. size_t __pyx_t_12;
  8960. Py_ssize_t __pyx_t_13;
  8961. int __pyx_t_14;
  8962. int __pyx_lineno = 0;
  8963. const char *__pyx_filename = NULL;
  8964. int __pyx_clineno = 0;
  8965. __Pyx_RefNannySetupContext("iup_delta_optimize", 0);
  8966. __Pyx_INCREF(__pyx_v_ends);
  8967. /* "fontTools/varLib/iup.py":477
  8968. * the input delta.
  8969. * """
  8970. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  8971. * n = len(coords)
  8972. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  8973. */
  8974. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8975. if (unlikely(__pyx_assertions_enabled())) {
  8976. __pyx_t_2 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
  8977. __Pyx_GOTREF(__pyx_t_2);
  8978. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8979. __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_ends, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  8980. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8981. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8982. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8983. if (__pyx_t_4) {
  8984. } else {
  8985. __pyx_t_1 = __pyx_t_4;
  8986. goto __pyx_L3_bool_binop_done;
  8987. }
  8988. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 477, __pyx_L1_error)
  8989. __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  8990. __Pyx_GOTREF(__pyx_t_3);
  8991. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8992. if (__pyx_t_4) {
  8993. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_ends, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error)
  8994. __Pyx_GOTREF(__pyx_t_6);
  8995. __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 477, __pyx_L1_error)
  8996. __Pyx_GOTREF(__pyx_t_7);
  8997. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8998. __pyx_t_2 = __pyx_t_7;
  8999. __pyx_t_7 = 0;
  9000. } else {
  9001. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  9002. __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  9003. }
  9004. __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_2, __pyx_mstate_global->__pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 477, __pyx_L1_error)
  9005. __Pyx_GOTREF(__pyx_t_7);
  9006. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9007. __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
  9008. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9009. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9010. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  9011. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9012. __pyx_t_1 = __pyx_t_4;
  9013. __pyx_L3_bool_binop_done:;
  9014. if (unlikely(!__pyx_t_1)) {
  9015. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  9016. __PYX_ERR(0, 477, __pyx_L1_error)
  9017. }
  9018. }
  9019. #else
  9020. if ((1)); else __PYX_ERR(0, 477, __pyx_L1_error)
  9021. #endif
  9022. /* "fontTools/varLib/iup.py":478
  9023. * """
  9024. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9025. * n = len(coords) # <<<<<<<<<<<<<<
  9026. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9027. * out = []
  9028. */
  9029. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 478, __pyx_L1_error)
  9030. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
  9031. __Pyx_GOTREF(__pyx_t_2);
  9032. __pyx_v_n = __pyx_t_2;
  9033. __pyx_t_2 = 0;
  9034. /* "fontTools/varLib/iup.py":479
  9035. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9036. * n = len(coords)
  9037. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  9038. * out = []
  9039. * start = 0
  9040. */
  9041. __pyx_t_2 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
  9042. __Pyx_GOTREF(__pyx_t_2);
  9043. __pyx_t_7 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error)
  9044. __Pyx_GOTREF(__pyx_t_7);
  9045. __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
  9046. __Pyx_GOTREF(__pyx_t_3);
  9047. __pyx_t_6 = __Pyx_PyLong_SubtractObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error)
  9048. __Pyx_GOTREF(__pyx_t_6);
  9049. __pyx_t_8 = PyList_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error)
  9050. __Pyx_GOTREF(__pyx_t_8);
  9051. __Pyx_GIVEREF(__pyx_t_2);
  9052. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9053. __Pyx_GIVEREF(__pyx_t_7);
  9054. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9055. __Pyx_GIVEREF(__pyx_t_3);
  9056. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9057. __Pyx_GIVEREF(__pyx_t_6);
  9058. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9059. __pyx_t_2 = 0;
  9060. __pyx_t_7 = 0;
  9061. __pyx_t_3 = 0;
  9062. __pyx_t_6 = 0;
  9063. __pyx_t_6 = PyNumber_Add(__pyx_v_ends, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error)
  9064. __Pyx_GOTREF(__pyx_t_6);
  9065. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9066. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_6);
  9067. __pyx_t_6 = 0;
  9068. /* "fontTools/varLib/iup.py":480
  9069. * n = len(coords)
  9070. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9071. * out = [] # <<<<<<<<<<<<<<
  9072. * start = 0
  9073. * for end in ends:
  9074. */
  9075. __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
  9076. __Pyx_GOTREF(__pyx_t_6);
  9077. __pyx_v_out = ((PyObject*)__pyx_t_6);
  9078. __pyx_t_6 = 0;
  9079. /* "fontTools/varLib/iup.py":481
  9080. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9081. * out = []
  9082. * start = 0 # <<<<<<<<<<<<<<
  9083. * for end in ends:
  9084. * contour = iup_contour_optimize(
  9085. */
  9086. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  9087. __pyx_v_start = __pyx_mstate_global->__pyx_int_0;
  9088. /* "fontTools/varLib/iup.py":482
  9089. * out = []
  9090. * start = 0
  9091. * for end in ends: # <<<<<<<<<<<<<<
  9092. * contour = iup_contour_optimize(
  9093. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9094. */
  9095. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  9096. __pyx_t_6 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_6);
  9097. __pyx_t_5 = 0;
  9098. __pyx_t_9 = NULL;
  9099. } else {
  9100. __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error)
  9101. __Pyx_GOTREF(__pyx_t_6);
  9102. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L1_error)
  9103. }
  9104. for (;;) {
  9105. if (likely(!__pyx_t_9)) {
  9106. if (likely(PyList_CheckExact(__pyx_t_6))) {
  9107. {
  9108. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  9109. #if !CYTHON_ASSUME_SAFE_SIZE
  9110. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 482, __pyx_L1_error)
  9111. #endif
  9112. if (__pyx_t_5 >= __pyx_temp) break;
  9113. }
  9114. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
  9115. ++__pyx_t_5;
  9116. } else {
  9117. {
  9118. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  9119. #if !CYTHON_ASSUME_SAFE_SIZE
  9120. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 482, __pyx_L1_error)
  9121. #endif
  9122. if (__pyx_t_5 >= __pyx_temp) break;
  9123. }
  9124. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9125. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5));
  9126. #else
  9127. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_5);
  9128. #endif
  9129. ++__pyx_t_5;
  9130. }
  9131. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error)
  9132. } else {
  9133. __pyx_t_8 = __pyx_t_9(__pyx_t_6);
  9134. if (unlikely(!__pyx_t_8)) {
  9135. PyObject* exc_type = PyErr_Occurred();
  9136. if (exc_type) {
  9137. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 482, __pyx_L1_error)
  9138. PyErr_Clear();
  9139. }
  9140. break;
  9141. }
  9142. }
  9143. __Pyx_GOTREF(__pyx_t_8);
  9144. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_8);
  9145. __pyx_t_8 = 0;
  9146. /* "fontTools/varLib/iup.py":483
  9147. * start = 0
  9148. * for end in ends:
  9149. * contour = iup_contour_optimize( # <<<<<<<<<<<<<<
  9150. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9151. * )
  9152. */
  9153. __pyx_t_3 = NULL;
  9154. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error)
  9155. __Pyx_GOTREF(__pyx_t_7);
  9156. /* "fontTools/varLib/iup.py":484
  9157. * for end in ends:
  9158. * contour = iup_contour_optimize(
  9159. * deltas[start : end + 1], coords[start : end + 1], tolerance # <<<<<<<<<<<<<<
  9160. * )
  9161. * assert len(contour) == end - start + 1
  9162. */
  9163. __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_end, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
  9164. __Pyx_GOTREF(__pyx_t_2);
  9165. __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_v_deltas, 0, 0, &__pyx_v_start, &__pyx_t_2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 484, __pyx_L1_error)
  9166. __Pyx_GOTREF(__pyx_t_10);
  9167. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9168. __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_end, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
  9169. __Pyx_GOTREF(__pyx_t_2);
  9170. __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_start, &__pyx_t_2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 484, __pyx_L1_error)
  9171. __Pyx_GOTREF(__pyx_t_11);
  9172. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9173. __pyx_t_12 = 1;
  9174. #if CYTHON_UNPACK_METHODS
  9175. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  9176. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
  9177. assert(__pyx_t_3);
  9178. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  9179. __Pyx_INCREF(__pyx_t_3);
  9180. __Pyx_INCREF(__pyx__function);
  9181. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  9182. __pyx_t_12 = 0;
  9183. }
  9184. #endif
  9185. {
  9186. PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_t_10, __pyx_t_11, __pyx_v_tolerance};
  9187. __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_12, (4-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  9188. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  9189. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9190. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9191. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9192. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 483, __pyx_L1_error)
  9193. __Pyx_GOTREF(__pyx_t_8);
  9194. }
  9195. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_8);
  9196. __pyx_t_8 = 0;
  9197. /* "fontTools/varLib/iup.py":486
  9198. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9199. * )
  9200. * assert len(contour) == end - start + 1 # <<<<<<<<<<<<<<
  9201. * out.extend(contour)
  9202. * start = end + 1
  9203. */
  9204. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9205. if (unlikely(__pyx_assertions_enabled())) {
  9206. __pyx_t_13 = PyObject_Length(__pyx_v_contour); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 486, __pyx_L1_error)
  9207. __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error)
  9208. __Pyx_GOTREF(__pyx_t_8);
  9209. __pyx_t_7 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error)
  9210. __Pyx_GOTREF(__pyx_t_7);
  9211. __pyx_t_11 = __Pyx_PyLong_AddObjC(__pyx_t_7, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 486, __pyx_L1_error)
  9212. __Pyx_GOTREF(__pyx_t_11);
  9213. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9214. __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error)
  9215. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9216. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9217. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 486, __pyx_L1_error)
  9218. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9219. if (unlikely(!__pyx_t_1)) {
  9220. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  9221. __PYX_ERR(0, 486, __pyx_L1_error)
  9222. }
  9223. }
  9224. #else
  9225. if ((1)); else __PYX_ERR(0, 486, __pyx_L1_error)
  9226. #endif
  9227. /* "fontTools/varLib/iup.py":487
  9228. * )
  9229. * assert len(contour) == end - start + 1
  9230. * out.extend(contour) # <<<<<<<<<<<<<<
  9231. * start = end + 1
  9232. *
  9233. */
  9234. __pyx_t_14 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_v_contour); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 487, __pyx_L1_error)
  9235. /* "fontTools/varLib/iup.py":488
  9236. * assert len(contour) == end - start + 1
  9237. * out.extend(contour)
  9238. * start = end + 1 # <<<<<<<<<<<<<<
  9239. *
  9240. * return out
  9241. */
  9242. __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_v_end, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
  9243. __Pyx_GOTREF(__pyx_t_7);
  9244. __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_7);
  9245. __pyx_t_7 = 0;
  9246. /* "fontTools/varLib/iup.py":482
  9247. * out = []
  9248. * start = 0
  9249. * for end in ends: # <<<<<<<<<<<<<<
  9250. * contour = iup_contour_optimize(
  9251. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9252. */
  9253. }
  9254. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9255. /* "fontTools/varLib/iup.py":490
  9256. * start = end + 1
  9257. *
  9258. * return out # <<<<<<<<<<<<<<
  9259. */
  9260. __Pyx_XDECREF(__pyx_r);
  9261. __Pyx_INCREF(__pyx_v_out);
  9262. __pyx_r = __pyx_v_out;
  9263. goto __pyx_L0;
  9264. /* "fontTools/varLib/iup.py":464
  9265. *
  9266. *
  9267. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  9268. * deltas: _DeltaSegment,
  9269. * coords: _PointSegment,
  9270. */
  9271. /* function exit code */
  9272. __pyx_L1_error:;
  9273. __Pyx_XDECREF(__pyx_t_2);
  9274. __Pyx_XDECREF(__pyx_t_3);
  9275. __Pyx_XDECREF(__pyx_t_6);
  9276. __Pyx_XDECREF(__pyx_t_7);
  9277. __Pyx_XDECREF(__pyx_t_8);
  9278. __Pyx_XDECREF(__pyx_t_10);
  9279. __Pyx_XDECREF(__pyx_t_11);
  9280. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9281. __pyx_r = NULL;
  9282. __pyx_L0:;
  9283. __Pyx_XDECREF(__pyx_v_n);
  9284. __Pyx_XDECREF(__pyx_v_out);
  9285. __Pyx_XDECREF(__pyx_v_start);
  9286. __Pyx_XDECREF(__pyx_v_end);
  9287. __Pyx_XDECREF(__pyx_v_contour);
  9288. __Pyx_XDECREF(__pyx_v_ends);
  9289. __Pyx_XGIVEREF(__pyx_r);
  9290. __Pyx_RefNannyFinishContext();
  9291. return __pyx_r;
  9292. }
  9293. /* #### Code section: module_exttypes ### */
  9294. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9295. PyObject *o;
  9296. o = __Pyx_AllocateExtensionType(t, 1);
  9297. if (unlikely(!o)) return 0;
  9298. return o;
  9299. }
  9300. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o) {
  9301. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9302. #if CYTHON_USE_TP_FINALIZE
  9303. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9304. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults) {
  9305. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9306. }
  9307. }
  9308. #endif
  9309. PyObject_GC_UnTrack(o);
  9310. Py_CLEAR(p->arg0);
  9311. PyTypeObject *tp = Py_TYPE(o);
  9312. #if CYTHON_USE_TYPE_SLOTS
  9313. (*tp->tp_free)(o);
  9314. #else
  9315. {
  9316. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9317. if (tp_free) tp_free(o);
  9318. }
  9319. #endif
  9320. #if CYTHON_USE_TYPE_SPECS
  9321. Py_DECREF(tp);
  9322. #endif
  9323. }
  9324. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o, visitproc v, void *a) {
  9325. int e;
  9326. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9327. {
  9328. e = __Pyx_call_type_traverse(o, 1, v, a);
  9329. if (e) return e;
  9330. }
  9331. if (p->arg0) {
  9332. e = (*v)(p->arg0, a); if (e) return e;
  9333. }
  9334. return 0;
  9335. }
  9336. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o) {
  9337. PyObject* tmp;
  9338. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9339. tmp = ((PyObject*)p->arg0);
  9340. p->arg0 = ((PyObject*)Py_None); Py_INCREF(Py_None);
  9341. Py_XDECREF(tmp);
  9342. return 0;
  9343. }
  9344. #if CYTHON_USE_TYPE_SPECS
  9345. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_slots[] = {
  9346. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults},
  9347. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults},
  9348. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults},
  9349. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults},
  9350. {0, 0},
  9351. };
  9352. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_spec = {
  9353. "fontTools.varLib.iup.__pyx_defaults",
  9354. sizeof(struct __pyx_defaults),
  9355. 0,
  9356. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9357. __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_slots,
  9358. };
  9359. #else
  9360. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_defaults = {
  9361. PyVarObject_HEAD_INIT(0, 0)
  9362. "fontTools.varLib.iup.""__pyx_defaults", /*tp_name*/
  9363. sizeof(struct __pyx_defaults), /*tp_basicsize*/
  9364. 0, /*tp_itemsize*/
  9365. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults, /*tp_dealloc*/
  9366. 0, /*tp_vectorcall_offset*/
  9367. 0, /*tp_getattr*/
  9368. 0, /*tp_setattr*/
  9369. 0, /*tp_as_async*/
  9370. 0, /*tp_repr*/
  9371. 0, /*tp_as_number*/
  9372. 0, /*tp_as_sequence*/
  9373. 0, /*tp_as_mapping*/
  9374. 0, /*tp_hash*/
  9375. 0, /*tp_call*/
  9376. 0, /*tp_str*/
  9377. 0, /*tp_getattro*/
  9378. 0, /*tp_setattro*/
  9379. 0, /*tp_as_buffer*/
  9380. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9381. 0, /*tp_doc*/
  9382. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults, /*tp_traverse*/
  9383. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults, /*tp_clear*/
  9384. 0, /*tp_richcompare*/
  9385. 0, /*tp_weaklistoffset*/
  9386. 0, /*tp_iter*/
  9387. 0, /*tp_iternext*/
  9388. 0, /*tp_methods*/
  9389. 0, /*tp_members*/
  9390. 0, /*tp_getset*/
  9391. 0, /*tp_base*/
  9392. 0, /*tp_dict*/
  9393. 0, /*tp_descr_get*/
  9394. 0, /*tp_descr_set*/
  9395. #if !CYTHON_USE_TYPE_SPECS
  9396. 0, /*tp_dictoffset*/
  9397. #endif
  9398. 0, /*tp_init*/
  9399. 0, /*tp_alloc*/
  9400. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults, /*tp_new*/
  9401. 0, /*tp_free*/
  9402. 0, /*tp_is_gc*/
  9403. 0, /*tp_bases*/
  9404. 0, /*tp_mro*/
  9405. 0, /*tp_cache*/
  9406. 0, /*tp_subclasses*/
  9407. 0, /*tp_weaklist*/
  9408. 0, /*tp_del*/
  9409. 0, /*tp_version_tag*/
  9410. #if CYTHON_USE_TP_FINALIZE
  9411. 0, /*tp_finalize*/
  9412. #else
  9413. NULL, /*tp_finalize*/
  9414. #endif
  9415. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9416. 0, /*tp_vectorcall*/
  9417. #endif
  9418. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9419. 0, /*tp_print*/
  9420. #endif
  9421. #if PY_VERSION_HEX >= 0x030C0000
  9422. 0, /*tp_watched*/
  9423. #endif
  9424. #if PY_VERSION_HEX >= 0x030d00A4
  9425. 0, /*tp_versions_used*/
  9426. #endif
  9427. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9428. 0, /*tp_pypy_flags*/
  9429. #endif
  9430. };
  9431. #endif
  9432. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9433. PyObject *o;
  9434. #if CYTHON_USE_FREELISTS
  9435. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between))))
  9436. {
  9437. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between[--__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between];
  9438. #if CYTHON_USE_TYPE_SPECS
  9439. Py_DECREF(Py_TYPE(o));
  9440. #endif
  9441. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between));
  9442. #if CYTHON_COMPILING_IN_LIMITED_API
  9443. (void) PyObject_Init(o, t);
  9444. #else
  9445. (void) PyObject_INIT(o, t);
  9446. #endif
  9447. PyObject_GC_Track(o);
  9448. } else
  9449. #endif
  9450. {
  9451. o = __Pyx_AllocateExtensionType(t, 1);
  9452. if (unlikely(!o)) return 0;
  9453. }
  9454. return o;
  9455. }
  9456. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9457. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)o;
  9458. #if CYTHON_USE_TP_FINALIZE
  9459. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9460. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between) {
  9461. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9462. }
  9463. }
  9464. #endif
  9465. PyObject_GC_UnTrack(o);
  9466. Py_CLEAR(p->__pyx_v_tolerance);
  9467. #if CYTHON_USE_FREELISTS
  9468. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between))))
  9469. {
  9470. __pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between[__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)o);
  9471. } else
  9472. #endif
  9473. {
  9474. PyTypeObject *tp = Py_TYPE(o);
  9475. #if CYTHON_USE_TYPE_SLOTS
  9476. (*tp->tp_free)(o);
  9477. #else
  9478. {
  9479. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9480. if (tp_free) tp_free(o);
  9481. }
  9482. #endif
  9483. #if CYTHON_USE_TYPE_SPECS
  9484. Py_DECREF(tp);
  9485. #endif
  9486. }
  9487. }
  9488. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o, visitproc v, void *a) {
  9489. int e;
  9490. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)o;
  9491. {
  9492. e = __Pyx_call_type_traverse(o, 1, v, a);
  9493. if (e) return e;
  9494. }
  9495. if (p->__pyx_v_tolerance) {
  9496. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  9497. }
  9498. return 0;
  9499. }
  9500. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9501. PyObject* tmp;
  9502. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)o;
  9503. tmp = ((PyObject*)p->__pyx_v_tolerance);
  9504. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  9505. Py_XDECREF(tmp);
  9506. return 0;
  9507. }
  9508. #if CYTHON_USE_TYPE_SPECS
  9509. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots[] = {
  9510. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9511. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9512. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9513. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9514. {0, 0},
  9515. };
  9516. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_spec = {
  9517. "fontTools.varLib.iup.__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between",
  9518. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between),
  9519. 0,
  9520. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9521. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots,
  9522. };
  9523. #else
  9524. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = {
  9525. PyVarObject_HEAD_INIT(0, 0)
  9526. "fontTools.varLib.iup.""__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between", /*tp_name*/
  9527. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between), /*tp_basicsize*/
  9528. 0, /*tp_itemsize*/
  9529. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_dealloc*/
  9530. 0, /*tp_vectorcall_offset*/
  9531. 0, /*tp_getattr*/
  9532. 0, /*tp_setattr*/
  9533. 0, /*tp_as_async*/
  9534. 0, /*tp_repr*/
  9535. 0, /*tp_as_number*/
  9536. 0, /*tp_as_sequence*/
  9537. 0, /*tp_as_mapping*/
  9538. 0, /*tp_hash*/
  9539. 0, /*tp_call*/
  9540. 0, /*tp_str*/
  9541. 0, /*tp_getattro*/
  9542. 0, /*tp_setattro*/
  9543. 0, /*tp_as_buffer*/
  9544. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9545. 0, /*tp_doc*/
  9546. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_traverse*/
  9547. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_clear*/
  9548. 0, /*tp_richcompare*/
  9549. 0, /*tp_weaklistoffset*/
  9550. 0, /*tp_iter*/
  9551. 0, /*tp_iternext*/
  9552. 0, /*tp_methods*/
  9553. 0, /*tp_members*/
  9554. 0, /*tp_getset*/
  9555. 0, /*tp_base*/
  9556. 0, /*tp_dict*/
  9557. 0, /*tp_descr_get*/
  9558. 0, /*tp_descr_set*/
  9559. #if !CYTHON_USE_TYPE_SPECS
  9560. 0, /*tp_dictoffset*/
  9561. #endif
  9562. 0, /*tp_init*/
  9563. 0, /*tp_alloc*/
  9564. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_new*/
  9565. 0, /*tp_free*/
  9566. 0, /*tp_is_gc*/
  9567. 0, /*tp_bases*/
  9568. 0, /*tp_mro*/
  9569. 0, /*tp_cache*/
  9570. 0, /*tp_subclasses*/
  9571. 0, /*tp_weaklist*/
  9572. 0, /*tp_del*/
  9573. 0, /*tp_version_tag*/
  9574. #if CYTHON_USE_TP_FINALIZE
  9575. 0, /*tp_finalize*/
  9576. #else
  9577. NULL, /*tp_finalize*/
  9578. #endif
  9579. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9580. 0, /*tp_vectorcall*/
  9581. #endif
  9582. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9583. 0, /*tp_print*/
  9584. #endif
  9585. #if PY_VERSION_HEX >= 0x030C0000
  9586. 0, /*tp_watched*/
  9587. #endif
  9588. #if PY_VERSION_HEX >= 0x030d00A4
  9589. 0, /*tp_versions_used*/
  9590. #endif
  9591. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9592. 0, /*tp_pypy_flags*/
  9593. #endif
  9594. };
  9595. #endif
  9596. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9597. PyObject *o;
  9598. #if CYTHON_USE_FREELISTS
  9599. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr))))
  9600. {
  9601. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr];
  9602. #if CYTHON_USE_TYPE_SPECS
  9603. Py_DECREF(Py_TYPE(o));
  9604. #endif
  9605. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr));
  9606. #if CYTHON_COMPILING_IN_LIMITED_API
  9607. (void) PyObject_Init(o, t);
  9608. #else
  9609. (void) PyObject_INIT(o, t);
  9610. #endif
  9611. PyObject_GC_Track(o);
  9612. } else
  9613. #endif
  9614. {
  9615. o = __Pyx_AllocateExtensionType(t, 1);
  9616. if (unlikely(!o)) return 0;
  9617. }
  9618. return o;
  9619. }
  9620. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o) {
  9621. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  9622. #if CYTHON_USE_TP_FINALIZE
  9623. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9624. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) {
  9625. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9626. }
  9627. }
  9628. #endif
  9629. PyObject_GC_UnTrack(o);
  9630. Py_CLEAR(p->__pyx_outer_scope);
  9631. Py_CLEAR(p->__pyx_genexpr_arg_0);
  9632. #if CYTHON_USE_FREELISTS
  9633. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr))))
  9634. {
  9635. __pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o);
  9636. } else
  9637. #endif
  9638. {
  9639. PyTypeObject *tp = Py_TYPE(o);
  9640. #if CYTHON_USE_TYPE_SLOTS
  9641. (*tp->tp_free)(o);
  9642. #else
  9643. {
  9644. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9645. if (tp_free) tp_free(o);
  9646. }
  9647. #endif
  9648. #if CYTHON_USE_TYPE_SPECS
  9649. Py_DECREF(tp);
  9650. #endif
  9651. }
  9652. }
  9653. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  9654. int e;
  9655. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  9656. {
  9657. e = __Pyx_call_type_traverse(o, 1, v, a);
  9658. if (e) return e;
  9659. }
  9660. if (p->__pyx_outer_scope) {
  9661. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  9662. }
  9663. if (p->__pyx_genexpr_arg_0) {
  9664. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  9665. }
  9666. return 0;
  9667. }
  9668. #if CYTHON_USE_TYPE_SPECS
  9669. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots[] = {
  9670. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9671. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9672. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9673. {0, 0},
  9674. };
  9675. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec = {
  9676. "fontTools.varLib.iup.__pyx_scope_struct_1_genexpr",
  9677. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr),
  9678. 0,
  9679. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9680. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots,
  9681. };
  9682. #else
  9683. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = {
  9684. PyVarObject_HEAD_INIT(0, 0)
  9685. "fontTools.varLib.iup.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  9686. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  9687. 0, /*tp_itemsize*/
  9688. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  9689. 0, /*tp_vectorcall_offset*/
  9690. 0, /*tp_getattr*/
  9691. 0, /*tp_setattr*/
  9692. 0, /*tp_as_async*/
  9693. 0, /*tp_repr*/
  9694. 0, /*tp_as_number*/
  9695. 0, /*tp_as_sequence*/
  9696. 0, /*tp_as_mapping*/
  9697. 0, /*tp_hash*/
  9698. 0, /*tp_call*/
  9699. 0, /*tp_str*/
  9700. 0, /*tp_getattro*/
  9701. 0, /*tp_setattro*/
  9702. 0, /*tp_as_buffer*/
  9703. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9704. 0, /*tp_doc*/
  9705. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  9706. 0, /*tp_clear*/
  9707. 0, /*tp_richcompare*/
  9708. 0, /*tp_weaklistoffset*/
  9709. 0, /*tp_iter*/
  9710. 0, /*tp_iternext*/
  9711. 0, /*tp_methods*/
  9712. 0, /*tp_members*/
  9713. 0, /*tp_getset*/
  9714. 0, /*tp_base*/
  9715. 0, /*tp_dict*/
  9716. 0, /*tp_descr_get*/
  9717. 0, /*tp_descr_set*/
  9718. #if !CYTHON_USE_TYPE_SPECS
  9719. 0, /*tp_dictoffset*/
  9720. #endif
  9721. 0, /*tp_init*/
  9722. 0, /*tp_alloc*/
  9723. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_new*/
  9724. 0, /*tp_free*/
  9725. 0, /*tp_is_gc*/
  9726. 0, /*tp_bases*/
  9727. 0, /*tp_mro*/
  9728. 0, /*tp_cache*/
  9729. 0, /*tp_subclasses*/
  9730. 0, /*tp_weaklist*/
  9731. 0, /*tp_del*/
  9732. 0, /*tp_version_tag*/
  9733. #if CYTHON_USE_TP_FINALIZE
  9734. 0, /*tp_finalize*/
  9735. #else
  9736. NULL, /*tp_finalize*/
  9737. #endif
  9738. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9739. 0, /*tp_vectorcall*/
  9740. #endif
  9741. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9742. 0, /*tp_print*/
  9743. #endif
  9744. #if PY_VERSION_HEX >= 0x030C0000
  9745. 0, /*tp_watched*/
  9746. #endif
  9747. #if PY_VERSION_HEX >= 0x030d00A4
  9748. 0, /*tp_versions_used*/
  9749. #endif
  9750. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9751. 0, /*tp_pypy_flags*/
  9752. #endif
  9753. };
  9754. #endif
  9755. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9756. PyObject *o;
  9757. #if CYTHON_USE_FREELISTS
  9758. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize))))
  9759. {
  9760. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize[--__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize];
  9761. #if CYTHON_USE_TYPE_SPECS
  9762. Py_DECREF(Py_TYPE(o));
  9763. #endif
  9764. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize));
  9765. #if CYTHON_COMPILING_IN_LIMITED_API
  9766. (void) PyObject_Init(o, t);
  9767. #else
  9768. (void) PyObject_INIT(o, t);
  9769. #endif
  9770. PyObject_GC_Track(o);
  9771. } else
  9772. #endif
  9773. {
  9774. o = __Pyx_AllocateExtensionType(t, 1);
  9775. if (unlikely(!o)) return 0;
  9776. }
  9777. return o;
  9778. }
  9779. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  9780. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)o;
  9781. #if CYTHON_USE_TP_FINALIZE
  9782. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9783. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) {
  9784. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9785. }
  9786. }
  9787. #endif
  9788. PyObject_GC_UnTrack(o);
  9789. Py_CLEAR(p->__pyx_v_d0);
  9790. Py_CLEAR(p->__pyx_v_tolerance);
  9791. #if CYTHON_USE_FREELISTS
  9792. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize))))
  9793. {
  9794. __pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize[__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)o);
  9795. } else
  9796. #endif
  9797. {
  9798. PyTypeObject *tp = Py_TYPE(o);
  9799. #if CYTHON_USE_TYPE_SLOTS
  9800. (*tp->tp_free)(o);
  9801. #else
  9802. {
  9803. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9804. if (tp_free) tp_free(o);
  9805. }
  9806. #endif
  9807. #if CYTHON_USE_TYPE_SPECS
  9808. Py_DECREF(tp);
  9809. #endif
  9810. }
  9811. }
  9812. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o, visitproc v, void *a) {
  9813. int e;
  9814. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)o;
  9815. {
  9816. e = __Pyx_call_type_traverse(o, 1, v, a);
  9817. if (e) return e;
  9818. }
  9819. if (p->__pyx_v_d0) {
  9820. e = (*v)(p->__pyx_v_d0, a); if (e) return e;
  9821. }
  9822. if (p->__pyx_v_tolerance) {
  9823. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  9824. }
  9825. return 0;
  9826. }
  9827. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  9828. PyObject* tmp;
  9829. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)o;
  9830. tmp = ((PyObject*)p->__pyx_v_d0);
  9831. p->__pyx_v_d0 = Py_None; Py_INCREF(Py_None);
  9832. Py_XDECREF(tmp);
  9833. tmp = ((PyObject*)p->__pyx_v_tolerance);
  9834. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  9835. Py_XDECREF(tmp);
  9836. return 0;
  9837. }
  9838. #if CYTHON_USE_TYPE_SPECS
  9839. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots[] = {
  9840. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9841. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9842. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9843. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9844. {0, 0},
  9845. };
  9846. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec = {
  9847. "fontTools.varLib.iup.__pyx_scope_struct_2_iup_contour_optimize",
  9848. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize),
  9849. 0,
  9850. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9851. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots,
  9852. };
  9853. #else
  9854. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = {
  9855. PyVarObject_HEAD_INIT(0, 0)
  9856. "fontTools.varLib.iup.""__pyx_scope_struct_2_iup_contour_optimize", /*tp_name*/
  9857. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize), /*tp_basicsize*/
  9858. 0, /*tp_itemsize*/
  9859. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_dealloc*/
  9860. 0, /*tp_vectorcall_offset*/
  9861. 0, /*tp_getattr*/
  9862. 0, /*tp_setattr*/
  9863. 0, /*tp_as_async*/
  9864. 0, /*tp_repr*/
  9865. 0, /*tp_as_number*/
  9866. 0, /*tp_as_sequence*/
  9867. 0, /*tp_as_mapping*/
  9868. 0, /*tp_hash*/
  9869. 0, /*tp_call*/
  9870. 0, /*tp_str*/
  9871. 0, /*tp_getattro*/
  9872. 0, /*tp_setattro*/
  9873. 0, /*tp_as_buffer*/
  9874. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9875. 0, /*tp_doc*/
  9876. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_traverse*/
  9877. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_clear*/
  9878. 0, /*tp_richcompare*/
  9879. 0, /*tp_weaklistoffset*/
  9880. 0, /*tp_iter*/
  9881. 0, /*tp_iternext*/
  9882. 0, /*tp_methods*/
  9883. 0, /*tp_members*/
  9884. 0, /*tp_getset*/
  9885. 0, /*tp_base*/
  9886. 0, /*tp_dict*/
  9887. 0, /*tp_descr_get*/
  9888. 0, /*tp_descr_set*/
  9889. #if !CYTHON_USE_TYPE_SPECS
  9890. 0, /*tp_dictoffset*/
  9891. #endif
  9892. 0, /*tp_init*/
  9893. 0, /*tp_alloc*/
  9894. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_new*/
  9895. 0, /*tp_free*/
  9896. 0, /*tp_is_gc*/
  9897. 0, /*tp_bases*/
  9898. 0, /*tp_mro*/
  9899. 0, /*tp_cache*/
  9900. 0, /*tp_subclasses*/
  9901. 0, /*tp_weaklist*/
  9902. 0, /*tp_del*/
  9903. 0, /*tp_version_tag*/
  9904. #if CYTHON_USE_TP_FINALIZE
  9905. 0, /*tp_finalize*/
  9906. #else
  9907. NULL, /*tp_finalize*/
  9908. #endif
  9909. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9910. 0, /*tp_vectorcall*/
  9911. #endif
  9912. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9913. 0, /*tp_print*/
  9914. #endif
  9915. #if PY_VERSION_HEX >= 0x030C0000
  9916. 0, /*tp_watched*/
  9917. #endif
  9918. #if PY_VERSION_HEX >= 0x030d00A4
  9919. 0, /*tp_versions_used*/
  9920. #endif
  9921. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9922. 0, /*tp_pypy_flags*/
  9923. #endif
  9924. };
  9925. #endif
  9926. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9927. PyObject *o;
  9928. #if CYTHON_USE_FREELISTS
  9929. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr))))
  9930. {
  9931. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr];
  9932. #if CYTHON_USE_TYPE_SPECS
  9933. Py_DECREF(Py_TYPE(o));
  9934. #endif
  9935. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr));
  9936. #if CYTHON_COMPILING_IN_LIMITED_API
  9937. (void) PyObject_Init(o, t);
  9938. #else
  9939. (void) PyObject_INIT(o, t);
  9940. #endif
  9941. PyObject_GC_Track(o);
  9942. } else
  9943. #endif
  9944. {
  9945. o = __Pyx_AllocateExtensionType(t, 1);
  9946. if (unlikely(!o)) return 0;
  9947. }
  9948. return o;
  9949. }
  9950. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o) {
  9951. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  9952. #if CYTHON_USE_TP_FINALIZE
  9953. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9954. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) {
  9955. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9956. }
  9957. }
  9958. #endif
  9959. PyObject_GC_UnTrack(o);
  9960. Py_CLEAR(p->__pyx_outer_scope);
  9961. Py_CLEAR(p->__pyx_genexpr_arg_0);
  9962. Py_CLEAR(p->__pyx_v_p);
  9963. #if CYTHON_USE_FREELISTS
  9964. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr))))
  9965. {
  9966. __pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o);
  9967. } else
  9968. #endif
  9969. {
  9970. PyTypeObject *tp = Py_TYPE(o);
  9971. #if CYTHON_USE_TYPE_SLOTS
  9972. (*tp->tp_free)(o);
  9973. #else
  9974. {
  9975. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9976. if (tp_free) tp_free(o);
  9977. }
  9978. #endif
  9979. #if CYTHON_USE_TYPE_SPECS
  9980. Py_DECREF(tp);
  9981. #endif
  9982. }
  9983. }
  9984. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  9985. int e;
  9986. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  9987. {
  9988. e = __Pyx_call_type_traverse(o, 1, v, a);
  9989. if (e) return e;
  9990. }
  9991. if (p->__pyx_outer_scope) {
  9992. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  9993. }
  9994. if (p->__pyx_genexpr_arg_0) {
  9995. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  9996. }
  9997. if (p->__pyx_v_p) {
  9998. e = (*v)(p->__pyx_v_p, a); if (e) return e;
  9999. }
  10000. return 0;
  10001. }
  10002. #if CYTHON_USE_TYPE_SPECS
  10003. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots[] = {
  10004. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10005. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10006. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10007. {0, 0},
  10008. };
  10009. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec = {
  10010. "fontTools.varLib.iup.__pyx_scope_struct_3_genexpr",
  10011. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr),
  10012. 0,
  10013. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  10014. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots,
  10015. };
  10016. #else
  10017. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = {
  10018. PyVarObject_HEAD_INIT(0, 0)
  10019. "fontTools.varLib.iup.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  10020. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  10021. 0, /*tp_itemsize*/
  10022. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  10023. 0, /*tp_vectorcall_offset*/
  10024. 0, /*tp_getattr*/
  10025. 0, /*tp_setattr*/
  10026. 0, /*tp_as_async*/
  10027. 0, /*tp_repr*/
  10028. 0, /*tp_as_number*/
  10029. 0, /*tp_as_sequence*/
  10030. 0, /*tp_as_mapping*/
  10031. 0, /*tp_hash*/
  10032. 0, /*tp_call*/
  10033. 0, /*tp_str*/
  10034. 0, /*tp_getattro*/
  10035. 0, /*tp_setattro*/
  10036. 0, /*tp_as_buffer*/
  10037. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  10038. 0, /*tp_doc*/
  10039. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  10040. 0, /*tp_clear*/
  10041. 0, /*tp_richcompare*/
  10042. 0, /*tp_weaklistoffset*/
  10043. 0, /*tp_iter*/
  10044. 0, /*tp_iternext*/
  10045. 0, /*tp_methods*/
  10046. 0, /*tp_members*/
  10047. 0, /*tp_getset*/
  10048. 0, /*tp_base*/
  10049. 0, /*tp_dict*/
  10050. 0, /*tp_descr_get*/
  10051. 0, /*tp_descr_set*/
  10052. #if !CYTHON_USE_TYPE_SPECS
  10053. 0, /*tp_dictoffset*/
  10054. #endif
  10055. 0, /*tp_init*/
  10056. 0, /*tp_alloc*/
  10057. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_new*/
  10058. 0, /*tp_free*/
  10059. 0, /*tp_is_gc*/
  10060. 0, /*tp_bases*/
  10061. 0, /*tp_mro*/
  10062. 0, /*tp_cache*/
  10063. 0, /*tp_subclasses*/
  10064. 0, /*tp_weaklist*/
  10065. 0, /*tp_del*/
  10066. 0, /*tp_version_tag*/
  10067. #if CYTHON_USE_TP_FINALIZE
  10068. 0, /*tp_finalize*/
  10069. #else
  10070. NULL, /*tp_finalize*/
  10071. #endif
  10072. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  10073. 0, /*tp_vectorcall*/
  10074. #endif
  10075. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10076. 0, /*tp_print*/
  10077. #endif
  10078. #if PY_VERSION_HEX >= 0x030C0000
  10079. 0, /*tp_watched*/
  10080. #endif
  10081. #if PY_VERSION_HEX >= 0x030d00A4
  10082. 0, /*tp_versions_used*/
  10083. #endif
  10084. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10085. 0, /*tp_pypy_flags*/
  10086. #endif
  10087. };
  10088. #endif
  10089. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  10090. PyObject *o;
  10091. #if CYTHON_USE_FREELISTS
  10092. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr))))
  10093. {
  10094. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr];
  10095. #if CYTHON_USE_TYPE_SPECS
  10096. Py_DECREF(Py_TYPE(o));
  10097. #endif
  10098. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr));
  10099. #if CYTHON_COMPILING_IN_LIMITED_API
  10100. (void) PyObject_Init(o, t);
  10101. #else
  10102. (void) PyObject_INIT(o, t);
  10103. #endif
  10104. PyObject_GC_Track(o);
  10105. } else
  10106. #endif
  10107. {
  10108. o = __Pyx_AllocateExtensionType(t, 1);
  10109. if (unlikely(!o)) return 0;
  10110. }
  10111. return o;
  10112. }
  10113. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o) {
  10114. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10115. #if CYTHON_USE_TP_FINALIZE
  10116. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10117. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) {
  10118. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10119. }
  10120. }
  10121. #endif
  10122. PyObject_GC_UnTrack(o);
  10123. Py_CLEAR(p->__pyx_outer_scope);
  10124. Py_CLEAR(p->__pyx_genexpr_arg_0);
  10125. Py_CLEAR(p->__pyx_v_d);
  10126. #if CYTHON_USE_FREELISTS
  10127. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr))))
  10128. {
  10129. __pyx_mstate_global->__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o);
  10130. } else
  10131. #endif
  10132. {
  10133. PyTypeObject *tp = Py_TYPE(o);
  10134. #if CYTHON_USE_TYPE_SLOTS
  10135. (*tp->tp_free)(o);
  10136. #else
  10137. {
  10138. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  10139. if (tp_free) tp_free(o);
  10140. }
  10141. #endif
  10142. #if CYTHON_USE_TYPE_SPECS
  10143. Py_DECREF(tp);
  10144. #endif
  10145. }
  10146. }
  10147. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  10148. int e;
  10149. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10150. {
  10151. e = __Pyx_call_type_traverse(o, 1, v, a);
  10152. if (e) return e;
  10153. }
  10154. if (p->__pyx_outer_scope) {
  10155. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  10156. }
  10157. if (p->__pyx_genexpr_arg_0) {
  10158. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  10159. }
  10160. if (p->__pyx_v_d) {
  10161. e = (*v)(p->__pyx_v_d, a); if (e) return e;
  10162. }
  10163. return 0;
  10164. }
  10165. #if CYTHON_USE_TYPE_SPECS
  10166. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots[] = {
  10167. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10168. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10169. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10170. {0, 0},
  10171. };
  10172. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec = {
  10173. "fontTools.varLib.iup.__pyx_scope_struct_4_genexpr",
  10174. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr),
  10175. 0,
  10176. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  10177. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots,
  10178. };
  10179. #else
  10180. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = {
  10181. PyVarObject_HEAD_INIT(0, 0)
  10182. "fontTools.varLib.iup.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  10183. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  10184. 0, /*tp_itemsize*/
  10185. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  10186. 0, /*tp_vectorcall_offset*/
  10187. 0, /*tp_getattr*/
  10188. 0, /*tp_setattr*/
  10189. 0, /*tp_as_async*/
  10190. 0, /*tp_repr*/
  10191. 0, /*tp_as_number*/
  10192. 0, /*tp_as_sequence*/
  10193. 0, /*tp_as_mapping*/
  10194. 0, /*tp_hash*/
  10195. 0, /*tp_call*/
  10196. 0, /*tp_str*/
  10197. 0, /*tp_getattro*/
  10198. 0, /*tp_setattro*/
  10199. 0, /*tp_as_buffer*/
  10200. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  10201. 0, /*tp_doc*/
  10202. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  10203. 0, /*tp_clear*/
  10204. 0, /*tp_richcompare*/
  10205. 0, /*tp_weaklistoffset*/
  10206. 0, /*tp_iter*/
  10207. 0, /*tp_iternext*/
  10208. 0, /*tp_methods*/
  10209. 0, /*tp_members*/
  10210. 0, /*tp_getset*/
  10211. 0, /*tp_base*/
  10212. 0, /*tp_dict*/
  10213. 0, /*tp_descr_get*/
  10214. 0, /*tp_descr_set*/
  10215. #if !CYTHON_USE_TYPE_SPECS
  10216. 0, /*tp_dictoffset*/
  10217. #endif
  10218. 0, /*tp_init*/
  10219. 0, /*tp_alloc*/
  10220. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_new*/
  10221. 0, /*tp_free*/
  10222. 0, /*tp_is_gc*/
  10223. 0, /*tp_bases*/
  10224. 0, /*tp_mro*/
  10225. 0, /*tp_cache*/
  10226. 0, /*tp_subclasses*/
  10227. 0, /*tp_weaklist*/
  10228. 0, /*tp_del*/
  10229. 0, /*tp_version_tag*/
  10230. #if CYTHON_USE_TP_FINALIZE
  10231. 0, /*tp_finalize*/
  10232. #else
  10233. NULL, /*tp_finalize*/
  10234. #endif
  10235. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  10236. 0, /*tp_vectorcall*/
  10237. #endif
  10238. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10239. 0, /*tp_print*/
  10240. #endif
  10241. #if PY_VERSION_HEX >= 0x030C0000
  10242. 0, /*tp_watched*/
  10243. #endif
  10244. #if PY_VERSION_HEX >= 0x030d00A4
  10245. 0, /*tp_versions_used*/
  10246. #endif
  10247. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10248. 0, /*tp_pypy_flags*/
  10249. #endif
  10250. };
  10251. #endif
  10252. static PyMethodDef __pyx_methods[] = {
  10253. {0, 0, 0, 0}
  10254. };
  10255. /* #### Code section: initfunc_declarations ### */
  10256. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10257. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10258. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
  10259. static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10260. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10261. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10262. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10263. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10264. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10265. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10266. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10267. static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10268. /* #### Code section: init_module ### */
  10269. static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  10270. __Pyx_RefNannyDeclarations
  10271. CYTHON_UNUSED_VAR(__pyx_mstate);
  10272. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  10273. /*--- Global init code ---*/
  10274. __Pyx_RefNannyFinishContext();
  10275. return 0;
  10276. }
  10277. static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  10278. __Pyx_RefNannyDeclarations
  10279. CYTHON_UNUSED_VAR(__pyx_mstate);
  10280. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  10281. /*--- Variable export code ---*/
  10282. __Pyx_RefNannyFinishContext();
  10283. return 0;
  10284. }
  10285. static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  10286. __Pyx_RefNannyDeclarations
  10287. CYTHON_UNUSED_VAR(__pyx_mstate);
  10288. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  10289. /*--- Function export code ---*/
  10290. __Pyx_RefNannyFinishContext();
  10291. return 0;
  10292. }
  10293. static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  10294. __Pyx_RefNannyDeclarations
  10295. CYTHON_UNUSED_VAR(__pyx_mstate);
  10296. int __pyx_lineno = 0;
  10297. const char *__pyx_filename = NULL;
  10298. int __pyx_clineno = 0;
  10299. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  10300. /*--- Type init code ---*/
  10301. #if CYTHON_USE_TYPE_SPECS
  10302. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_defaults_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults)) __PYX_ERR(0, 293, __pyx_L1_error)
  10303. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_defaults_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  10304. #else
  10305. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults = &__pyx_type_9fontTools_6varLib_3iup___pyx_defaults;
  10306. #endif
  10307. #if !CYTHON_COMPILING_IN_LIMITED_API
  10308. #endif
  10309. #if !CYTHON_USE_TYPE_SPECS
  10310. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  10311. #endif
  10312. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10313. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  10314. #endif
  10315. #if !CYTHON_COMPILING_IN_LIMITED_API
  10316. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults->tp_getattro == PyObject_GenericGetAttr)) {
  10317. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults->tp_getattro = PyObject_GenericGetAttr;
  10318. }
  10319. #endif
  10320. #if CYTHON_USE_TYPE_SPECS
  10321. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between)) __PYX_ERR(0, 169, __pyx_L1_error)
  10322. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between) < (0)) __PYX_ERR(0, 169, __pyx_L1_error)
  10323. #else
  10324. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  10325. #endif
  10326. #if !CYTHON_COMPILING_IN_LIMITED_API
  10327. #endif
  10328. #if !CYTHON_USE_TYPE_SPECS
  10329. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between) < (0)) __PYX_ERR(0, 169, __pyx_L1_error)
  10330. #endif
  10331. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10332. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  10333. #endif
  10334. #if !CYTHON_COMPILING_IN_LIMITED_API
  10335. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_getattro == PyObject_GenericGetAttr)) {
  10336. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_getattro = PyObject_GenericGetAttr;
  10337. }
  10338. #endif
  10339. #if CYTHON_USE_TYPE_SPECS
  10340. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 197, __pyx_L1_error)
  10341. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 197, __pyx_L1_error)
  10342. #else
  10343. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  10344. #endif
  10345. #if !CYTHON_COMPILING_IN_LIMITED_API
  10346. #endif
  10347. #if !CYTHON_USE_TYPE_SPECS
  10348. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 197, __pyx_L1_error)
  10349. #endif
  10350. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10351. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  10352. #endif
  10353. #if !CYTHON_COMPILING_IN_LIMITED_API
  10354. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  10355. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10356. }
  10357. #endif
  10358. #if CYTHON_USE_TYPE_SPECS
  10359. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize)) __PYX_ERR(0, 363, __pyx_L1_error)
  10360. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  10361. #else
  10362. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  10363. #endif
  10364. #if !CYTHON_COMPILING_IN_LIMITED_API
  10365. #endif
  10366. #if !CYTHON_USE_TYPE_SPECS
  10367. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  10368. #endif
  10369. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10370. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  10371. #endif
  10372. #if !CYTHON_COMPILING_IN_LIMITED_API
  10373. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_getattro == PyObject_GenericGetAttr)) {
  10374. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_getattro = PyObject_GenericGetAttr;
  10375. }
  10376. #endif
  10377. #if CYTHON_USE_TYPE_SPECS
  10378. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 378, __pyx_L1_error)
  10379. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 378, __pyx_L1_error)
  10380. #else
  10381. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  10382. #endif
  10383. #if !CYTHON_COMPILING_IN_LIMITED_API
  10384. #endif
  10385. #if !CYTHON_USE_TYPE_SPECS
  10386. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 378, __pyx_L1_error)
  10387. #endif
  10388. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10389. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  10390. #endif
  10391. #if !CYTHON_COMPILING_IN_LIMITED_API
  10392. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  10393. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10394. }
  10395. #endif
  10396. #if CYTHON_USE_TYPE_SPECS
  10397. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 387, __pyx_L1_error)
  10398. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 387, __pyx_L1_error)
  10399. #else
  10400. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  10401. #endif
  10402. #if !CYTHON_COMPILING_IN_LIMITED_API
  10403. #endif
  10404. #if !CYTHON_USE_TYPE_SPECS
  10405. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 387, __pyx_L1_error)
  10406. #endif
  10407. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10408. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  10409. #endif
  10410. #if !CYTHON_COMPILING_IN_LIMITED_API
  10411. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  10412. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10413. }
  10414. #endif
  10415. __Pyx_RefNannyFinishContext();
  10416. return 0;
  10417. __pyx_L1_error:;
  10418. __Pyx_RefNannyFinishContext();
  10419. return -1;
  10420. }
  10421. static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  10422. __Pyx_RefNannyDeclarations
  10423. CYTHON_UNUSED_VAR(__pyx_mstate);
  10424. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  10425. /*--- Type import code ---*/
  10426. __Pyx_RefNannyFinishContext();
  10427. return 0;
  10428. }
  10429. static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  10430. __Pyx_RefNannyDeclarations
  10431. CYTHON_UNUSED_VAR(__pyx_mstate);
  10432. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  10433. /*--- Variable import code ---*/
  10434. __Pyx_RefNannyFinishContext();
  10435. return 0;
  10436. }
  10437. static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  10438. __Pyx_RefNannyDeclarations
  10439. CYTHON_UNUSED_VAR(__pyx_mstate);
  10440. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  10441. /*--- Function import code ---*/
  10442. __Pyx_RefNannyFinishContext();
  10443. return 0;
  10444. }
  10445. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10446. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  10447. static int __pyx_pymod_exec_iup(PyObject* module); /*proto*/
  10448. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  10449. {Py_mod_create, (void*)__pyx_pymod_create},
  10450. {Py_mod_exec, (void*)__pyx_pymod_exec_iup},
  10451. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  10452. {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  10453. #endif
  10454. #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  10455. {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  10456. #endif
  10457. {0, NULL}
  10458. };
  10459. #endif
  10460. #ifdef __cplusplus
  10461. namespace {
  10462. struct PyModuleDef __pyx_moduledef =
  10463. #else
  10464. static struct PyModuleDef __pyx_moduledef =
  10465. #endif
  10466. {
  10467. PyModuleDef_HEAD_INIT,
  10468. "iup",
  10469. 0, /* m_doc */
  10470. #if CYTHON_USE_MODULE_STATE
  10471. sizeof(__pyx_mstatetype), /* m_size */
  10472. #else
  10473. (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
  10474. #endif
  10475. __pyx_methods /* m_methods */,
  10476. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10477. __pyx_moduledef_slots, /* m_slots */
  10478. #else
  10479. NULL, /* m_reload */
  10480. #endif
  10481. #if CYTHON_USE_MODULE_STATE
  10482. __pyx_m_traverse, /* m_traverse */
  10483. __pyx_m_clear, /* m_clear */
  10484. NULL /* m_free */
  10485. #else
  10486. NULL, /* m_traverse */
  10487. NULL, /* m_clear */
  10488. NULL /* m_free */
  10489. #endif
  10490. };
  10491. #ifdef __cplusplus
  10492. } /* anonymous namespace */
  10493. #endif
  10494. /* PyModInitFuncType */
  10495. #ifndef CYTHON_NO_PYINIT_EXPORT
  10496. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  10497. #else
  10498. #ifdef __cplusplus
  10499. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  10500. #else
  10501. #define __Pyx_PyMODINIT_FUNC PyObject *
  10502. #endif
  10503. #endif
  10504. __Pyx_PyMODINIT_FUNC PyInit_iup(void) CYTHON_SMALL_CODE; /*proto*/
  10505. __Pyx_PyMODINIT_FUNC PyInit_iup(void)
  10506. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10507. {
  10508. return PyModuleDef_Init(&__pyx_moduledef);
  10509. }
  10510. /* ModuleCreationPEP489 */
  10511. #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  10512. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  10513. static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
  10514. {
  10515. PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
  10516. if (!module) {
  10517. PyErr_Clear(); // just try the 3.8-3.12 version
  10518. module = PyImport_ImportModule("_xxsubinterpreters");
  10519. if (!module) goto bad;
  10520. }
  10521. PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
  10522. Py_DECREF(module);
  10523. if (!current) goto bad;
  10524. if (PyTuple_Check(current)) {
  10525. PyObject *new_current = PySequence_GetItem(current, 0);
  10526. Py_DECREF(current);
  10527. current = new_current;
  10528. if (!new_current) goto bad;
  10529. }
  10530. long long as_c_int = PyLong_AsLongLong(current);
  10531. Py_DECREF(current);
  10532. return as_c_int;
  10533. }
  10534. bad:
  10535. PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
  10536. return -1;
  10537. }
  10538. #endif
  10539. #if !CYTHON_USE_MODULE_STATE
  10540. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  10541. static PY_INT64_T main_interpreter_id = -1;
  10542. #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  10543. PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  10544. #elif CYTHON_COMPILING_IN_GRAAL
  10545. PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  10546. #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  10547. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  10548. PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
  10549. #elif CYTHON_COMPILING_IN_LIMITED_API
  10550. PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
  10551. #else
  10552. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  10553. #endif
  10554. if (unlikely(current_id == -1)) {
  10555. return -1;
  10556. }
  10557. if (main_interpreter_id == -1) {
  10558. main_interpreter_id = current_id;
  10559. return 0;
  10560. } else if (unlikely(main_interpreter_id != current_id)) {
  10561. PyErr_SetString(
  10562. PyExc_ImportError,
  10563. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  10564. return -1;
  10565. }
  10566. return 0;
  10567. }
  10568. #endif
  10569. 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)
  10570. {
  10571. PyObject *value = PyObject_GetAttrString(spec, from_name);
  10572. int result = 0;
  10573. if (likely(value)) {
  10574. if (allow_none || value != Py_None) {
  10575. result = PyDict_SetItemString(moddict, to_name, value);
  10576. }
  10577. Py_DECREF(value);
  10578. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  10579. PyErr_Clear();
  10580. } else {
  10581. result = -1;
  10582. }
  10583. return result;
  10584. }
  10585. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  10586. PyObject *module = NULL, *moddict, *modname;
  10587. CYTHON_UNUSED_VAR(def);
  10588. #if !CYTHON_USE_MODULE_STATE
  10589. if (__Pyx_check_single_interpreter())
  10590. return NULL;
  10591. #endif
  10592. if (__pyx_m)
  10593. return __Pyx_NewRef(__pyx_m);
  10594. modname = PyObject_GetAttrString(spec, "name");
  10595. if (unlikely(!modname)) goto bad;
  10596. module = PyModule_NewObject(modname);
  10597. Py_DECREF(modname);
  10598. if (unlikely(!module)) goto bad;
  10599. moddict = PyModule_GetDict(module);
  10600. if (unlikely(!moddict)) goto bad;
  10601. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  10602. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  10603. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  10604. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  10605. return module;
  10606. bad:
  10607. Py_XDECREF(module);
  10608. return NULL;
  10609. }
  10610. static CYTHON_SMALL_CODE int __pyx_pymod_exec_iup(PyObject *__pyx_pyinit_module)
  10611. #endif
  10612. {
  10613. int stringtab_initialized = 0;
  10614. #if CYTHON_USE_MODULE_STATE
  10615. int pystate_addmodule_run = 0;
  10616. #endif
  10617. __pyx_mstatetype *__pyx_mstate = NULL;
  10618. PyObject *__pyx_t_1 = NULL;
  10619. PyObject *__pyx_t_2 = NULL;
  10620. PyObject *__pyx_t_3 = NULL;
  10621. PyObject *__pyx_t_4 = NULL;
  10622. Py_ssize_t __pyx_t_5;
  10623. PyObject *__pyx_t_6 = NULL;
  10624. PyObject *__pyx_t_7 = NULL;
  10625. PyObject *__pyx_t_8 = NULL;
  10626. int __pyx_lineno = 0;
  10627. const char *__pyx_filename = NULL;
  10628. int __pyx_clineno = 0;
  10629. __Pyx_RefNannyDeclarations
  10630. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10631. if (__pyx_m) {
  10632. if (__pyx_m == __pyx_pyinit_module) return 0;
  10633. PyErr_SetString(PyExc_RuntimeError, "Module 'iup' has already been imported. Re-initialisation is not supported.");
  10634. return -1;
  10635. }
  10636. #else
  10637. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  10638. #endif
  10639. /*--- Module creation code ---*/
  10640. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10641. __pyx_t_1 = __pyx_pyinit_module;
  10642. Py_INCREF(__pyx_t_1);
  10643. #else
  10644. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  10645. #endif
  10646. #if CYTHON_USE_MODULE_STATE
  10647. {
  10648. int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
  10649. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "iup" pseudovariable */
  10650. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10651. pystate_addmodule_run = 1;
  10652. }
  10653. #else
  10654. __pyx_m = __pyx_t_1;
  10655. #endif
  10656. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  10657. PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  10658. #endif
  10659. __pyx_mstate = __pyx_mstate_global;
  10660. CYTHON_UNUSED_VAR(__pyx_t_1);
  10661. __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  10662. Py_INCREF(__pyx_mstate->__pyx_d);
  10663. __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  10664. __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  10665. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  10666. /* ImportRefnannyAPI */
  10667. #if CYTHON_REFNANNY
  10668. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  10669. if (!__Pyx_RefNanny) {
  10670. PyErr_Clear();
  10671. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  10672. if (!__Pyx_RefNanny)
  10673. Py_FatalError("failed to import 'refnanny' module");
  10674. }
  10675. #endif
  10676. __Pyx_RefNannySetupContext("PyInit_iup", 0);
  10677. __Pyx_init_runtime_version();
  10678. 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)
  10679. __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  10680. __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  10681. __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  10682. /*--- Library function declarations ---*/
  10683. /*--- Initialize various global constants etc. ---*/
  10684. if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10685. stringtab_initialized = 1;
  10686. if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10687. if (__pyx_module_is_main_fontTools__varLib__iup) {
  10688. if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10689. }
  10690. {
  10691. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  10692. if (!PyDict_GetItemString(modules, "fontTools.varLib.iup")) {
  10693. if (unlikely((PyDict_SetItemString(modules, "fontTools.varLib.iup", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10694. }
  10695. }
  10696. /*--- Builtin init code ---*/
  10697. if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10698. /*--- Constants init code ---*/
  10699. if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10700. if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10701. /*--- Global type/function init code ---*/
  10702. (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  10703. (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  10704. (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  10705. if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10706. (void)__Pyx_modinit_type_import_code(__pyx_mstate);
  10707. (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  10708. (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  10709. /*--- Execution code ---*/
  10710. /* "fontTools/varLib/iup.py":1
  10711. * try: # <<<<<<<<<<<<<<
  10712. * import cython
  10713. * except (AttributeError, ImportError):
  10714. */
  10715. {
  10716. (void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
  10717. /*try:*/ {
  10718. /* "fontTools/varLib/iup.py":2
  10719. * try:
  10720. * import cython # <<<<<<<<<<<<<<
  10721. * except (AttributeError, ImportError):
  10722. * # if cython not installed, use mock module with no-op decorators and types
  10723. */
  10724. }
  10725. }
  10726. /* "fontTools/varLib/iup.py":6
  10727. * # if cython not installed, use mock module with no-op decorators and types
  10728. * from fontTools.misc import cython
  10729. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  10730. *
  10731. * from typing import (
  10732. */
  10733. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_COMPILED, Py_True) < (0)) __PYX_ERR(0, 6, __pyx_L1_error)
  10734. /* "fontTools/varLib/iup.py":8
  10735. * COMPILED = cython.compiled
  10736. *
  10737. * from typing import ( # <<<<<<<<<<<<<<
  10738. * Sequence,
  10739. * Tuple,
  10740. */
  10741. {
  10742. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence,__pyx_mstate_global->__pyx_n_u_Tuple,__pyx_mstate_global->__pyx_n_u_Union};
  10743. __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 3, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error)
  10744. }
  10745. __pyx_t_4 = __pyx_t_3;
  10746. __Pyx_GOTREF(__pyx_t_4);
  10747. {
  10748. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Sequence,__pyx_mstate_global->__pyx_n_u_Tuple,__pyx_mstate_global->__pyx_n_u_Union};
  10749. for (__pyx_t_5=0; __pyx_t_5 < 3; __pyx_t_5++) {
  10750. __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_5]); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 8, __pyx_L1_error)
  10751. __Pyx_GOTREF(__pyx_t_6);
  10752. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_5], __pyx_t_6) < (0)) __PYX_ERR(0, 8, __pyx_L1_error)
  10753. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10754. }
  10755. }
  10756. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10757. /* "fontTools/varLib/iup.py":13
  10758. * Union,
  10759. * )
  10760. * from numbers import Integral, Real # <<<<<<<<<<<<<<
  10761. *
  10762. *
  10763. */
  10764. {
  10765. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Integral,__pyx_mstate_global->__pyx_n_u_Real};
  10766. __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numbers, __pyx_imported_names, 2, NULL, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
  10767. }
  10768. __pyx_t_4 = __pyx_t_3;
  10769. __Pyx_GOTREF(__pyx_t_4);
  10770. {
  10771. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Integral,__pyx_mstate_global->__pyx_n_u_Real};
  10772. for (__pyx_t_5=0; __pyx_t_5 < 2; __pyx_t_5++) {
  10773. __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_5]); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 13, __pyx_L1_error)
  10774. __Pyx_GOTREF(__pyx_t_6);
  10775. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_5], __pyx_t_6) < (0)) __PYX_ERR(0, 13, __pyx_L1_error)
  10776. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10777. }
  10778. }
  10779. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10780. /* "fontTools/varLib/iup.py":16
  10781. *
  10782. *
  10783. * _Point = Tuple[Real, Real] # <<<<<<<<<<<<<<
  10784. * _Delta = Tuple[Real, Real]
  10785. * _PointSegment = Sequence[_Point]
  10786. */
  10787. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error)
  10788. __Pyx_GOTREF(__pyx_t_4);
  10789. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error)
  10790. __Pyx_GOTREF(__pyx_t_6);
  10791. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error)
  10792. __Pyx_GOTREF(__pyx_t_7);
  10793. __pyx_t_8 = PyTuple_Pack(2, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 16, __pyx_L1_error)
  10794. __Pyx_GOTREF(__pyx_t_8);
  10795. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10796. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10797. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error)
  10798. __Pyx_GOTREF(__pyx_t_7);
  10799. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10800. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  10801. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Point, __pyx_t_7) < (0)) __PYX_ERR(0, 16, __pyx_L1_error)
  10802. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10803. /* "fontTools/varLib/iup.py":17
  10804. *
  10805. * _Point = Tuple[Real, Real]
  10806. * _Delta = Tuple[Real, Real] # <<<<<<<<<<<<<<
  10807. * _PointSegment = Sequence[_Point]
  10808. * _DeltaSegment = Sequence[_Delta]
  10809. */
  10810. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 17, __pyx_L1_error)
  10811. __Pyx_GOTREF(__pyx_t_7);
  10812. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 17, __pyx_L1_error)
  10813. __Pyx_GOTREF(__pyx_t_8);
  10814. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
  10815. __Pyx_GOTREF(__pyx_t_4);
  10816. __pyx_t_6 = PyTuple_Pack(2, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error)
  10817. __Pyx_GOTREF(__pyx_t_6);
  10818. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  10819. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10820. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
  10821. __Pyx_GOTREF(__pyx_t_4);
  10822. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10823. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10824. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Delta, __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error)
  10825. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10826. /* "fontTools/varLib/iup.py":18
  10827. * _Point = Tuple[Real, Real]
  10828. * _Delta = Tuple[Real, Real]
  10829. * _PointSegment = Sequence[_Point] # <<<<<<<<<<<<<<
  10830. * _DeltaSegment = Sequence[_Delta]
  10831. * _DeltaOrNone = Union[_Delta, None]
  10832. */
  10833. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
  10834. __Pyx_GOTREF(__pyx_t_4);
  10835. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Point); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 18, __pyx_L1_error)
  10836. __Pyx_GOTREF(__pyx_t_6);
  10837. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error)
  10838. __Pyx_GOTREF(__pyx_t_7);
  10839. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10840. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10841. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PointSegment, __pyx_t_7) < (0)) __PYX_ERR(0, 18, __pyx_L1_error)
  10842. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10843. /* "fontTools/varLib/iup.py":19
  10844. * _Delta = Tuple[Real, Real]
  10845. * _PointSegment = Sequence[_Point]
  10846. * _DeltaSegment = Sequence[_Delta] # <<<<<<<<<<<<<<
  10847. * _DeltaOrNone = Union[_Delta, None]
  10848. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10849. */
  10850. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L1_error)
  10851. __Pyx_GOTREF(__pyx_t_7);
  10852. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error)
  10853. __Pyx_GOTREF(__pyx_t_6);
  10854. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error)
  10855. __Pyx_GOTREF(__pyx_t_4);
  10856. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10857. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10858. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DeltaSegment, __pyx_t_4) < (0)) __PYX_ERR(0, 19, __pyx_L1_error)
  10859. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10860. /* "fontTools/varLib/iup.py":20
  10861. * _PointSegment = Sequence[_Point]
  10862. * _DeltaSegment = Sequence[_Delta]
  10863. * _DeltaOrNone = Union[_Delta, None] # <<<<<<<<<<<<<<
  10864. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10865. * _Endpoints = Sequence[Integral]
  10866. */
  10867. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error)
  10868. __Pyx_GOTREF(__pyx_t_4);
  10869. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
  10870. __Pyx_GOTREF(__pyx_t_6);
  10871. __pyx_t_7 = PyTuple_Pack(2, __pyx_t_6, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error)
  10872. __Pyx_GOTREF(__pyx_t_7);
  10873. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10874. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
  10875. __Pyx_GOTREF(__pyx_t_6);
  10876. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10877. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10878. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DeltaOrNone, __pyx_t_6) < (0)) __PYX_ERR(0, 20, __pyx_L1_error)
  10879. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10880. /* "fontTools/varLib/iup.py":21
  10881. * _DeltaSegment = Sequence[_Delta]
  10882. * _DeltaOrNone = Union[_Delta, None]
  10883. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone] # <<<<<<<<<<<<<<
  10884. * _Endpoints = Sequence[Integral]
  10885. *
  10886. */
  10887. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error)
  10888. __Pyx_GOTREF(__pyx_t_6);
  10889. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DeltaOrNone); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
  10890. __Pyx_GOTREF(__pyx_t_7);
  10891. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error)
  10892. __Pyx_GOTREF(__pyx_t_4);
  10893. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10894. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10895. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DeltaOrNoneSegment, __pyx_t_4) < (0)) __PYX_ERR(0, 21, __pyx_L1_error)
  10896. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10897. /* "fontTools/varLib/iup.py":22
  10898. * _DeltaOrNone = Union[_Delta, None]
  10899. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10900. * _Endpoints = Sequence[Integral] # <<<<<<<<<<<<<<
  10901. *
  10902. *
  10903. */
  10904. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error)
  10905. __Pyx_GOTREF(__pyx_t_4);
  10906. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Integral); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error)
  10907. __Pyx_GOTREF(__pyx_t_7);
  10908. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
  10909. __Pyx_GOTREF(__pyx_t_6);
  10910. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10911. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10912. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Endpoints, __pyx_t_6) < (0)) __PYX_ERR(0, 22, __pyx_L1_error)
  10913. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10914. /* "fontTools/varLib/iup.py":25
  10915. *
  10916. *
  10917. * MAX_LOOKBACK = 8 # <<<<<<<<<<<<<<
  10918. *
  10919. *
  10920. */
  10921. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MAX_LOOKBACK, __pyx_mstate_global->__pyx_int_8) < (0)) __PYX_ERR(0, 25, __pyx_L1_error)
  10922. /* "fontTools/varLib/iup.py":91
  10923. *
  10924. *
  10925. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  10926. * """For the contour given in `coords`, interpolate any missing
  10927. * delta values in delta vector `deltas`.
  10928. */
  10929. __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
  10930. __Pyx_GOTREF(__pyx_t_6);
  10931. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaOrNoneSegment) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
  10932. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
  10933. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
  10934. __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_1iup_contour, 0, __pyx_mstate_global->__pyx_n_u_iup_contour, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
  10935. __Pyx_GOTREF(__pyx_t_7);
  10936. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10937. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  10938. #endif
  10939. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  10940. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10941. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_contour, __pyx_t_7) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
  10942. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10943. /* "fontTools/varLib/iup.py":143
  10944. *
  10945. *
  10946. * def iup_delta( # <<<<<<<<<<<<<<
  10947. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  10948. * ) -> _DeltaSegment:
  10949. */
  10950. __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
  10951. __Pyx_GOTREF(__pyx_t_7);
  10952. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaOrNoneSegment) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  10953. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  10954. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ends, __pyx_mstate_global->__pyx_n_u_Endpoints) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  10955. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  10956. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_3iup_delta, 0, __pyx_mstate_global->__pyx_n_u_iup_delta, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error)
  10957. __Pyx_GOTREF(__pyx_t_6);
  10958. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10959. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  10960. #endif
  10961. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  10962. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10963. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_delta, __pyx_t_6) < (0)) __PYX_ERR(0, 143, __pyx_L1_error)
  10964. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10965. /* "fontTools/varLib/iup.py":202
  10966. *
  10967. *
  10968. * @cython.locals( # <<<<<<<<<<<<<<
  10969. * cj=cython.double,
  10970. * dj=cython.double,
  10971. */
  10972. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  10973. __Pyx_GOTREF(__pyx_t_6);
  10974. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
  10975. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
  10976. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_Real) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
  10977. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_set) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
  10978. __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set, 0, __pyx_mstate_global->__pyx_n_u_iup_contour_bound_forced_set, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
  10979. __Pyx_GOTREF(__pyx_t_7);
  10980. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10981. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  10982. #endif
  10983. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[2]);
  10984. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  10985. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10986. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_contour_bound_forced_set, __pyx_t_7) < (0)) __PYX_ERR(0, 202, __pyx_L1_error)
  10987. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10988. /* "fontTools/varLib/iup.py":293
  10989. *
  10990. *
  10991. * @cython.locals( # <<<<<<<<<<<<<<
  10992. * i=cython.int,
  10993. * j=cython.int,
  10994. */
  10995. __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 293, __pyx_L1_error)
  10996. __Pyx_GOTREF(__pyx_t_7);
  10997. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  10998. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  10999. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_Real) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  11000. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_lookback, __pyx_mstate_global->__pyx_n_u_Integral) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  11001. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp, 0, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_dp, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 293, __pyx_L1_error)
  11002. __Pyx_GOTREF(__pyx_t_6);
  11003. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11004. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  11005. #endif
  11006. if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults)) __PYX_ERR(0, 293, __pyx_L1_error)
  11007. __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  11008. __Pyx_GOTREF(__pyx_t_4);
  11009. __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_t_6)->arg0 = ((PyObject*)__pyx_t_4);
  11010. __Pyx_GIVEREF(__pyx_t_4);
  11011. __pyx_t_4 = 0;
  11012. __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_9fontTools_6varLib_3iup_16__defaults__);
  11013. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11014. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11015. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize_dp, __pyx_t_6) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  11016. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11017. /* "fontTools/varLib/iup.py":346
  11018. *
  11019. *
  11020. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  11021. * """Rotate list by k items forward. Ie. item at position 0 will be
  11022. * at position k in returned list. Negative k is allowed."""
  11023. */
  11024. __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error)
  11025. __Pyx_GOTREF(__pyx_t_6);
  11026. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_l, __pyx_mstate_global->__pyx_n_u_list) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
  11027. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_k, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
  11028. __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_9_rot_list, 0, __pyx_mstate_global->__pyx_n_u_rot_list, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L1_error)
  11029. __Pyx_GOTREF(__pyx_t_7);
  11030. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11031. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  11032. #endif
  11033. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  11034. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11035. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_rot_list, __pyx_t_7) < (0)) __PYX_ERR(0, 346, __pyx_L1_error)
  11036. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11037. /* "fontTools/varLib/iup.py":356
  11038. *
  11039. *
  11040. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  11041. * k %= n
  11042. * if not k:
  11043. */
  11044. __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
  11045. __Pyx_GOTREF(__pyx_t_7);
  11046. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_s, __pyx_mstate_global->__pyx_n_u_set) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  11047. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_k, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  11048. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_n, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  11049. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_11_rot_set, 0, __pyx_mstate_global->__pyx_n_u_rot_set, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error)
  11050. __Pyx_GOTREF(__pyx_t_6);
  11051. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11052. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  11053. #endif
  11054. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11055. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11056. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_rot_set, __pyx_t_6) < (0)) __PYX_ERR(0, 356, __pyx_L1_error)
  11057. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11058. /* "fontTools/varLib/iup.py":363
  11059. *
  11060. *
  11061. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  11062. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  11063. * ) -> _DeltaOrNoneSegment:
  11064. */
  11065. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error)
  11066. __Pyx_GOTREF(__pyx_t_6);
  11067. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  11068. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  11069. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_Real) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  11070. if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_DeltaOrNoneSegment) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  11071. __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_13iup_contour_optimize, 0, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 363, __pyx_L1_error)
  11072. __Pyx_GOTREF(__pyx_t_7);
  11073. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11074. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  11075. #endif
  11076. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[3]);
  11077. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  11078. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11079. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_contour_optimize, __pyx_t_7) < (0)) __PYX_ERR(0, 363, __pyx_L1_error)
  11080. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11081. /* "fontTools/varLib/iup.py":464
  11082. *
  11083. *
  11084. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  11085. * deltas: _DeltaSegment,
  11086. * coords: _PointSegment,
  11087. */
  11088. __pyx_t_7 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 464, __pyx_L1_error)
  11089. __Pyx_GOTREF(__pyx_t_7);
  11090. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_deltas, __pyx_mstate_global->__pyx_n_u_DeltaSegment) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11091. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_coords, __pyx_mstate_global->__pyx_n_u_PointSegment) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11092. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ends, __pyx_mstate_global->__pyx_n_u_Endpoints) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11093. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_tolerance, __pyx_mstate_global->__pyx_n_u_Real) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11094. if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_DeltaOrNoneSegment) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11095. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_15iup_delta_optimize, 0, __pyx_mstate_global->__pyx_n_u_iup_delta_optimize, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_varLib_iup, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 464, __pyx_L1_error)
  11096. __Pyx_GOTREF(__pyx_t_6);
  11097. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11098. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  11099. #endif
  11100. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[3]);
  11101. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11102. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11103. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iup_delta_optimize, __pyx_t_6) < (0)) __PYX_ERR(0, 464, __pyx_L1_error)
  11104. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11105. /* "fontTools/varLib/iup.py":1
  11106. * try: # <<<<<<<<<<<<<<
  11107. * import cython
  11108. * except (AttributeError, ImportError):
  11109. */
  11110. __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  11111. __Pyx_GOTREF(__pyx_t_6);
  11112. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_6) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  11113. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11114. /*--- Wrapped vars code ---*/
  11115. goto __pyx_L0;
  11116. __pyx_L1_error:;
  11117. __Pyx_XDECREF(__pyx_t_4);
  11118. __Pyx_XDECREF(__pyx_t_6);
  11119. __Pyx_XDECREF(__pyx_t_7);
  11120. __Pyx_XDECREF(__pyx_t_8);
  11121. if (__pyx_m) {
  11122. if (__pyx_mstate->__pyx_d && stringtab_initialized) {
  11123. __Pyx_AddTraceback("init fontTools.varLib.iup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11124. }
  11125. #if !CYTHON_USE_MODULE_STATE
  11126. Py_CLEAR(__pyx_m);
  11127. #else
  11128. Py_DECREF(__pyx_m);
  11129. if (pystate_addmodule_run) {
  11130. PyObject *tp, *value, *tb;
  11131. PyErr_Fetch(&tp, &value, &tb);
  11132. PyState_RemoveModule(&__pyx_moduledef);
  11133. PyErr_Restore(tp, value, tb);
  11134. }
  11135. #endif
  11136. } else if (!PyErr_Occurred()) {
  11137. PyErr_SetString(PyExc_ImportError, "init fontTools.varLib.iup");
  11138. }
  11139. __pyx_L0:;
  11140. __Pyx_RefNannyFinishContext();
  11141. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11142. return (__pyx_m != NULL) ? 0 : -1;
  11143. #else
  11144. return __pyx_m;
  11145. #endif
  11146. }
  11147. /* #### Code section: pystring_table ### */
  11148. /* #### Code section: cached_builtins ### */
  11149. static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  11150. CYTHON_UNUSED_VAR(__pyx_mstate);
  11151. __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 88, __pyx_L1_error)
  11152. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 103, __pyx_L1_error)
  11153. __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 404, __pyx_L1_error)
  11154. /* Cached unbound methods */
  11155. __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  11156. __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  11157. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  11158. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  11159. __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  11160. __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  11161. return 0;
  11162. __pyx_L1_error:;
  11163. return -1;
  11164. }
  11165. /* #### Code section: cached_constants ### */
  11166. static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  11167. __Pyx_RefNannyDeclarations
  11168. CYTHON_UNUSED_VAR(__pyx_mstate);
  11169. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  11170. /* "fontTools/varLib/iup.py":50
  11171. * # rd1 = reference delta 1
  11172. * out_arrays = [None, None]
  11173. * for j in 0, 1: # <<<<<<<<<<<<<<
  11174. * out_arrays[j] = out = []
  11175. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  11176. */
  11177. __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 50, __pyx_L1_error)
  11178. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  11179. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);
  11180. /* "fontTools/varLib/iup.py":106
  11181. * if not indices:
  11182. * # All deltas are None. Return 0,0 for all.
  11183. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  11184. *
  11185. * out = []
  11186. */
  11187. __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 106, __pyx_L1_error)
  11188. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  11189. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  11190. /* "fontTools/varLib/iup.py":202
  11191. *
  11192. *
  11193. * @cython.locals( # <<<<<<<<<<<<<<
  11194. * cj=cython.double,
  11195. * dj=cython.double,
  11196. */
  11197. __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_int_0)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 202, __pyx_L1_error)
  11198. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  11199. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
  11200. /* "fontTools/varLib/iup.py":363
  11201. *
  11202. *
  11203. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  11204. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  11205. * ) -> _DeltaOrNoneSegment:
  11206. */
  11207. __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_float_0_0)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 363, __pyx_L1_error)
  11208. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  11209. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  11210. #if CYTHON_IMMORTAL_CONSTANTS
  11211. {
  11212. PyObject **table = __pyx_mstate->__pyx_tuple;
  11213. for (Py_ssize_t i=0; i<4; ++i) {
  11214. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11215. #if PY_VERSION_HEX < 0x030E0000
  11216. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  11217. #else
  11218. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  11219. #endif
  11220. {
  11221. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11222. }
  11223. #else
  11224. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11225. #endif
  11226. }
  11227. }
  11228. #endif
  11229. __Pyx_RefNannyFinishContext();
  11230. return 0;
  11231. __pyx_L1_error:;
  11232. __Pyx_RefNannyFinishContext();
  11233. return -1;
  11234. }
  11235. /* #### Code section: init_constants ### */
  11236. static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  11237. CYTHON_UNUSED_VAR(__pyx_mstate);
  11238. {
  11239. const struct { const unsigned int length: 10; } index[] = {{1},{27},{179},{1},{8},{7},{6},{2},{9},{8},{6},{12},{19},{13},{10},{8},{12},{6},{13},{20},{4},{8},{5},{5},{18},{9},{6},{8},{1},{2},{2},{35},{5},{2},{17},{18},{5},{7},{6},{4},{5},{1},{2},{2},{2},{6},{2},{3},{4},{9},{20},{5},{6},{8},{7},{1},{2},{2},{7},{3},{13},{2},{5},{11},{29},{20},{24},{37},{9},{18},{1},{1},{1},{2},{3},{2},{3},{4},{8},{8},{3},{10},{1},{8},{2},{3},{2},{3},{4},{7},{3},{1},{3},{1},{12},{6},{3},{3},{9},{8},{1},{4},{3},{12},{10},{8},{5},{8},{5},{9},{6},{1},{5},{6},{1},{1},{3},{2},{60},{438},{2},{522},{504},{2},{162},{200},{242},{47}};
  11240. #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1925 bytes) */
  11241. const char* const cstring = "BZh91AY&SY\226\356C\005\000\001m\177\377\377\377\377\377\377\377\377\365\277\377\377\340\277\377\377\360@@@@@@@@@@@@@\000@\000`\006\375\360p<Z\316\300h\007:\273\300\020%M\tDi\210\323M\017S&z\243\311\246)\372L\023\311\223Q\032\036\322\236PmA\246\200\310\000d=CA\232\004\022\210\004h& \230\232\031\004L\230\215\032\032hh\000\000\000\000\000\321\223A\221\350L\203@\021\022\206M\000\000\321\352i\342@\000\000\000\006@\000\000\304\000\000h\006\232\232\232H\014\215\006\215\001\246\206\232h\000\032\000\000\000h\000\000\000\000\r\000\203\000\004\300\000L\000\000\000\000\000\000\000\000\000\000\000\000\022)\032d\247\242\207\251\352?R\017Ph\r\000\032\000h\000\000\000\320\320d\320\000\000\r\003\367\202|\277/\2310&\330\371\241\241\252\263\316\274\373iS\353\354\203\337\340\2512O\301 \243\237B\254\330\221T\022*$\037\264\243\025\0234\376 \376\246\223cM\260m6\004TH\212#\244-\022\221R\252\341\376JS\302\244\300\030\022\255VU5r\342L\030\306!\214\030\333m\265%$\025\026]'e\227R\232\232\261aQB\013[\030\306\313\361Q\013\243c\022m6T\264\362$\332SW\340h\202\2659IE\223\324\320\024\016Llm\253f\246+\032D\253\tJL\030,\314m\032#pD\301\0141\215H\265\303\027A\203-\225\367\225V\250VF\220\236A\326,+U,D\221\"\273\220\226\311\022\241B\211\0231m\274yPWYS\321\350\364~b\343\013\r2\257-\361t\362(C\210\225\020\254\240JG\231W\224u8\373\035>\307\243\326\343\362]\332lz\356\356\270\355\325SY\010SY\230\023\0013\033cu#\201\206\246\014\021@\201\254\212Dx\364\320\360tN\373s\212\221\322)\211H7c\250\376\274\207\316\272\253\2253\027\361\307~3\223\237\341?\236\324X/\216h\376\327\262iA.K\213\271\215\323\203\326\002\243\205L\311\025e\212Yb8\240\021%QW' \341\352;]H\017:U\024\014$`U\255\234\332\212\002}\214\241C\251\0360lA\321[\007\203.-\250\010\037\0240\026\203&7\026\250U`pJl\354\231N\240\224\211\310\274Z-{\273\201\345\372\001\217R\210+\227\000\314\273I\010\242Fl'BnA\224\374\357\033L\262\306G\353\367\307\364\263\237\235x\342\346\230X:\214;&LZ1,\006\257+Q\206\027\026\036\200\266\234B\330\311\024\340\203'\215\272\260\"\252""\"\246\025\223\353Vs\260\236z\212\246\222\036E\264\365\306\304\212=\037X\315\3476\023\243\250\275\2057\373\271\233\307\333\273\264\375\357)\234C\315:\231\205\273h\335\020\274\350\"\327\016\314\360\222\242\010\031\313\226\032\214\307@\350\020@B\007S\235\330\370af\313\334\343g\307\313\370-*4\336\344\300\260bb\225k@\361\036\324\004\246\t\010E\020\225\216C\n\302\025\245\215B\241\214\210\351Tv\361)\340@\013/\005\354-\275\324\\\363-+1b4ust\315z\033^t\301\254_9^\2571k\034\315\247\261\r\2513\240\271\263T@\310d\014\211\223\232U\016\016\256V\216s*\302\274\366\231d61\306\345X.\nf\270\336\236\316\3651\3236.\342=\253\306\370U\273m\017'Gy\324c|\035\316F\306\232\243\315\005G\246*\254]\373`\355\211r2\272,v\301\347#\025\321zU\000\245K\235\007\305;K\254\314k\327\243\245\221?\205\325z\312D\216I8\361EU\200\330\020\267\030\214\350r1\234=\024\321\267\272\363j\2248\261\013\305'\031\r\243mnv\013\262\316*\231\nH\031tBu1\366bn\323\267\202n\246\245k\025t\347m\353\261\274\272\307#\326\351F\334\272\3225J\270\362\247\376\027BC\222H\232\246\321\316\335Y\217zp\022H\014\357(\306lll\301\260\215a\243\2056KD>\036{\200\302\300\372s\nN\207r\215\311\351\242\nHb\257\013Df\016Q\227\032k\351\031\345\271&\014\345Pw\302\370&a*\356\014\246\340zR\342\n\227\027\322\271\367-\021\345\253\241\002\3701M\014[c_\212\212\033\370>\374\335\372p\033\307\001\313\341<\"\0006\017Q\274\307\014k\031\363:\215\207\226cC\016C\323\004\271\354\2776\032y\324\310\223\311\033)\256\334B\027\246T1\246;\245f\333\r\340k\234\256\322\352\241d#\0051\263\020Q\300\312w&1G\245\013\226cib\216}\305\310\027\\]\236\021\325R\032\324m\270\r[\034\306.1\025X\301\254$\365\304J\373\203u\231\302y\311,\350Z*\262g>\261%T\"\346N\204\224\031\2352\344\335\013\3724\213I\263o\013\016\tc\020\341`\232\224\241m\267V\371\177\207\303\315\253\206\202\202\214\251\226\312\341\004\327\273\216\3246\236\223\331;\334a\311\327-X\227\026:\253\327t!{;\257\307\277\003 \312\023y\004\001\2643\025\344\206Xe\244\314\372ga16\253 0\314d\000\331\276\347h\341\036+\330\247t\256\235\317""\325t(:\215@\312\345\t@\t)\220A\004Ad\205\337!\305b\205B2\014x\354L\251\000\303k\210\350u\224>\371\314fI\231\3065\300E\261\305\037q\236c\236Q<g\004\302\227\032X@\252\217'\274F!Hp\021\032\261B\241>\0000\022\275\001\201k\272\232\210\326\210\261KG\215\3623\300T\310\220\261\177\030\035\373\336sQ\216\320aTC\223\004\030$`U\274\314\023|H25\223\336\241\266Wxk\017s\224\260\036\334\242`Q\317qb\306\202\010\303R\225\353\312\317R\375LJu\034Z\226\2120X\367\342\2356\034\033-\027\240\3259\035J\277\255\003\354x\340\030\027\321\023\006\003u7\242\212\004\331\205\370H\026\213\021D,\336E\377\267\010l\021Yd[\243\220@\375\233\036\0021q\230\037\006W\206(\225\032\302\t+\337\2345\367\315U\217\252\322>\366\335T0\240\2507\204[Ph\226\007\312\247\035H\233\025\213\202h3{\213:\262\252%U\"\250\233V\326S\026\226\350 \3617\337\234\251\323\344\340\234P$\327\233jrZD\232p\230S\311\323\321\311s\tk\332\370\231A\245\243\005x\311\327zY\227\257KuY\232\227\217\331\033\276Dt\215\271N\345\304t\333\006c\374\272\332\327%\353Z\376[\230@;\232\t3\020\250\0312\272\341t\310.\351\337\347Y\3239\205\"\226\221p\3071\336\322\2077T\357\220\3141\214Y\\\234:u,\022\2448\212|\255=z\330g\236\255\374\235\034\213$\204\206%\025\342\343e\214k\024\334e\216\265\0260cZ\346\026\307\222\226Q\304\205U\024J\006U\205\020iP\201\21404\361\210\320\314\271\320V\214hSV8\n+\024\223:P\250\246L\241\235\250\217\304\020\034\031\326\rD\210vI\252\240\206\006pkV\022m\004\324}Q\2639\231)\323V\200\312\261S\377\213\271\"\234(HKw!\202\200";
  11242. PyObject *data = __Pyx_DecompressString(cstring, 1925, 2);
  11243. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  11244. const char* const bytes = __Pyx_PyBytes_AsString(data);
  11245. #if !CYTHON_ASSUME_SAFE_MACROS
  11246. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  11247. #endif
  11248. #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1891 bytes) */
  11249. const char* const cstring = "x\332\275VKs\333F\022&%R\242dJ&)\352\341\215v\027\224le\343\354\312K\352\021%\225J\212z9\216\035[\244d%{B\201\300P\002\005\001$f \221>\351\210\343\034\3478G\034q\344\221G\035y\304\221?A?a{\000\352a\307[\265\271\244\212\0346\006=3_\177\375u\017W\337\350\265\027u\313$G\226e\340\027\027\212-&t\247\271\332\354\274\265\010\222\310\251B\244\235\0169\265LI\307\222\206\014\275\206l\205 \243#ab\353*A\266p2\245\203\275\203\177\255o\255K\212\251I6j \225`\t;5\325P0FX\262\352R\315\321\r\242\233\022\3514\021^\225^\325\245\216\345H&B\232D,\251\t~\017\027\220SdJ\030\021aH_*\246i\021\205\350\226)\303r\335<\371R\322t\033\016\321/\220X\275\257\030\030\255\376\250h\232\014\216H\323\261R3\0202\305x\242\3528\262\264\235w\277\034\274z\263\267+\357\"\203(\321\370\316~k\231\350\241}\210N\316\221I\242\251\333\207=SkZ\272I\360+\223\240\023[1~)\377&\277y\367\356\365vy\347\265| ^E\343\355\002\371\240\323\206\357.p$\277EmRE\365*R\214C\324r\220\251\242#\247i\240\367&D\244\340\216\251\352\326\252j\331\226\003\004!\\C\230\310\252\205Ih4\302\021[\206\252\026\325\222\252\2302$H\326M\271\206\310%\304\270\372\275a\251\020\377\017\253'\310D\355\246\255\236*\272\2516d9\344R>AD'\350\\<\302\346b!\261\025\025\325\024\365L5,\214T\310\277\345\330\252e\331\032\026\247\212/\326\264\177kE\255\244\t\016\260\326@\246\006\037\340\3219\017\363\177'\232\325H4\253\200\251n\331*\n\007M\226\353\216\251\312\362\020\221\256\027\365\222nj\272\212\260 J\307\362]\264z\210\016\213\230\206H\344\207v\315rLM\036\356\nzx\370\316j\022\375\\\377\200\344\317Nj\315\317M\377\216-\341\024Fyg\334\3716\316\014C5\324\206\241\031Z\303\32011,\353L\360&\313\347@\261\030\3330X\232c Y\206gS9\027\206\n\354\233\232\2515\340\000\002\214A\311`\010\266\331\264\232-Yn9\212\0219\332\2108\266i\353E[/\311\266EdqFh@\240P\005\202p\020\222\030\242\005`i\250\2568\006\00198\242\0340Qlp!B\"29\265\255Kb\031\220!PXT(\027\027\212\341\240p\300\355\316\007\275\311\213\375X\226>a\205\233\261Xr\302\035u\213n9HL\270\331 1~E\334b\220z\354\266\202\304#1\357V]\233\316""\322\032\213\263\031\266\315j<\336\217-\364\0276\372\033/{\255\233t,\231v\327\\\305mS\314\226Y\205)b\013\307}I\243M\006\211T\264\375 1\r^6\315\323C\226d\377\341\no{\330_\362_v\213\303C\007\340o\323\031\272\317\n\203\304\244[\020\200\362n\305\205\035\323\356.\215\323\020\335\205{H\343\203\224\230I\322c\266\306N\370\257\336K\277\344W\202\324#\367\033Z\010\322\363\264\025d\346\250\002\210\236\261\013^\341uo\337/\370\233\335\271n\2537\326\253_\227\257+\"\360\324\325%@\272\240\025\nG\244\334q\010\031\266X\007\020s\324f\331 \235\241\t\272\307\346`\217*\307\3363\357\322W\202\364c\367\022\3743_\260b\220\377\013+\000\002\3047\275\254\267\342\217\371\212\177\321=\356\025{\373\327+\375\203J\277R\205c&\322\002\025\335dYV\010R\031\032\277\215b\204.\321\362}$\233<\307\327\270\352\315\373\343~\253\033\377c\321\244>M\303\t?\364\342\336\023\177\331\257\000h\221IV\276\212\007\351e\376\243\377u\267\022$\307n2w\251\277\231\214%\377\312\312a\302h\212\305#rlw\306\215\346\304\363\244;\007/\001<\2441rL\320m@\325\341#|\211\227\005\202\351\376\324s\257\340m\371[\335\342MNl!VNL\207\n\232\001o5\342 J3\204\036J\220mq\220\312G\346\002\370\375\203/s\021\327D\306m\367\347_x-?\325M\365R\327\002\334\304<d\000\210\333vk\200(5\r?\343\300R:OwA\245a\342\222aV\201\356q\221J\220)\354s\t\000\276\340?y\341\311Y\272\002\276s\314\3463\374\255\377\314'\335\215^\262W\351)\017`q\301\314\035\200 =CK\3647\366+\337\346\247\336\251\177\326\313\016R9\372OV\207\211\232\027\212\362\025}\017KK\254\312\260\300\317O\274\252\327\032\244A'\002\024\360\237\203\244o\323:\024\022hh\201%X\031|m\236\r2y\220\232\240'}[\005K\220\221\314<u\300E\034\211\274\"$~\311\207\311\031\272\301F\205\376\376\306\014\357\271_\376C\341\t-\\\305o\346bSO?\322\302'e|W\270A\002\200\213\247\244\373\036t\274\0069o\303\266y~\344eE\022\366\240ZZl\004\340\356\3621(k\333\313y\305\250\220Diil\205\307\371'\236\242\215$\370>\210\245\004\004\331~\316/\016B\207,]\246\225 -\360\027\240\203\334\033\202\267\262x\365?\215\001\020G\004\274\210\312Yvo\014~?\003Z)""\337L\307\2462.\016\217\004N\327\302\032\023a\214\360\347\336\256?\352\027\375\335\356H\267\020\344\027\231p\316\315\322\035z\301B\347o\301-\001Yi\200\333w\335\243^\276W\355\265\"\307\311X6\017\233\201\330\203\374|\270c9Xx\022,\376\235\265\302%J\260(\361QP\327\016p\225\027\002\t\026\227@-U\376\001\210X\207T\255uk\275\370`\361)/\017\376\277\205\330[\362^\177\2740-:8\364\r\r\364X\0142\3310\357\256\"z\300W\375\257~\350*\"\355\323\261d.\224\312(\333\200#vx\313K\371\2110\352\345n\265\353\364~\276V\373\225\303\376\341Qp/\207G\356\006\364\256\002\324B5\214n\233\251\320\272J\320pF\000\0068\204\275;-\\\207MU@\201J\371\032tU\347e~\354m\372s\320\343\306\000D\324\345\304e\021\252,\324f\220\236\022\237\311GAB\254\214\344\371g\340\314\365s+\3002(\252@\267\330z\250\362c(\273\237\302\223\236v\025qEax\371-\333a\004\266:\006\375V>\212!l\212\2675\226\217MM\213H\246\037G\221\210\336\t\205w\177\343\216_u\350\250X8\003CB\034\373\035\310\013\334Tq\331\r\177\036T^\220\212\272\304m0P5SpC\"\261Ed\210`[\003@T\032v\3352\000\210jk\026\364m\263\034\373\006\372\3656?\363g\305m&ZIt\261+B2\016\300o\360D\377\351&\334e\355n\273\207\257\227\257A\360\263P\311\210}\317[\267fq0\354S\345\241\266\200\201~,\003\267G\212\307?\373W\242tw\r\324\240\355\355\361\354\177\0010\004\330#";
  11250. PyObject *data = __Pyx_DecompressString(cstring, 1891, 1);
  11251. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  11252. const char* const bytes = __Pyx_PyBytes_AsString(data);
  11253. #if !CYTHON_ASSUME_SAFE_MACROS
  11254. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  11255. #endif
  11256. #else /* compression: none (3193 bytes) */
  11257. const char* const bytes = ".Lib/fontTools/varLib/iup.pyNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.?add_notedisableenablegcisenabledCOMPILED_Delta_DeltaOrNone_DeltaOrNoneSegment_DeltaSegment_EndpointsIntegralMAX_LOOKBACK_Point_PointSegment__Pyx_PyDict_NextRefRealSequenceTupleUnionasyncio.coroutinesbest_costbest_jbest_solcc1c2can_iup_in_between.<locals>.genexprchaincj__class_getitem__cline_in_tracebackclosecontourcoordscostcostsdd0d1d2deltasdjendendsenumeratefontTools.varLib.iupforceforced__func__genexprii1i2indicesint_is_coroutineititemsiup_contour_iup_contour_bound_forced_setiup_contour_optimize_iup_contour_optimize_dpiup_contour_optimize.<locals>.genexpriup_deltaiup_delta_optimizejkllclcjldldjlistlookback__main__max__module__n__name__ncncjndndjnextnumbersoutppopq__qualname__returnri1ri2_rot_list_rot_setssendset__set_name__setdefaultsolutionstart__test__throwtolerancetypingvvaluevaluesxyzip\2401\320\000\021\220\031\230!\360\006\000\005\t\210\003\2101\210A\330\004\t\210\021\330\004\007\200t\2101\330\010\017\210q\330\004\013\2101\210A\210R\210r\220\025\220b\230\001\230\023\230B\230b\240\001\320\000\030\320\0305\3205G\300q\360\014\000\005\014\2103\210a\210x\220s\230#\230Q\230a\330\004\007\200u\210G\2201\330\010\017\210q\340\004\010\210\003\2101\210A\340\004\016\210a\210r\220\024\220S\230\005\230Y\240a\240x\250s\260\"\260G\2701\330\004\007\200t\2101\340\010\017\210r\220\023\220F\230!\340\004\n\210!\330\004\t\210\024\210Q\210a\330\004\014\210D\220\001\220\021\330\004\007\200v\210S\220\001\340\010\014\210D\220\005\220V\2303\230g\240W\250G\2602\260Q\330\010\013\2107\220!\330\014\027\220q\330\020\026\220a\220s\230%\230v\240Q\240f\250F\260!\2606\270\026\270q\300\006\300f\310A\310Q\360\006\000\005\010\200w\210a\210v\220Q\220a\330\004\010\210\007\210q\330\010\013\2104\210r\220\026\220r\230\021\330\014\020\220\004\220E\230\026\230v\240R\240s\250%\250w\260a\330\014\017""\210w\220a\330\020\033\2301\330\024\032\230!\2303\230e\2406\250\021\250&\260\006\260a\260v\270V\3001\300F\310&\320PQ\320QR\360\006\000\t\014\2107\220!\2206\230\021\230!\330\010\020\220\001\330\004\007\200v\210S\220\002\220\"\220A\340\010\014\210D\220\005\220V\2306\240\022\2403\240c\250\027\260\007\260q\270\001\330\010\013\2107\220!\330\014\027\220q\330\020\026\220a\220s\230%\230v\240Q\240f\250F\260!\2606\270\026\270q\300\006\300f\310A\310Q\360\010\000\005\014\2103\210a\210x\220s\230#\230Q\230g\240S\250\001\250\031\260#\260Q\260a\330\004\013\2101\230A\200\001\330\014#\240?\260+\270Q\330\005\006\360\020\000\005\t\210\003\2101\210A\360\n\000\005\035\230A\330\010\017\210q\220\010\230\001\360\006\000\005\010\200r\210\023\210A\330\010\017\210q\360\006\000\005\n\210\026\210q\220\001\330\004\016\210a\330\010\017\210q\220\004\220B\220a\220y\240\002\240\"\240A\360\010\000\005\016\320\r*\250!\2508\2608\2701\360\022\000\005\010\200q\360\006\000\t\016\210R\210r\220\023\220B\220c\230\021\230!\330\010\017\210r\220\023\220A\340\010\021\220\031\230!\2308\2401\330\010\021\220\031\230!\2308\2401\330\010\021\220\030\230\021\230(\240#\240Q\360\010\000\t\020\210x\320\027/\250q\260\010\270\010\300\010\310\001\360\006\000\t\027\220a\330\010\014\210B\210b\220\001\330\010\016\210b\220\007\220q\330\014\024\220D\230\001\230\021\330\014\020\220\005\220Q\220a\330\010\020\220\007\220r\230\021\360\014\000\t\020\210w\220c\230\033\240H\250A\340\010\021\220\021\220&\230\001\230\026\230r\240\023\240N\260%\260t\2705\300\005\300Q\300a\340\010\021\220\031\230!\2308\2401\240A\360\n\000\t\020\210x\320\027/\250q\330\014\023\2202\220X\230W\240B\240h\250h\260k\300\021\340\010\022\220,\230f\240B\240b\250\001\340\010\014\210I\220U\230!\2302\230R\230s\240#\240Q\240g\250R\250q\340\014\032\230!\330\014\020\220\001\330\014\022\220\"\220B\220f\230B\230a\330\020\030\230\004\230A\230R\230r\240\021\330\020\024\220E\230\021\230!\330\014\017\210r\220\023\220F\230\"\230A\330\020\027\220u\230A\230W\240B\240e\2501\250F\260""\"\260A\330\020\023\2205\230\003\2301\330\024\036\230l\250*\260A\360\014\000\t\020\210w\220c\230\033\240H\250A\340\010\021\220\021\220&\230\001\230\026\230r\240\023\240N\260%\260t\2705\300\005\300Q\300a\340\004\013\2101\200\001\360\026\000\r$\240?\260+\270Q\330\005\006\360\020\000\005\014\2103\210a\210x\220s\230#\230Q\230a\340\004\010\210\003\2101\210A\330\004\020\220\001\340\004\010\210\005\210U\220!\2203\220a\220x\230r\240\024\240T\250\021\330\010\014\210E\220\026\220q\230\002\230\"\230D\240\006\240a\240r\250\022\2501\330\010\013\2104\210v\220Q\220d\230&\240\001\240\021\330\010\014\210E\220\026\220q\230\002\230\"\230B\230b\240\004\240F\250!\2502\250R\250r\260\022\2601\340\010\014\210E\220\021\220#\220Q\330\014\021\220\021\220!\2201\330\014\021\220\021\220!\2201\330\014\022\220\"\220A\220Q\330\014\022\220\"\220A\220Q\330\014\022\220\"\220A\220Q\330\014\022\220\"\220A\220Q\340\014\017\210t\2203\220a\330\020\024\220E\230\025\230a\330\020\024\220E\230\025\230a\340\020\024\220E\230\025\230a\330\020\024\220E\230\025\230a\340\014\024\220A\360\016\000\r\020\210s\220#\220Q\330\020\023\2203\220a\220s\230\"\230D\240\002\240*\250D\260\003\2601\260D\270\002\270!\330\024\034\230A\360\016\000\022\025\220C\220v\230Q\330\020\023\2209\230D\240\004\240B\240j\260\003\260:\270T\300\024\300R\300q\330\024\034\230A\360\n\000\021\024\2203\220c\230\021\330\024\027\220s\230\"\230A\330\030\031\330\034\037\230q\240\004\240B\240a\330\034 \240\003\2401\240C\240r\250\024\250R\250q\330\034\"\240#\240R\240z\260\022\2604\260t\2703\270b\300\001\340\034$\240A\340\030\031\330\034\037\230q\240\004\240B\240a\330\034 \240\003\2401\240C\240r\250\024\250R\250q\330\034\"\240#\240R\240s\250\"\250K\260t\2703\270b\300\001\340\034$\240A\340\014\017\210q\330\020\026\220d\230!\2301\330\020\021\340\004\013\2101\210a\200\001\330\014)\320)>\270a\330\005\006\360\016\000\005\022\220\021\220&\230\003\2305\240\004\240C\240q\250\010\260\004\260D\270\002\270#\270R\270u\300J\310c\320QS\320ST\330\004\010\210\003\2101\210A""\330\004\013\2105\220\002\220!\2202\220R\220s\230\"\230B\230c\240\022\2402\240S\250\002\250\"\250A\330\004\n\210!\330\004\014\210A\330\004\010\210\007\210q\330\010\017\210q\330\010\022\220+\230Q\230f\240A\240V\2506\260\026\260q\270\006\270a\330\010\013\2107\220!\2201\330\010\020\220\001\340\004\013\2101\200\001\330\014\r\330\014\r\330\n\013\330\004\017\210q\330\005\006\360\020\000\005\022\220\021\220&\230\003\2305\240\004\240C\240q\250\010\260\004\260D\270\002\270#\270R\270u\300J\310c\320QS\320ST\330\004\010\210\003\2101\210A\330\004\013\2105\220\002\220!\2202\220R\220s\230\"\230B\230c\240\022\2402\240S\250\002\250\"\250A\330\004\n\210!\330\004\014\210A\330\004\010\210\007\210q\330\010\022\320\022&\240a\330\014\022\220!\2208\2304\230r\240\024\240V\2501\250H\260D\270\002\270$\270a\340\010\017\210s\220!\2209\230C\230t\2402\240V\2502\250Q\330\010\013\2107\220!\2201\330\010\020\220\004\220B\220a\340\004\013\2101\200\001\360\024\000\r\016\330\014\r\330\016\017\330\004\017\210q\330\004\016\210a\360\026\000\005\t\210\003\2101\210A\330\004\007\200y\220\003\2201\330\010\023\2201\330\004\022\220!\220:\230Q\330\004\016\210c\220\021\330\004\016\210c\220\021\330\004\010\210\005\210U\220!\2203\220a\330\010\024\220E\230\021\230\"\230B\230c\240\022\2401\340\010\r\210Q\210e\2201\330\010\r\210Q\210e\2202\220R\220q\340\010\013\2102\210R\210r\220\023\220A\330\014\r\340\010\014\210E\220\025\220a\220r\230\022\2307\240\"\240B\240k\260\025\260a\330\014\023\2205\230\001\230\023\230B\230a\340\014\017\210u\220B\220j\240\004\320$6\260a\260x\270x\300s\310#\310Q\330\020\025\220Q\220e\230<\240q\330\020\025\220Q\220e\2301\340\014\017\210r\220\023\220A\330\020\021\340\004\013\2107\220!\320\000\020\220\010\230\010\240\001\330\004\t\210\021\330\004\007\200t\2101\330\010\017\210q\330\004\013\2102\210R\210r\220\023\220B\220b\230\004\230E\240\021";
  11258. PyObject *data = NULL;
  11259. CYTHON_UNUSED_VAR(__Pyx_DecompressString);
  11260. #endif
  11261. PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
  11262. Py_ssize_t pos = 0;
  11263. for (int i = 0; i < 117; i++) {
  11264. Py_ssize_t bytes_length = index[i].length;
  11265. PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
  11266. if (likely(string) && i >= 9) PyUnicode_InternInPlace(&string);
  11267. if (unlikely(!string)) {
  11268. Py_XDECREF(data);
  11269. __PYX_ERR(0, 1, __pyx_L1_error)
  11270. }
  11271. stringtab[i] = string;
  11272. pos += bytes_length;
  11273. }
  11274. for (int i = 117; i < 128; i++) {
  11275. Py_ssize_t bytes_length = index[i].length;
  11276. PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
  11277. stringtab[i] = string;
  11278. pos += bytes_length;
  11279. if (unlikely(!string)) {
  11280. Py_XDECREF(data);
  11281. __PYX_ERR(0, 1, __pyx_L1_error)
  11282. }
  11283. }
  11284. Py_XDECREF(data);
  11285. for (Py_ssize_t i = 0; i < 128; i++) {
  11286. if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
  11287. __PYX_ERR(0, 1, __pyx_L1_error)
  11288. }
  11289. }
  11290. #if CYTHON_IMMORTAL_CONSTANTS
  11291. {
  11292. PyObject **table = stringtab + 117;
  11293. for (Py_ssize_t i=0; i<11; ++i) {
  11294. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11295. #if PY_VERSION_HEX < 0x030E0000
  11296. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  11297. #else
  11298. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  11299. #endif
  11300. {
  11301. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11302. }
  11303. #else
  11304. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11305. #endif
  11306. }
  11307. }
  11308. #endif
  11309. }
  11310. {
  11311. PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
  11312. double const c_constants[] = {0.0};
  11313. for (int i = 0; i < 1; i++) {
  11314. numbertab[i] = PyFloat_FromDouble(c_constants[i]);
  11315. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  11316. }
  11317. }
  11318. {
  11319. PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 1;
  11320. int8_t const cint_constants_1[] = {0,-1,1,2,3,4,8};
  11321. for (int i = 0; i < 7; i++) {
  11322. numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]);
  11323. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  11324. }
  11325. }
  11326. #if CYTHON_IMMORTAL_CONSTANTS
  11327. {
  11328. PyObject **table = __pyx_mstate->__pyx_number_tab;
  11329. for (Py_ssize_t i=0; i<8; ++i) {
  11330. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11331. #if PY_VERSION_HEX < 0x030E0000
  11332. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  11333. #else
  11334. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  11335. #endif
  11336. {
  11337. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11338. }
  11339. #else
  11340. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11341. #endif
  11342. }
  11343. }
  11344. #endif
  11345. return 0;
  11346. __pyx_L1_error:;
  11347. return -1;
  11348. }
  11349. /* #### Code section: init_codeobjects ### */
  11350. typedef struct {
  11351. unsigned int argcount : 3;
  11352. unsigned int num_posonly_args : 1;
  11353. unsigned int num_kwonly_args : 1;
  11354. unsigned int nlocals : 5;
  11355. unsigned int flags : 10;
  11356. unsigned int first_line : 9;
  11357. } __Pyx_PyCode_New_function_description;
  11358. /* NewCodeObj.proto */
  11359. static PyObject* __Pyx_PyCode_New(
  11360. const __Pyx_PyCode_New_function_description descr,
  11361. PyObject * const *varnames,
  11362. PyObject *filename,
  11363. PyObject *funcname,
  11364. PyObject *line_table,
  11365. PyObject *tuple_dedup_map
  11366. );
  11367. static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  11368. PyObject* tuple_dedup_map = PyDict_New();
  11369. if (unlikely(!tuple_dedup_map)) return -1;
  11370. {
  11371. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 197};
  11372. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_q};
  11373. __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  11374. }
  11375. {
  11376. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 378};
  11377. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p};
  11378. __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  11379. }
  11380. {
  11381. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 387};
  11382. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_d};
  11383. __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  11384. }
  11385. {
  11386. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 91};
  11387. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_indices, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_it, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_i1, __pyx_mstate->__pyx_n_u_i2, __pyx_mstate->__pyx_n_u_ri1, __pyx_mstate->__pyx_n_u_ri2, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_v};
  11388. __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_contour, __pyx_mstate->__pyx_kp_b_iso88591_55Gq_3axs_Qa_uG1_q_1A_ar_S_Yaxs, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  11389. }
  11390. {
  11391. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143};
  11392. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_ends, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_contour};
  11393. __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_delta, __pyx_mstate->__pyx_kp_b_iso88591_a_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  11394. }
  11395. {
  11396. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 24, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 202};
  11397. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_cj, __pyx_mstate->__pyx_n_u_dj, __pyx_mstate->__pyx_n_u_lcj, __pyx_mstate->__pyx_n_u_ldj, __pyx_mstate->__pyx_n_u_ncj, __pyx_mstate->__pyx_n_u_ndj, __pyx_mstate->__pyx_n_u_force, __pyx_mstate->__pyx_n_u_forced, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_ld, __pyx_mstate->__pyx_n_u_lc, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_nd, __pyx_mstate->__pyx_n_u_nc, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_c1, __pyx_mstate->__pyx_n_u_c2, __pyx_mstate->__pyx_n_u_d1, __pyx_mstate->__pyx_n_u_d2};
  11398. __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_contour_bound_forced_set, __pyx_mstate->__pyx_kp_b_iso88591_Q_3axs_Qa_1A_U_3axr_T_E_q_D_ar, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  11399. }
  11400. {
  11401. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 293};
  11402. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_forced, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_lookback, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_best_cost, __pyx_mstate->__pyx_n_u_best_j, __pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_chain};
  11403. __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_contour_optimize_dp, __pyx_mstate->__pyx_kp_b_iso88591_q_a_1A_y_1_1_Q_c_c_U_3a_E_Bc_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  11404. }
  11405. {
  11406. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 346};
  11407. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_l, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_n};
  11408. __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_rot_list, __pyx_mstate->__pyx_kp_b_iso88591_1A_t1_q_1ARr_b_Bb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  11409. }
  11410. {
  11411. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 356};
  11412. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_v};
  11413. __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_rot_set, __pyx_mstate->__pyx_kp_b_iso88591_t1_q_2Rr_Bb_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  11414. }
  11415. {
  11416. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 363};
  11417. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_d0, __pyx_mstate->__pyx_n_u_forced, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_chain, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_solution, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_best_sol, __pyx_mstate->__pyx_n_u_best_cost, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_i};
  11418. __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_contour_optimize, __pyx_mstate->__pyx_kp_b_iso88591_Q_1A_A_q_r_A_q_q_a_q_Bay_A_881, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  11419. }
  11420. {
  11421. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 464};
  11422. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_deltas, __pyx_mstate->__pyx_n_u_coords, __pyx_mstate->__pyx_n_u_ends, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_contour};
  11423. __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_varLib_iup_py, __pyx_mstate->__pyx_n_u_iup_delta_optimize, __pyx_mstate->__pyx_kp_b_iso88591_q_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  11424. }
  11425. Py_DECREF(tuple_dedup_map);
  11426. return 0;
  11427. bad:
  11428. Py_DECREF(tuple_dedup_map);
  11429. return -1;
  11430. }
  11431. /* #### Code section: init_globals ### */
  11432. static int __Pyx_InitGlobals(void) {
  11433. /* PythonCompatibility.init */
  11434. if (likely(__Pyx_init_co_variables() == 0)); else
  11435. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11436. /* AssertionsEnabled.init */
  11437. if (likely(__Pyx_init_assertions_enabled() == 0)); else
  11438. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11439. /* CommonTypesMetaclass.init */
  11440. if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  11441. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11442. /* CachedMethodType.init */
  11443. #if CYTHON_COMPILING_IN_LIMITED_API
  11444. {
  11445. PyObject *typesModule=NULL;
  11446. typesModule = PyImport_ImportModule("types");
  11447. if (typesModule) {
  11448. __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
  11449. Py_DECREF(typesModule);
  11450. }
  11451. } // error handling follows
  11452. #endif
  11453. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11454. /* CythonFunctionShared.init */
  11455. if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  11456. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11457. /* Generator.init */
  11458. if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  11459. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11460. return 0;
  11461. __pyx_L1_error:;
  11462. return -1;
  11463. }
  11464. /* #### Code section: cleanup_globals ### */
  11465. /* #### Code section: cleanup_module ### */
  11466. /* #### Code section: main_method ### */
  11467. /* #### Code section: utility_code_pragmas ### */
  11468. #ifdef _MSC_VER
  11469. #pragma warning( push )
  11470. /* Warning 4127: conditional expression is constant
  11471. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  11472. * compile-time, so this warning is not useful
  11473. */
  11474. #pragma warning( disable : 4127 )
  11475. #endif
  11476. /* #### Code section: utility_code_def ### */
  11477. /* --- Runtime support code --- */
  11478. /* Refnanny */
  11479. #if CYTHON_REFNANNY
  11480. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  11481. PyObject *m = NULL, *p = NULL;
  11482. void *r = NULL;
  11483. m = PyImport_ImportModule(modname);
  11484. if (!m) goto end;
  11485. p = PyObject_GetAttrString(m, "RefNannyAPI");
  11486. if (!p) goto end;
  11487. r = PyLong_AsVoidPtr(p);
  11488. end:
  11489. Py_XDECREF(p);
  11490. Py_XDECREF(m);
  11491. return (__Pyx_RefNannyAPIStruct *)r;
  11492. }
  11493. #endif
  11494. /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
  11495. #if CYTHON_FAST_THREAD_STATE
  11496. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  11497. Py_ssize_t i, n;
  11498. n = PyTuple_GET_SIZE(tuple);
  11499. for (i=0; i<n; i++) {
  11500. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  11501. }
  11502. for (i=0; i<n; i++) {
  11503. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  11504. }
  11505. return 0;
  11506. }
  11507. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  11508. int result;
  11509. PyObject *exc_type;
  11510. #if PY_VERSION_HEX >= 0x030C00A6
  11511. PyObject *current_exception = tstate->current_exception;
  11512. if (unlikely(!current_exception)) return 0;
  11513. exc_type = (PyObject*) Py_TYPE(current_exception);
  11514. if (exc_type == err) return 1;
  11515. #else
  11516. exc_type = tstate->curexc_type;
  11517. if (exc_type == err) return 1;
  11518. if (unlikely(!exc_type)) return 0;
  11519. #endif
  11520. #if CYTHON_AVOID_BORROWED_REFS
  11521. Py_INCREF(exc_type);
  11522. #endif
  11523. if (unlikely(PyTuple_Check(err))) {
  11524. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  11525. } else {
  11526. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  11527. }
  11528. #if CYTHON_AVOID_BORROWED_REFS
  11529. Py_DECREF(exc_type);
  11530. #endif
  11531. return result;
  11532. }
  11533. #endif
  11534. /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
  11535. #if CYTHON_FAST_THREAD_STATE
  11536. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  11537. #if PY_VERSION_HEX >= 0x030C00A6
  11538. PyObject *tmp_value;
  11539. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  11540. if (value) {
  11541. #if CYTHON_COMPILING_IN_CPYTHON
  11542. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  11543. #endif
  11544. PyException_SetTraceback(value, tb);
  11545. }
  11546. tmp_value = tstate->current_exception;
  11547. tstate->current_exception = value;
  11548. Py_XDECREF(tmp_value);
  11549. Py_XDECREF(type);
  11550. Py_XDECREF(tb);
  11551. #else
  11552. PyObject *tmp_type, *tmp_value, *tmp_tb;
  11553. tmp_type = tstate->curexc_type;
  11554. tmp_value = tstate->curexc_value;
  11555. tmp_tb = tstate->curexc_traceback;
  11556. tstate->curexc_type = type;
  11557. tstate->curexc_value = value;
  11558. tstate->curexc_traceback = tb;
  11559. Py_XDECREF(tmp_type);
  11560. Py_XDECREF(tmp_value);
  11561. Py_XDECREF(tmp_tb);
  11562. #endif
  11563. }
  11564. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  11565. #if PY_VERSION_HEX >= 0x030C00A6
  11566. PyObject* exc_value;
  11567. exc_value = tstate->current_exception;
  11568. tstate->current_exception = 0;
  11569. *value = exc_value;
  11570. *type = NULL;
  11571. *tb = NULL;
  11572. if (exc_value) {
  11573. *type = (PyObject*) Py_TYPE(exc_value);
  11574. Py_INCREF(*type);
  11575. #if CYTHON_COMPILING_IN_CPYTHON
  11576. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  11577. Py_XINCREF(*tb);
  11578. #else
  11579. *tb = PyException_GetTraceback(exc_value);
  11580. #endif
  11581. }
  11582. #else
  11583. *type = tstate->curexc_type;
  11584. *value = tstate->curexc_value;
  11585. *tb = tstate->curexc_traceback;
  11586. tstate->curexc_type = 0;
  11587. tstate->curexc_value = 0;
  11588. tstate->curexc_traceback = 0;
  11589. #endif
  11590. }
  11591. #endif
  11592. /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
  11593. #if CYTHON_USE_TYPE_SLOTS
  11594. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  11595. PyTypeObject* tp = Py_TYPE(obj);
  11596. if (likely(tp->tp_getattro))
  11597. return tp->tp_getattro(obj, attr_name);
  11598. return PyObject_GetAttr(obj, attr_name);
  11599. }
  11600. #endif
  11601. /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
  11602. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  11603. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  11604. __Pyx_PyThreadState_declare
  11605. __Pyx_PyThreadState_assign
  11606. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  11607. __Pyx_PyErr_Clear();
  11608. }
  11609. #endif
  11610. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  11611. PyObject *result;
  11612. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  11613. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  11614. return result;
  11615. #else
  11616. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
  11617. PyTypeObject* tp = Py_TYPE(obj);
  11618. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  11619. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  11620. }
  11621. #endif
  11622. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  11623. if (unlikely(!result)) {
  11624. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  11625. }
  11626. return result;
  11627. #endif
  11628. }
  11629. /* GetBuiltinName */
  11630. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  11631. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
  11632. if (unlikely(!result) && !PyErr_Occurred()) {
  11633. PyErr_Format(PyExc_NameError,
  11634. "name '%U' is not defined", name);
  11635. }
  11636. return result;
  11637. }
  11638. /* SetItemInt */
  11639. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  11640. int r;
  11641. if (unlikely(!j)) return -1;
  11642. r = PyObject_SetItem(o, j, v);
  11643. Py_DECREF(j);
  11644. return r;
  11645. }
  11646. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  11647. int wraparound, int boundscheck, int unsafe_shared) {
  11648. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11649. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
  11650. if (is_list || PyList_CheckExact(o)) {
  11651. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  11652. if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
  11653. Py_INCREF(v);
  11654. return PyList_SetItem(o, n, v);
  11655. } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  11656. PyObject* old;
  11657. Py_INCREF(v);
  11658. old = PyList_GET_ITEM(o, n);
  11659. PyList_SET_ITEM(o, n, v);
  11660. Py_DECREF(old);
  11661. return 0;
  11662. }
  11663. } else
  11664. #endif
  11665. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  11666. {
  11667. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  11668. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  11669. if (!is_list && mm && mm->mp_ass_subscript) {
  11670. int r;
  11671. PyObject *key = PyLong_FromSsize_t(i);
  11672. if (unlikely(!key)) return -1;
  11673. r = mm->mp_ass_subscript(o, key, v);
  11674. Py_DECREF(key);
  11675. return r;
  11676. }
  11677. if (is_list || likely(sm && sm->sq_ass_item)) {
  11678. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  11679. Py_ssize_t l = sm->sq_length(o);
  11680. if (likely(l >= 0)) {
  11681. i += l;
  11682. } else {
  11683. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  11684. return -1;
  11685. PyErr_Clear();
  11686. }
  11687. }
  11688. return sm->sq_ass_item(o, i, v);
  11689. }
  11690. }
  11691. #else
  11692. if (is_list || !PyMapping_Check(o)) {
  11693. return PySequence_SetItem(o, i, v);
  11694. }
  11695. #endif
  11696. (void)wraparound;
  11697. (void)boundscheck;
  11698. return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
  11699. }
  11700. /* GetItemInt */
  11701. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  11702. PyObject *r;
  11703. if (unlikely(!j)) return NULL;
  11704. r = PyObject_GetItem(o, j);
  11705. Py_DECREF(j);
  11706. return r;
  11707. }
  11708. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  11709. int wraparound, int boundscheck, int unsafe_shared) {
  11710. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11711. #if CYTHON_ASSUME_SAFE_SIZE
  11712. Py_ssize_t wrapped_i = i;
  11713. if (wraparound & unlikely(i < 0)) {
  11714. wrapped_i += PyList_GET_SIZE(o);
  11715. }
  11716. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
  11717. return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
  11718. } else
  11719. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  11720. return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
  11721. }
  11722. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11723. #else
  11724. (void)wraparound;
  11725. (void)boundscheck;
  11726. return PySequence_GetItem(o, i);
  11727. #endif
  11728. }
  11729. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  11730. int wraparound, int boundscheck, int unsafe_shared) {
  11731. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11732. #if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11733. Py_ssize_t wrapped_i = i;
  11734. if (wraparound & unlikely(i < 0)) {
  11735. wrapped_i += PyTuple_GET_SIZE(o);
  11736. }
  11737. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  11738. return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
  11739. }
  11740. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11741. #else
  11742. (void)wraparound;
  11743. (void)boundscheck;
  11744. return PySequence_GetItem(o, i);
  11745. #endif
  11746. }
  11747. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  11748. int wraparound, int boundscheck, int unsafe_shared) {
  11749. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11750. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  11751. if (is_list || PyList_CheckExact(o)) {
  11752. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  11753. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
  11754. return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
  11755. } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  11756. return __Pyx_NewRef(PyList_GET_ITEM(o, n));
  11757. }
  11758. } else
  11759. #if !CYTHON_AVOID_BORROWED_REFS
  11760. if (PyTuple_CheckExact(o)) {
  11761. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  11762. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  11763. return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
  11764. }
  11765. } else
  11766. #endif
  11767. #endif
  11768. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  11769. {
  11770. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  11771. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  11772. if (!is_list && mm && mm->mp_subscript) {
  11773. PyObject *r, *key = PyLong_FromSsize_t(i);
  11774. if (unlikely(!key)) return NULL;
  11775. r = mm->mp_subscript(o, key);
  11776. Py_DECREF(key);
  11777. return r;
  11778. }
  11779. if (is_list || likely(sm && sm->sq_item)) {
  11780. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  11781. Py_ssize_t l = sm->sq_length(o);
  11782. if (likely(l >= 0)) {
  11783. i += l;
  11784. } else {
  11785. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  11786. return NULL;
  11787. PyErr_Clear();
  11788. }
  11789. }
  11790. return sm->sq_item(o, i);
  11791. }
  11792. }
  11793. #else
  11794. if (is_list || !PyMapping_Check(o)) {
  11795. return PySequence_GetItem(o, i);
  11796. }
  11797. #endif
  11798. (void)wraparound;
  11799. (void)boundscheck;
  11800. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11801. }
  11802. /* PyObjectCall */
  11803. #if CYTHON_COMPILING_IN_CPYTHON
  11804. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  11805. PyObject *result;
  11806. ternaryfunc call = Py_TYPE(func)->tp_call;
  11807. if (unlikely(!call))
  11808. return PyObject_Call(func, arg, kw);
  11809. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  11810. return NULL;
  11811. result = (*call)(func, arg, kw);
  11812. Py_LeaveRecursiveCall();
  11813. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  11814. PyErr_SetString(
  11815. PyExc_SystemError,
  11816. "NULL result without error in PyObject_Call");
  11817. }
  11818. return result;
  11819. }
  11820. #endif
  11821. /* TupleAndListFromArray (used by fastcall) */
  11822. #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
  11823. static CYTHON_INLINE PyObject *
  11824. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  11825. {
  11826. PyObject *res;
  11827. Py_ssize_t i;
  11828. if (n <= 0) {
  11829. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  11830. }
  11831. res = PyTuple_New(n);
  11832. if (unlikely(res == NULL)) return NULL;
  11833. for (i = 0; i < n; i++) {
  11834. if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
  11835. Py_DECREF(res);
  11836. return NULL;
  11837. }
  11838. Py_INCREF(src[i]);
  11839. }
  11840. return res;
  11841. }
  11842. #elif CYTHON_COMPILING_IN_CPYTHON
  11843. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  11844. PyObject *v;
  11845. Py_ssize_t i;
  11846. for (i = 0; i < length; i++) {
  11847. v = dest[i] = src[i];
  11848. Py_INCREF(v);
  11849. }
  11850. }
  11851. static CYTHON_INLINE PyObject *
  11852. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  11853. {
  11854. PyObject *res;
  11855. if (n <= 0) {
  11856. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  11857. }
  11858. res = PyTuple_New(n);
  11859. if (unlikely(res == NULL)) return NULL;
  11860. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  11861. return res;
  11862. }
  11863. static CYTHON_INLINE PyObject *
  11864. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  11865. {
  11866. PyObject *res;
  11867. if (n <= 0) {
  11868. return PyList_New(0);
  11869. }
  11870. res = PyList_New(n);
  11871. if (unlikely(res == NULL)) return NULL;
  11872. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  11873. return res;
  11874. }
  11875. #endif
  11876. /* BytesEquals (used by UnicodeEquals) */
  11877. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  11878. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
  11879. !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
  11880. return PyObject_RichCompareBool(s1, s2, equals);
  11881. #else
  11882. if (s1 == s2) {
  11883. return (equals == Py_EQ);
  11884. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  11885. const char *ps1, *ps2;
  11886. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  11887. if (length != PyBytes_GET_SIZE(s2))
  11888. return (equals == Py_NE);
  11889. ps1 = PyBytes_AS_STRING(s1);
  11890. ps2 = PyBytes_AS_STRING(s2);
  11891. if (ps1[0] != ps2[0]) {
  11892. return (equals == Py_NE);
  11893. } else if (length == 1) {
  11894. return (equals == Py_EQ);
  11895. } else {
  11896. int result;
  11897. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  11898. Py_hash_t hash1, hash2;
  11899. hash1 = ((PyBytesObject*)s1)->ob_shash;
  11900. hash2 = ((PyBytesObject*)s2)->ob_shash;
  11901. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  11902. return (equals == Py_NE);
  11903. }
  11904. #endif
  11905. result = memcmp(ps1, ps2, (size_t)length);
  11906. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  11907. }
  11908. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  11909. return (equals == Py_NE);
  11910. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  11911. return (equals == Py_NE);
  11912. } else {
  11913. int result;
  11914. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  11915. if (!py_result)
  11916. return -1;
  11917. result = __Pyx_PyObject_IsTrue(py_result);
  11918. Py_DECREF(py_result);
  11919. return result;
  11920. }
  11921. #endif
  11922. }
  11923. /* UnicodeEquals (used by fastcall) */
  11924. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  11925. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  11926. return PyObject_RichCompareBool(s1, s2, equals);
  11927. #else
  11928. int s1_is_unicode, s2_is_unicode;
  11929. if (s1 == s2) {
  11930. goto return_eq;
  11931. }
  11932. s1_is_unicode = PyUnicode_CheckExact(s1);
  11933. s2_is_unicode = PyUnicode_CheckExact(s2);
  11934. if (s1_is_unicode & s2_is_unicode) {
  11935. Py_ssize_t length, length2;
  11936. int kind;
  11937. void *data1, *data2;
  11938. #if !CYTHON_COMPILING_IN_LIMITED_API
  11939. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  11940. return -1;
  11941. #endif
  11942. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  11943. #if !CYTHON_ASSUME_SAFE_SIZE
  11944. if (unlikely(length < 0)) return -1;
  11945. #endif
  11946. length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
  11947. #if !CYTHON_ASSUME_SAFE_SIZE
  11948. if (unlikely(length2 < 0)) return -1;
  11949. #endif
  11950. if (length != length2) {
  11951. goto return_ne;
  11952. }
  11953. #if CYTHON_USE_UNICODE_INTERNALS
  11954. {
  11955. Py_hash_t hash1, hash2;
  11956. hash1 = ((PyASCIIObject*)s1)->hash;
  11957. hash2 = ((PyASCIIObject*)s2)->hash;
  11958. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  11959. goto return_ne;
  11960. }
  11961. }
  11962. #endif
  11963. kind = __Pyx_PyUnicode_KIND(s1);
  11964. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  11965. goto return_ne;
  11966. }
  11967. data1 = __Pyx_PyUnicode_DATA(s1);
  11968. data2 = __Pyx_PyUnicode_DATA(s2);
  11969. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  11970. goto return_ne;
  11971. } else if (length == 1) {
  11972. goto return_eq;
  11973. } else {
  11974. int result = memcmp(data1, data2, (size_t)(length * kind));
  11975. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  11976. }
  11977. } else if ((s1 == Py_None) & s2_is_unicode) {
  11978. goto return_ne;
  11979. } else if ((s2 == Py_None) & s1_is_unicode) {
  11980. goto return_ne;
  11981. } else {
  11982. int result;
  11983. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  11984. if (!py_result)
  11985. return -1;
  11986. result = __Pyx_PyObject_IsTrue(py_result);
  11987. Py_DECREF(py_result);
  11988. return result;
  11989. }
  11990. return_eq:
  11991. return (equals == Py_EQ);
  11992. return_ne:
  11993. return (equals == Py_NE);
  11994. #endif
  11995. }
  11996. /* fastcall */
  11997. #if CYTHON_METH_FASTCALL
  11998. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  11999. {
  12000. Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
  12001. #if !CYTHON_ASSUME_SAFE_SIZE
  12002. if (unlikely(n == -1)) return NULL;
  12003. #endif
  12004. for (i = 0; i < n; i++)
  12005. {
  12006. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  12007. #if !CYTHON_ASSUME_SAFE_MACROS
  12008. if (unlikely(!namei)) return NULL;
  12009. #endif
  12010. if (s == namei) return kwvalues[i];
  12011. }
  12012. for (i = 0; i < n; i++)
  12013. {
  12014. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  12015. #if !CYTHON_ASSUME_SAFE_MACROS
  12016. if (unlikely(!namei)) return NULL;
  12017. #endif
  12018. int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
  12019. if (unlikely(eq != 0)) {
  12020. if (unlikely(eq < 0)) return NULL;
  12021. return kwvalues[i];
  12022. }
  12023. }
  12024. return NULL;
  12025. }
  12026. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  12027. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  12028. Py_ssize_t i, nkwargs;
  12029. PyObject *dict;
  12030. #if !CYTHON_ASSUME_SAFE_SIZE
  12031. nkwargs = PyTuple_Size(kwnames);
  12032. if (unlikely(nkwargs < 0)) return NULL;
  12033. #else
  12034. nkwargs = PyTuple_GET_SIZE(kwnames);
  12035. #endif
  12036. dict = PyDict_New();
  12037. if (unlikely(!dict))
  12038. return NULL;
  12039. for (i=0; i<nkwargs; i++) {
  12040. #if !CYTHON_ASSUME_SAFE_MACROS
  12041. PyObject *key = PyTuple_GetItem(kwnames, i);
  12042. if (!key) goto bad;
  12043. #else
  12044. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  12045. #endif
  12046. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  12047. goto bad;
  12048. }
  12049. return dict;
  12050. bad:
  12051. Py_DECREF(dict);
  12052. return NULL;
  12053. }
  12054. #endif
  12055. #endif
  12056. /* PyObjectCallMethO (used by PyObjectFastCall) */
  12057. #if CYTHON_COMPILING_IN_CPYTHON
  12058. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  12059. PyObject *self, *result;
  12060. PyCFunction cfunc;
  12061. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  12062. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  12063. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  12064. return NULL;
  12065. result = cfunc(self, arg);
  12066. Py_LeaveRecursiveCall();
  12067. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  12068. PyErr_SetString(
  12069. PyExc_SystemError,
  12070. "NULL result without error in PyObject_Call");
  12071. }
  12072. return result;
  12073. }
  12074. #endif
  12075. /* PyObjectFastCall (used by PyObjectCallOneArg) */
  12076. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  12077. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
  12078. PyObject *argstuple;
  12079. PyObject *result = 0;
  12080. size_t i;
  12081. argstuple = PyTuple_New((Py_ssize_t)nargs);
  12082. if (unlikely(!argstuple)) return NULL;
  12083. for (i = 0; i < nargs; i++) {
  12084. Py_INCREF(args[i]);
  12085. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
  12086. }
  12087. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  12088. bad:
  12089. Py_DECREF(argstuple);
  12090. return result;
  12091. }
  12092. #endif
  12093. #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  12094. #if PY_VERSION_HEX < 0x03090000
  12095. #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  12096. #elif CYTHON_COMPILING_IN_CPYTHON
  12097. static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
  12098. PyTypeObject *tp = Py_TYPE(callable);
  12099. #if defined(__Pyx_CyFunction_USED)
  12100. if (__Pyx_CyFunction_CheckExact(callable)) {
  12101. return __Pyx_CyFunction_func_vectorcall(callable);
  12102. }
  12103. #endif
  12104. if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
  12105. return NULL;
  12106. }
  12107. assert(PyCallable_Check(callable));
  12108. Py_ssize_t offset = tp->tp_vectorcall_offset;
  12109. assert(offset > 0);
  12110. vectorcallfunc ptr;
  12111. memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
  12112. return ptr;
  12113. }
  12114. #else
  12115. #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  12116. #endif
  12117. #endif
  12118. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
  12119. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  12120. #if CYTHON_COMPILING_IN_CPYTHON
  12121. if (nargs == 0 && kwargs == NULL) {
  12122. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  12123. return __Pyx_PyObject_CallMethO(func, NULL);
  12124. }
  12125. else if (nargs == 1 && kwargs == NULL) {
  12126. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  12127. return __Pyx_PyObject_CallMethO(func, args[0]);
  12128. }
  12129. #endif
  12130. if (kwargs == NULL) {
  12131. #if CYTHON_VECTORCALL
  12132. #if CYTHON_COMPILING_IN_LIMITED_API
  12133. return PyObject_Vectorcall(func, args, _nargs, NULL);
  12134. #else
  12135. vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
  12136. if (f) {
  12137. return f(func, args, _nargs, NULL);
  12138. }
  12139. #endif
  12140. #endif
  12141. }
  12142. if (nargs == 0) {
  12143. return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
  12144. }
  12145. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  12146. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  12147. #else
  12148. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  12149. #endif
  12150. }
  12151. /* PyObjectCallOneArg (used by CallUnboundCMethod0) */
  12152. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  12153. PyObject *args[2] = {NULL, arg};
  12154. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  12155. }
  12156. /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
  12157. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  12158. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
  12159. PyObject *result;
  12160. PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
  12161. if (unlikely(!selfless_args)) return NULL;
  12162. result = PyObject_Call(method, selfless_args, kwargs);
  12163. Py_DECREF(selfless_args);
  12164. return result;
  12165. }
  12166. #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
  12167. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
  12168. return _PyObject_Vectorcall
  12169. (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
  12170. }
  12171. #else
  12172. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
  12173. return
  12174. #if PY_VERSION_HEX < 0x03090000
  12175. _PyObject_Vectorcall
  12176. #else
  12177. PyObject_Vectorcall
  12178. #endif
  12179. (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
  12180. }
  12181. #endif
  12182. static PyMethodDef __Pyx_UnboundCMethod_Def = {
  12183. "CythonUnboundCMethod",
  12184. __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
  12185. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  12186. METH_VARARGS | METH_KEYWORDS,
  12187. #else
  12188. METH_FASTCALL | METH_KEYWORDS,
  12189. #endif
  12190. NULL
  12191. };
  12192. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  12193. PyObject *method, *result=NULL;
  12194. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  12195. if (unlikely(!method))
  12196. return -1;
  12197. result = method;
  12198. #if CYTHON_COMPILING_IN_CPYTHON
  12199. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  12200. {
  12201. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  12202. target->func = descr->d_method->ml_meth;
  12203. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  12204. } else
  12205. #endif
  12206. #if CYTHON_COMPILING_IN_PYPY
  12207. #else
  12208. if (PyCFunction_Check(method))
  12209. #endif
  12210. {
  12211. PyObject *self;
  12212. int self_found;
  12213. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  12214. self = PyObject_GetAttrString(method, "__self__");
  12215. if (!self) {
  12216. PyErr_Clear();
  12217. }
  12218. #else
  12219. self = PyCFunction_GET_SELF(method);
  12220. #endif
  12221. self_found = (self && self != Py_None);
  12222. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  12223. Py_XDECREF(self);
  12224. #endif
  12225. if (self_found) {
  12226. PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
  12227. if (unlikely(!unbound_method)) return -1;
  12228. Py_DECREF(method);
  12229. result = unbound_method;
  12230. }
  12231. }
  12232. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12233. if (unlikely(target->method)) {
  12234. Py_DECREF(result);
  12235. } else
  12236. #endif
  12237. target->method = result;
  12238. return 0;
  12239. }
  12240. /* CallUnboundCMethod0 */
  12241. #if CYTHON_COMPILING_IN_CPYTHON
  12242. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  12243. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  12244. if (likely(was_initialized == 2 && cfunc->func)) {
  12245. if (likely(cfunc->flag == METH_NOARGS))
  12246. return __Pyx_CallCFunction(cfunc, self, NULL);
  12247. if (likely(cfunc->flag == METH_FASTCALL))
  12248. return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
  12249. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  12250. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
  12251. if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
  12252. return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  12253. if (cfunc->flag == METH_VARARGS)
  12254. return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
  12255. return __Pyx__CallUnboundCMethod0(cfunc, self);
  12256. }
  12257. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12258. else if (unlikely(was_initialized == 1)) {
  12259. __Pyx_CachedCFunction tmp_cfunc = {
  12260. #ifndef __cplusplus
  12261. 0
  12262. #endif
  12263. };
  12264. tmp_cfunc.type = cfunc->type;
  12265. tmp_cfunc.method_name = cfunc->method_name;
  12266. return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
  12267. }
  12268. #endif
  12269. PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
  12270. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  12271. return result;
  12272. }
  12273. #endif
  12274. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  12275. PyObject *result;
  12276. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  12277. result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
  12278. return result;
  12279. }
  12280. /* py_dict_items (used by OwnedDictNext) */
  12281. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
  12282. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
  12283. }
  12284. /* py_dict_values (used by OwnedDictNext) */
  12285. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
  12286. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
  12287. }
  12288. /* OwnedDictNext (used by ParseKeywordsImpl) */
  12289. #if CYTHON_AVOID_BORROWED_REFS
  12290. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
  12291. PyObject *next = NULL;
  12292. if (!*ppos) {
  12293. if (pvalue) {
  12294. PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
  12295. if (unlikely(!dictview)) goto bad;
  12296. *ppos = PyObject_GetIter(dictview);
  12297. Py_DECREF(dictview);
  12298. } else {
  12299. *ppos = PyObject_GetIter(p);
  12300. }
  12301. if (unlikely(!*ppos)) goto bad;
  12302. }
  12303. next = PyIter_Next(*ppos);
  12304. if (!next) {
  12305. if (PyErr_Occurred()) goto bad;
  12306. return 0;
  12307. }
  12308. if (pkey && pvalue) {
  12309. *pkey = __Pyx_PySequence_ITEM(next, 0);
  12310. if (unlikely(*pkey)) goto bad;
  12311. *pvalue = __Pyx_PySequence_ITEM(next, 1);
  12312. if (unlikely(*pvalue)) goto bad;
  12313. Py_DECREF(next);
  12314. } else if (pkey) {
  12315. *pkey = next;
  12316. } else {
  12317. assert(pvalue);
  12318. *pvalue = next;
  12319. }
  12320. return 1;
  12321. bad:
  12322. Py_XDECREF(next);
  12323. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  12324. PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
  12325. #else
  12326. PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
  12327. #endif
  12328. if (pkey) *pkey = NULL;
  12329. if (pvalue) *pvalue = NULL;
  12330. return 0;
  12331. }
  12332. #else // !CYTHON_AVOID_BORROWED_REFS
  12333. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
  12334. int result = PyDict_Next(p, ppos, pkey, pvalue);
  12335. if (likely(result == 1)) {
  12336. if (pkey) Py_INCREF(*pkey);
  12337. if (pvalue) Py_INCREF(*pvalue);
  12338. }
  12339. return result;
  12340. }
  12341. #endif
  12342. /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
  12343. static void __Pyx_RaiseDoubleKeywordsError(
  12344. const char* func_name,
  12345. PyObject* kw_name)
  12346. {
  12347. PyErr_Format(PyExc_TypeError,
  12348. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  12349. }
  12350. /* CallUnboundCMethod2 */
  12351. #if CYTHON_COMPILING_IN_CPYTHON
  12352. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
  12353. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  12354. if (likely(was_initialized == 2 && cfunc->func)) {
  12355. PyObject *args[2] = {arg1, arg2};
  12356. if (cfunc->flag == METH_FASTCALL) {
  12357. return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
  12358. }
  12359. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  12360. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
  12361. }
  12362. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12363. else if (unlikely(was_initialized == 1)) {
  12364. __Pyx_CachedCFunction tmp_cfunc = {
  12365. #ifndef __cplusplus
  12366. 0
  12367. #endif
  12368. };
  12369. tmp_cfunc.type = cfunc->type;
  12370. tmp_cfunc.method_name = cfunc->method_name;
  12371. return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
  12372. }
  12373. #endif
  12374. PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
  12375. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  12376. return result;
  12377. }
  12378. #endif
  12379. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
  12380. if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  12381. #if CYTHON_COMPILING_IN_CPYTHON
  12382. if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
  12383. PyObject *result = NULL;
  12384. PyObject *args = PyTuple_New(2);
  12385. if (unlikely(!args)) return NULL;
  12386. Py_INCREF(arg1);
  12387. PyTuple_SET_ITEM(args, 0, arg1);
  12388. Py_INCREF(arg2);
  12389. PyTuple_SET_ITEM(args, 1, arg2);
  12390. if (cfunc->flag & METH_KEYWORDS)
  12391. result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
  12392. else
  12393. result = __Pyx_CallCFunction(cfunc, self, args);
  12394. Py_DECREF(args);
  12395. return result;
  12396. }
  12397. #endif
  12398. {
  12399. PyObject *args[4] = {NULL, self, arg1, arg2};
  12400. return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  12401. }
  12402. }
  12403. /* ParseKeywordsImpl (used by ParseKeywords) */
  12404. static int __Pyx_ValidateDuplicatePosArgs(
  12405. PyObject *kwds,
  12406. PyObject ** const argnames[],
  12407. PyObject ** const *first_kw_arg,
  12408. const char* function_name)
  12409. {
  12410. PyObject ** const *name = argnames;
  12411. while (name != first_kw_arg) {
  12412. PyObject *key = **name;
  12413. int found = PyDict_Contains(kwds, key);
  12414. if (unlikely(found)) {
  12415. if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12416. goto bad;
  12417. }
  12418. name++;
  12419. }
  12420. return 0;
  12421. bad:
  12422. return -1;
  12423. }
  12424. #if CYTHON_USE_UNICODE_INTERNALS
  12425. static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
  12426. int kind;
  12427. Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
  12428. if (len != PyUnicode_GET_LENGTH(s2)) return 0;
  12429. kind = PyUnicode_KIND(s1);
  12430. if (kind != PyUnicode_KIND(s2)) return 0;
  12431. const void *data1 = PyUnicode_DATA(s1);
  12432. const void *data2 = PyUnicode_DATA(s2);
  12433. return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
  12434. }
  12435. #endif
  12436. static int __Pyx_MatchKeywordArg_str(
  12437. PyObject *key,
  12438. PyObject ** const argnames[],
  12439. PyObject ** const *first_kw_arg,
  12440. size_t *index_found,
  12441. const char *function_name)
  12442. {
  12443. PyObject ** const *name;
  12444. #if CYTHON_USE_UNICODE_INTERNALS
  12445. Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
  12446. if (unlikely(key_hash == -1)) {
  12447. key_hash = PyObject_Hash(key);
  12448. if (unlikely(key_hash == -1))
  12449. goto bad;
  12450. }
  12451. #endif
  12452. name = first_kw_arg;
  12453. while (*name) {
  12454. PyObject *name_str = **name;
  12455. #if CYTHON_USE_UNICODE_INTERNALS
  12456. if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
  12457. *index_found = (size_t) (name - argnames);
  12458. return 1;
  12459. }
  12460. #else
  12461. #if CYTHON_ASSUME_SAFE_SIZE
  12462. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  12463. #endif
  12464. {
  12465. int cmp = PyUnicode_Compare(name_str, key);
  12466. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12467. if (cmp == 0) {
  12468. *index_found = (size_t) (name - argnames);
  12469. return 1;
  12470. }
  12471. }
  12472. #endif
  12473. name++;
  12474. }
  12475. name = argnames;
  12476. while (name != first_kw_arg) {
  12477. PyObject *name_str = **name;
  12478. #if CYTHON_USE_UNICODE_INTERNALS
  12479. if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
  12480. if (__Pyx_UnicodeKeywordsEqual(name_str, key))
  12481. goto arg_passed_twice;
  12482. }
  12483. #else
  12484. #if CYTHON_ASSUME_SAFE_SIZE
  12485. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  12486. #endif
  12487. {
  12488. if (unlikely(name_str == key)) goto arg_passed_twice;
  12489. int cmp = PyUnicode_Compare(name_str, key);
  12490. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12491. if (cmp == 0) goto arg_passed_twice;
  12492. }
  12493. #endif
  12494. name++;
  12495. }
  12496. return 0;
  12497. arg_passed_twice:
  12498. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12499. goto bad;
  12500. bad:
  12501. return -1;
  12502. }
  12503. static int __Pyx_MatchKeywordArg_nostr(
  12504. PyObject *key,
  12505. PyObject ** const argnames[],
  12506. PyObject ** const *first_kw_arg,
  12507. size_t *index_found,
  12508. const char *function_name)
  12509. {
  12510. PyObject ** const *name;
  12511. if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
  12512. name = first_kw_arg;
  12513. while (*name) {
  12514. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  12515. if (cmp == 1) {
  12516. *index_found = (size_t) (name - argnames);
  12517. return 1;
  12518. }
  12519. if (unlikely(cmp == -1)) goto bad;
  12520. name++;
  12521. }
  12522. name = argnames;
  12523. while (name != first_kw_arg) {
  12524. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  12525. if (unlikely(cmp != 0)) {
  12526. if (cmp == 1) goto arg_passed_twice;
  12527. else goto bad;
  12528. }
  12529. name++;
  12530. }
  12531. return 0;
  12532. arg_passed_twice:
  12533. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12534. goto bad;
  12535. invalid_keyword_type:
  12536. PyErr_Format(PyExc_TypeError,
  12537. "%.200s() keywords must be strings", function_name);
  12538. goto bad;
  12539. bad:
  12540. return -1;
  12541. }
  12542. static CYTHON_INLINE int __Pyx_MatchKeywordArg(
  12543. PyObject *key,
  12544. PyObject ** const argnames[],
  12545. PyObject ** const *first_kw_arg,
  12546. size_t *index_found,
  12547. const char *function_name)
  12548. {
  12549. return likely(PyUnicode_CheckExact(key)) ?
  12550. __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
  12551. __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
  12552. }
  12553. static void __Pyx_RejectUnknownKeyword(
  12554. PyObject *kwds,
  12555. PyObject ** const argnames[],
  12556. PyObject ** const *first_kw_arg,
  12557. const char *function_name)
  12558. {
  12559. #if CYTHON_AVOID_BORROWED_REFS
  12560. PyObject *pos = NULL;
  12561. #else
  12562. Py_ssize_t pos = 0;
  12563. #endif
  12564. PyObject *key = NULL;
  12565. __Pyx_BEGIN_CRITICAL_SECTION(kwds);
  12566. while (
  12567. #if CYTHON_AVOID_BORROWED_REFS
  12568. __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
  12569. #else
  12570. PyDict_Next(kwds, &pos, &key, NULL)
  12571. #endif
  12572. ) {
  12573. PyObject** const *name = first_kw_arg;
  12574. while (*name && (**name != key)) name++;
  12575. if (!*name) {
  12576. size_t index_found = 0;
  12577. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  12578. if (cmp != 1) {
  12579. if (cmp == 0) {
  12580. PyErr_Format(PyExc_TypeError,
  12581. "%s() got an unexpected keyword argument '%U'",
  12582. function_name, key);
  12583. }
  12584. #if CYTHON_AVOID_BORROWED_REFS
  12585. Py_DECREF(key);
  12586. #endif
  12587. break;
  12588. }
  12589. }
  12590. #if CYTHON_AVOID_BORROWED_REFS
  12591. Py_DECREF(key);
  12592. #endif
  12593. }
  12594. __Pyx_END_CRITICAL_SECTION();
  12595. #if CYTHON_AVOID_BORROWED_REFS
  12596. Py_XDECREF(pos);
  12597. #endif
  12598. assert(PyErr_Occurred());
  12599. }
  12600. static int __Pyx_ParseKeywordDict(
  12601. PyObject *kwds,
  12602. PyObject ** const argnames[],
  12603. PyObject *values[],
  12604. Py_ssize_t num_pos_args,
  12605. Py_ssize_t num_kwargs,
  12606. const char* function_name,
  12607. int ignore_unknown_kwargs)
  12608. {
  12609. PyObject** const *name;
  12610. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12611. Py_ssize_t extracted = 0;
  12612. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  12613. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  12614. #endif
  12615. name = first_kw_arg;
  12616. while (*name && num_kwargs > extracted) {
  12617. PyObject * key = **name;
  12618. PyObject *value;
  12619. int found = 0;
  12620. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  12621. found = PyDict_GetItemRef(kwds, key, &value);
  12622. #else
  12623. value = PyDict_GetItemWithError(kwds, key);
  12624. if (value) {
  12625. Py_INCREF(value);
  12626. found = 1;
  12627. } else {
  12628. if (unlikely(PyErr_Occurred())) goto bad;
  12629. }
  12630. #endif
  12631. if (found) {
  12632. if (unlikely(found < 0)) goto bad;
  12633. values[name-argnames] = value;
  12634. extracted++;
  12635. }
  12636. name++;
  12637. }
  12638. if (num_kwargs > extracted) {
  12639. if (ignore_unknown_kwargs) {
  12640. if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
  12641. goto bad;
  12642. } else {
  12643. __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
  12644. goto bad;
  12645. }
  12646. }
  12647. return 0;
  12648. bad:
  12649. return -1;
  12650. }
  12651. static int __Pyx_ParseKeywordDictToDict(
  12652. PyObject *kwds,
  12653. PyObject ** const argnames[],
  12654. PyObject *kwds2,
  12655. PyObject *values[],
  12656. Py_ssize_t num_pos_args,
  12657. const char* function_name)
  12658. {
  12659. PyObject** const *name;
  12660. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12661. Py_ssize_t len;
  12662. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  12663. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  12664. #endif
  12665. if (PyDict_Update(kwds2, kwds) < 0) goto bad;
  12666. name = first_kw_arg;
  12667. while (*name) {
  12668. PyObject *key = **name;
  12669. PyObject *value;
  12670. #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
  12671. int found = PyDict_Pop(kwds2, key, &value);
  12672. if (found) {
  12673. if (unlikely(found < 0)) goto bad;
  12674. values[name-argnames] = value;
  12675. }
  12676. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  12677. int found = PyDict_GetItemRef(kwds2, key, &value);
  12678. if (found) {
  12679. if (unlikely(found < 0)) goto bad;
  12680. values[name-argnames] = value;
  12681. if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
  12682. }
  12683. #else
  12684. #if CYTHON_COMPILING_IN_CPYTHON
  12685. value = _PyDict_Pop(kwds2, key, kwds2);
  12686. #else
  12687. value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
  12688. #endif
  12689. if (value == kwds2) {
  12690. Py_DECREF(value);
  12691. } else {
  12692. if (unlikely(!value)) goto bad;
  12693. values[name-argnames] = value;
  12694. }
  12695. #endif
  12696. name++;
  12697. }
  12698. len = PyDict_Size(kwds2);
  12699. if (len > 0) {
  12700. return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
  12701. } else if (unlikely(len == -1)) {
  12702. goto bad;
  12703. }
  12704. return 0;
  12705. bad:
  12706. return -1;
  12707. }
  12708. static int __Pyx_ParseKeywordsTuple(
  12709. PyObject *kwds,
  12710. PyObject * const *kwvalues,
  12711. PyObject ** const argnames[],
  12712. PyObject *kwds2,
  12713. PyObject *values[],
  12714. Py_ssize_t num_pos_args,
  12715. Py_ssize_t num_kwargs,
  12716. const char* function_name,
  12717. int ignore_unknown_kwargs)
  12718. {
  12719. PyObject *key = NULL;
  12720. PyObject** const * name;
  12721. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12722. for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
  12723. #if CYTHON_AVOID_BORROWED_REFS
  12724. key = __Pyx_PySequence_ITEM(kwds, pos);
  12725. #else
  12726. key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
  12727. #endif
  12728. #if !CYTHON_ASSUME_SAFE_MACROS
  12729. if (unlikely(!key)) goto bad;
  12730. #endif
  12731. name = first_kw_arg;
  12732. while (*name && (**name != key)) name++;
  12733. if (*name) {
  12734. PyObject *value = kwvalues[pos];
  12735. values[name-argnames] = __Pyx_NewRef(value);
  12736. } else {
  12737. size_t index_found = 0;
  12738. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  12739. if (cmp == 1) {
  12740. PyObject *value = kwvalues[pos];
  12741. values[index_found] = __Pyx_NewRef(value);
  12742. } else {
  12743. if (unlikely(cmp == -1)) goto bad;
  12744. if (kwds2) {
  12745. PyObject *value = kwvalues[pos];
  12746. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  12747. } else if (!ignore_unknown_kwargs) {
  12748. goto invalid_keyword;
  12749. }
  12750. }
  12751. }
  12752. #if CYTHON_AVOID_BORROWED_REFS
  12753. Py_DECREF(key);
  12754. key = NULL;
  12755. #endif
  12756. }
  12757. return 0;
  12758. invalid_keyword:
  12759. PyErr_Format(PyExc_TypeError,
  12760. "%s() got an unexpected keyword argument '%U'",
  12761. function_name, key);
  12762. goto bad;
  12763. bad:
  12764. #if CYTHON_AVOID_BORROWED_REFS
  12765. Py_XDECREF(key);
  12766. #endif
  12767. return -1;
  12768. }
  12769. /* ParseKeywords */
  12770. static int __Pyx_ParseKeywords(
  12771. PyObject *kwds,
  12772. PyObject * const *kwvalues,
  12773. PyObject ** const argnames[],
  12774. PyObject *kwds2,
  12775. PyObject *values[],
  12776. Py_ssize_t num_pos_args,
  12777. Py_ssize_t num_kwargs,
  12778. const char* function_name,
  12779. int ignore_unknown_kwargs)
  12780. {
  12781. if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
  12782. return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  12783. else if (kwds2)
  12784. return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
  12785. else
  12786. return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  12787. }
  12788. /* RaiseArgTupleInvalid */
  12789. static void __Pyx_RaiseArgtupleInvalid(
  12790. const char* func_name,
  12791. int exact,
  12792. Py_ssize_t num_min,
  12793. Py_ssize_t num_max,
  12794. Py_ssize_t num_found)
  12795. {
  12796. Py_ssize_t num_expected;
  12797. const char *more_or_less;
  12798. if (num_found < num_min) {
  12799. num_expected = num_min;
  12800. more_or_less = "at least";
  12801. } else {
  12802. num_expected = num_max;
  12803. more_or_less = "at most";
  12804. }
  12805. if (exact) {
  12806. more_or_less = "exactly";
  12807. }
  12808. PyErr_Format(PyExc_TypeError,
  12809. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12810. func_name, more_or_less, num_expected,
  12811. (num_expected == 1) ? "" : "s", num_found);
  12812. }
  12813. /* RaiseException */
  12814. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  12815. PyObject* owned_instance = NULL;
  12816. if (tb == Py_None) {
  12817. tb = 0;
  12818. } else if (tb && !PyTraceBack_Check(tb)) {
  12819. PyErr_SetString(PyExc_TypeError,
  12820. "raise: arg 3 must be a traceback or None");
  12821. goto bad;
  12822. }
  12823. if (value == Py_None)
  12824. value = 0;
  12825. if (PyExceptionInstance_Check(type)) {
  12826. if (value) {
  12827. PyErr_SetString(PyExc_TypeError,
  12828. "instance exception may not have a separate value");
  12829. goto bad;
  12830. }
  12831. value = type;
  12832. type = (PyObject*) Py_TYPE(value);
  12833. } else if (PyExceptionClass_Check(type)) {
  12834. PyObject *instance_class = NULL;
  12835. if (value && PyExceptionInstance_Check(value)) {
  12836. instance_class = (PyObject*) Py_TYPE(value);
  12837. if (instance_class != type) {
  12838. int is_subclass = PyObject_IsSubclass(instance_class, type);
  12839. if (!is_subclass) {
  12840. instance_class = NULL;
  12841. } else if (unlikely(is_subclass == -1)) {
  12842. goto bad;
  12843. } else {
  12844. type = instance_class;
  12845. }
  12846. }
  12847. }
  12848. if (!instance_class) {
  12849. PyObject *args;
  12850. if (!value)
  12851. args = PyTuple_New(0);
  12852. else if (PyTuple_Check(value)) {
  12853. Py_INCREF(value);
  12854. args = value;
  12855. } else
  12856. args = PyTuple_Pack(1, value);
  12857. if (!args)
  12858. goto bad;
  12859. owned_instance = PyObject_Call(type, args, NULL);
  12860. Py_DECREF(args);
  12861. if (!owned_instance)
  12862. goto bad;
  12863. value = owned_instance;
  12864. if (!PyExceptionInstance_Check(value)) {
  12865. PyErr_Format(PyExc_TypeError,
  12866. "calling %R should have returned an instance of "
  12867. "BaseException, not %R",
  12868. type, Py_TYPE(value));
  12869. goto bad;
  12870. }
  12871. }
  12872. } else {
  12873. PyErr_SetString(PyExc_TypeError,
  12874. "raise: exception class must be a subclass of BaseException");
  12875. goto bad;
  12876. }
  12877. if (cause) {
  12878. PyObject *fixed_cause;
  12879. if (cause == Py_None) {
  12880. fixed_cause = NULL;
  12881. } else if (PyExceptionClass_Check(cause)) {
  12882. fixed_cause = PyObject_CallObject(cause, NULL);
  12883. if (fixed_cause == NULL)
  12884. goto bad;
  12885. } else if (PyExceptionInstance_Check(cause)) {
  12886. fixed_cause = cause;
  12887. Py_INCREF(fixed_cause);
  12888. } else {
  12889. PyErr_SetString(PyExc_TypeError,
  12890. "exception causes must derive from "
  12891. "BaseException");
  12892. goto bad;
  12893. }
  12894. PyException_SetCause(value, fixed_cause);
  12895. }
  12896. PyErr_SetObject(type, value);
  12897. if (tb) {
  12898. #if PY_VERSION_HEX >= 0x030C00A6
  12899. PyException_SetTraceback(value, tb);
  12900. #elif CYTHON_FAST_THREAD_STATE
  12901. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  12902. PyObject* tmp_tb = tstate->curexc_traceback;
  12903. if (tb != tmp_tb) {
  12904. Py_INCREF(tb);
  12905. tstate->curexc_traceback = tb;
  12906. Py_XDECREF(tmp_tb);
  12907. }
  12908. #else
  12909. PyObject *tmp_type, *tmp_value, *tmp_tb;
  12910. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  12911. Py_INCREF(tb);
  12912. PyErr_Restore(tmp_type, tmp_value, tb);
  12913. Py_XDECREF(tmp_tb);
  12914. #endif
  12915. }
  12916. bad:
  12917. Py_XDECREF(owned_instance);
  12918. return;
  12919. }
  12920. /* PyLongBinop */
  12921. #if !CYTHON_COMPILING_IN_PYPY
  12922. static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
  12923. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  12924. }
  12925. #if CYTHON_USE_PYLONG_INTERNALS
  12926. static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  12927. CYTHON_MAYBE_UNUSED_VAR(inplace);
  12928. CYTHON_UNUSED_VAR(zerodivision_check);
  12929. const long b = intval;
  12930. long a;
  12931. const PY_LONG_LONG llb = intval;
  12932. PY_LONG_LONG lla;
  12933. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  12934. return __Pyx_NewRef(op2);
  12935. }
  12936. const int is_positive = __Pyx_PyLong_IsPos(op1);
  12937. const digit* digits = __Pyx_PyLong_Digits(op1);
  12938. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  12939. if (likely(size == 1)) {
  12940. a = (long) digits[0];
  12941. if (!is_positive) a *= -1;
  12942. } else {
  12943. switch (size) {
  12944. case 2:
  12945. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  12946. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12947. if (!is_positive) a *= -1;
  12948. goto calculate_long;
  12949. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  12950. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  12951. if (!is_positive) lla *= -1;
  12952. goto calculate_long_long;
  12953. }
  12954. break;
  12955. case 3:
  12956. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  12957. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12958. if (!is_positive) a *= -1;
  12959. goto calculate_long;
  12960. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  12961. 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]));
  12962. if (!is_positive) lla *= -1;
  12963. goto calculate_long_long;
  12964. }
  12965. break;
  12966. case 4:
  12967. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  12968. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12969. if (!is_positive) a *= -1;
  12970. goto calculate_long;
  12971. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  12972. 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]));
  12973. if (!is_positive) lla *= -1;
  12974. goto calculate_long_long;
  12975. }
  12976. break;
  12977. }
  12978. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  12979. }
  12980. calculate_long:
  12981. {
  12982. long x;
  12983. x = a + b;
  12984. return PyLong_FromLong(x);
  12985. }
  12986. calculate_long_long:
  12987. {
  12988. PY_LONG_LONG llx;
  12989. llx = lla + llb;
  12990. return PyLong_FromLongLong(llx);
  12991. }
  12992. }
  12993. #endif
  12994. static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
  12995. CYTHON_UNUSED_VAR(zerodivision_check);
  12996. const long b = intval;
  12997. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  12998. double result;
  12999. result = ((double)a) + (double)b;
  13000. return PyFloat_FromDouble(result);
  13001. }
  13002. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13003. CYTHON_MAYBE_UNUSED_VAR(intval);
  13004. CYTHON_UNUSED_VAR(zerodivision_check);
  13005. #if CYTHON_USE_PYLONG_INTERNALS
  13006. if (likely(PyLong_CheckExact(op1))) {
  13007. return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
  13008. }
  13009. #endif
  13010. if (PyFloat_CheckExact(op1)) {
  13011. return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
  13012. }
  13013. return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
  13014. }
  13015. #endif
  13016. /* IterNextPlain (used by IterNext) */
  13017. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  13018. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
  13019. if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
  13020. __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
  13021. return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
  13022. }
  13023. #endif
  13024. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
  13025. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  13026. PyObject *result;
  13027. PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
  13028. if (unlikely(!next)) return NULL;
  13029. result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
  13030. return result;
  13031. #else
  13032. (void)__Pyx_GetBuiltinName; // only for early limited API
  13033. iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
  13034. assert(iternext);
  13035. return iternext(iterator);
  13036. #endif
  13037. }
  13038. /* IterNext */
  13039. static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
  13040. PyObject* exc_type;
  13041. __Pyx_PyThreadState_declare
  13042. __Pyx_PyThreadState_assign
  13043. exc_type = __Pyx_PyErr_CurrentExceptionType();
  13044. if (unlikely(exc_type)) {
  13045. if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  13046. return NULL;
  13047. __Pyx_PyErr_Clear();
  13048. Py_INCREF(defval);
  13049. return defval;
  13050. }
  13051. if (defval) {
  13052. Py_INCREF(defval);
  13053. return defval;
  13054. }
  13055. __Pyx_PyErr_SetNone(PyExc_StopIteration);
  13056. return NULL;
  13057. }
  13058. static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
  13059. __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(iterator));
  13060. PyErr_Format(PyExc_TypeError,
  13061. __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
  13062. __Pyx_DECREF_TypeName(iterator_type_name);
  13063. }
  13064. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
  13065. PyObject* next;
  13066. #if !CYTHON_COMPILING_IN_LIMITED_API
  13067. iternextfunc iternext = __Pyx_PyObject_TryGetSlot(iterator, tp_iternext, iternextfunc);
  13068. if (likely(iternext)) {
  13069. next = iternext(iterator);
  13070. if (likely(next))
  13071. return next;
  13072. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13073. if (unlikely(iternext == &_PyObject_NextNotImplemented))
  13074. return NULL;
  13075. #endif
  13076. } else if (CYTHON_USE_TYPE_SLOTS) {
  13077. __Pyx_PyIter_Next_ErrorNoIterator(iterator);
  13078. return NULL;
  13079. } else
  13080. #endif
  13081. if (unlikely(!PyIter_Check(iterator))) {
  13082. __Pyx_PyIter_Next_ErrorNoIterator(iterator);
  13083. return NULL;
  13084. } else {
  13085. next = defval ? PyIter_Next(iterator) : __Pyx_PyIter_Next_Plain(iterator);
  13086. if (likely(next))
  13087. return next;
  13088. }
  13089. return __Pyx_PyIter_Next2Default(defval);
  13090. }
  13091. /* PyLongCompare */
  13092. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  13093. CYTHON_MAYBE_UNUSED_VAR(intval);
  13094. CYTHON_UNUSED_VAR(inplace);
  13095. if (op1 == op2) {
  13096. return 0;
  13097. }
  13098. #if CYTHON_USE_PYLONG_INTERNALS
  13099. if (likely(PyLong_CheckExact(op1))) {
  13100. int unequal;
  13101. unsigned long uintval;
  13102. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13103. const digit* digits = __Pyx_PyLong_Digits(op1);
  13104. if (intval == 0) {
  13105. return (__Pyx_PyLong_IsZero(op1) != 1);
  13106. } else if (intval < 0) {
  13107. if (__Pyx_PyLong_IsNonNeg(op1))
  13108. return 1;
  13109. intval = -intval;
  13110. } else {
  13111. if (__Pyx_PyLong_IsNeg(op1))
  13112. return 1;
  13113. }
  13114. uintval = (unsigned long) intval;
  13115. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  13116. if (uintval >> (PyLong_SHIFT * 4)) {
  13117. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13118. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13119. } else
  13120. #endif
  13121. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  13122. if (uintval >> (PyLong_SHIFT * 3)) {
  13123. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13124. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13125. } else
  13126. #endif
  13127. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  13128. if (uintval >> (PyLong_SHIFT * 2)) {
  13129. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13130. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13131. } else
  13132. #endif
  13133. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  13134. if (uintval >> (PyLong_SHIFT * 1)) {
  13135. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13136. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13137. } else
  13138. #endif
  13139. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  13140. return (unequal != 0);
  13141. }
  13142. #endif
  13143. if (PyFloat_CheckExact(op1)) {
  13144. const long b = intval;
  13145. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  13146. return ((double)a != (double)b);
  13147. }
  13148. return __Pyx_PyObject_IsTrueAndDecref(
  13149. PyObject_RichCompare(op1, op2, Py_NE));
  13150. }
  13151. /* SliceObject */
  13152. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  13153. Py_ssize_t cstart, Py_ssize_t cstop,
  13154. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  13155. int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
  13156. __Pyx_TypeName obj_type_name;
  13157. #if CYTHON_USE_TYPE_SLOTS
  13158. PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
  13159. if (likely(mp && mp->mp_subscript))
  13160. #endif
  13161. {
  13162. PyObject* result;
  13163. PyObject *py_slice, *py_start, *py_stop;
  13164. if (_py_slice) {
  13165. py_slice = *_py_slice;
  13166. } else {
  13167. PyObject* owned_start = NULL;
  13168. PyObject* owned_stop = NULL;
  13169. if (_py_start) {
  13170. py_start = *_py_start;
  13171. } else {
  13172. if (has_cstart) {
  13173. owned_start = py_start = PyLong_FromSsize_t(cstart);
  13174. if (unlikely(!py_start)) goto bad;
  13175. } else
  13176. py_start = Py_None;
  13177. }
  13178. if (_py_stop) {
  13179. py_stop = *_py_stop;
  13180. } else {
  13181. if (has_cstop) {
  13182. owned_stop = py_stop = PyLong_FromSsize_t(cstop);
  13183. if (unlikely(!py_stop)) {
  13184. Py_XDECREF(owned_start);
  13185. goto bad;
  13186. }
  13187. } else
  13188. py_stop = Py_None;
  13189. }
  13190. py_slice = PySlice_New(py_start, py_stop, Py_None);
  13191. Py_XDECREF(owned_start);
  13192. Py_XDECREF(owned_stop);
  13193. if (unlikely(!py_slice)) goto bad;
  13194. }
  13195. #if CYTHON_USE_TYPE_SLOTS
  13196. result = mp->mp_subscript(obj, py_slice);
  13197. #else
  13198. result = PyObject_GetItem(obj, py_slice);
  13199. #endif
  13200. if (!_py_slice) {
  13201. Py_DECREF(py_slice);
  13202. }
  13203. return result;
  13204. }
  13205. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13206. PyErr_Format(PyExc_TypeError,
  13207. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  13208. __Pyx_DECREF_TypeName(obj_type_name);
  13209. bad:
  13210. return NULL;
  13211. }
  13212. /* ObjectGetItem */
  13213. #if CYTHON_USE_TYPE_SLOTS
  13214. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  13215. PyObject *runerr = NULL;
  13216. Py_ssize_t key_value;
  13217. key_value = __Pyx_PyIndex_AsSsize_t(index);
  13218. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  13219. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
  13220. }
  13221. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  13222. __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
  13223. PyErr_Clear();
  13224. PyErr_Format(PyExc_IndexError,
  13225. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  13226. __Pyx_DECREF_TypeName(index_type_name);
  13227. }
  13228. return NULL;
  13229. }
  13230. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  13231. __Pyx_TypeName obj_type_name;
  13232. if (likely(PyType_Check(obj))) {
  13233. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
  13234. if (!meth) {
  13235. PyErr_Clear();
  13236. } else {
  13237. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  13238. Py_DECREF(meth);
  13239. return result;
  13240. }
  13241. }
  13242. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13243. PyErr_Format(PyExc_TypeError,
  13244. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  13245. __Pyx_DECREF_TypeName(obj_type_name);
  13246. return NULL;
  13247. }
  13248. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  13249. PyTypeObject *tp = Py_TYPE(obj);
  13250. PyMappingMethods *mm = tp->tp_as_mapping;
  13251. PySequenceMethods *sm = tp->tp_as_sequence;
  13252. if (likely(mm && mm->mp_subscript)) {
  13253. return mm->mp_subscript(obj, key);
  13254. }
  13255. if (likely(sm && sm->sq_item)) {
  13256. return __Pyx_PyObject_GetIndex(obj, key);
  13257. }
  13258. return __Pyx_PyObject_GetItem_Slow(obj, key);
  13259. }
  13260. #endif
  13261. /* PyLongBinop */
  13262. #if !CYTHON_COMPILING_IN_PYPY
  13263. static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
  13264. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  13265. }
  13266. #if CYTHON_USE_PYLONG_INTERNALS
  13267. static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13268. CYTHON_MAYBE_UNUSED_VAR(inplace);
  13269. CYTHON_UNUSED_VAR(zerodivision_check);
  13270. const long b = intval;
  13271. long a;
  13272. const PY_LONG_LONG llb = intval;
  13273. PY_LONG_LONG lla;
  13274. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  13275. return PyLong_FromLong(-intval);
  13276. }
  13277. const int is_positive = __Pyx_PyLong_IsPos(op1);
  13278. const digit* digits = __Pyx_PyLong_Digits(op1);
  13279. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13280. if (likely(size == 1)) {
  13281. a = (long) digits[0];
  13282. if (!is_positive) a *= -1;
  13283. } else {
  13284. switch (size) {
  13285. case 2:
  13286. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  13287. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13288. if (!is_positive) a *= -1;
  13289. goto calculate_long;
  13290. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  13291. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  13292. if (!is_positive) lla *= -1;
  13293. goto calculate_long_long;
  13294. }
  13295. break;
  13296. case 3:
  13297. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  13298. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13299. if (!is_positive) a *= -1;
  13300. goto calculate_long;
  13301. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  13302. 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]));
  13303. if (!is_positive) lla *= -1;
  13304. goto calculate_long_long;
  13305. }
  13306. break;
  13307. case 4:
  13308. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  13309. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13310. if (!is_positive) a *= -1;
  13311. goto calculate_long;
  13312. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  13313. 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]));
  13314. if (!is_positive) lla *= -1;
  13315. goto calculate_long_long;
  13316. }
  13317. break;
  13318. }
  13319. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  13320. }
  13321. calculate_long:
  13322. {
  13323. long x;
  13324. x = a - b;
  13325. return PyLong_FromLong(x);
  13326. }
  13327. calculate_long_long:
  13328. {
  13329. PY_LONG_LONG llx;
  13330. llx = lla - llb;
  13331. return PyLong_FromLongLong(llx);
  13332. }
  13333. }
  13334. #endif
  13335. static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(PyObject *float_val, long intval, int zerodivision_check) {
  13336. CYTHON_UNUSED_VAR(zerodivision_check);
  13337. const long b = intval;
  13338. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  13339. double result;
  13340. result = ((double)a) - (double)b;
  13341. return PyFloat_FromDouble(result);
  13342. }
  13343. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13344. CYTHON_MAYBE_UNUSED_VAR(intval);
  13345. CYTHON_UNUSED_VAR(zerodivision_check);
  13346. #if CYTHON_USE_PYLONG_INTERNALS
  13347. if (likely(PyLong_CheckExact(op1))) {
  13348. return __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
  13349. }
  13350. #endif
  13351. if (PyFloat_CheckExact(op1)) {
  13352. return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
  13353. }
  13354. return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
  13355. }
  13356. #endif
  13357. /* PyDictVersioning (used by GetModuleGlobalName) */
  13358. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  13359. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  13360. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13361. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  13362. }
  13363. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  13364. PyObject **dictptr = NULL;
  13365. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  13366. if (offset) {
  13367. #if CYTHON_COMPILING_IN_CPYTHON
  13368. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  13369. #else
  13370. dictptr = _PyObject_GetDictPtr(obj);
  13371. #endif
  13372. }
  13373. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  13374. }
  13375. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  13376. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13377. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  13378. return 0;
  13379. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  13380. }
  13381. #endif
  13382. /* GetModuleGlobalName */
  13383. #if CYTHON_USE_DICT_VERSIONS
  13384. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  13385. #else
  13386. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  13387. #endif
  13388. {
  13389. PyObject *result;
  13390. #if CYTHON_COMPILING_IN_LIMITED_API
  13391. if (unlikely(!__pyx_m)) {
  13392. if (!PyErr_Occurred())
  13393. PyErr_SetNone(PyExc_NameError);
  13394. return NULL;
  13395. }
  13396. result = PyObject_GetAttr(__pyx_m, name);
  13397. if (likely(result)) {
  13398. return result;
  13399. }
  13400. PyErr_Clear();
  13401. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  13402. if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
  13403. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  13404. if (likely(result)) {
  13405. return result;
  13406. }
  13407. #else
  13408. result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
  13409. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  13410. if (likely(result)) {
  13411. return __Pyx_NewRef(result);
  13412. }
  13413. PyErr_Clear();
  13414. #endif
  13415. return __Pyx_GetBuiltinName(name);
  13416. }
  13417. /* RaiseUnboundLocalError */
  13418. static void __Pyx_RaiseUnboundLocalError(const char *varname) {
  13419. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  13420. }
  13421. /* RaiseTooManyValuesToUnpack */
  13422. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  13423. PyErr_Format(PyExc_ValueError,
  13424. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  13425. }
  13426. /* RaiseNeedMoreValuesToUnpack */
  13427. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  13428. PyErr_Format(PyExc_ValueError,
  13429. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  13430. index, (index == 1) ? "" : "s");
  13431. }
  13432. /* IterFinish */
  13433. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  13434. PyObject* exc_type;
  13435. __Pyx_PyThreadState_declare
  13436. __Pyx_PyThreadState_assign
  13437. exc_type = __Pyx_PyErr_CurrentExceptionType();
  13438. if (unlikely(exc_type)) {
  13439. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  13440. return -1;
  13441. __Pyx_PyErr_Clear();
  13442. return 0;
  13443. }
  13444. return 0;
  13445. }
  13446. /* UnpackItemEndCheck */
  13447. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  13448. if (unlikely(retval)) {
  13449. Py_DECREF(retval);
  13450. __Pyx_RaiseTooManyValuesError(expected);
  13451. return -1;
  13452. }
  13453. return __Pyx_IterFinish();
  13454. }
  13455. /* py_abs */
  13456. #if CYTHON_USE_PYLONG_INTERNALS
  13457. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  13458. #if PY_VERSION_HEX >= 0x030C00A7
  13459. if (likely(__Pyx_PyLong_IsCompact(n))) {
  13460. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  13461. }
  13462. #else
  13463. if (likely(Py_SIZE(n) == -1)) {
  13464. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  13465. }
  13466. #endif
  13467. #if CYTHON_COMPILING_IN_CPYTHON
  13468. {
  13469. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  13470. if (likely(copy)) {
  13471. #if PY_VERSION_HEX >= 0x030C00A7
  13472. ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
  13473. #else
  13474. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  13475. #endif
  13476. }
  13477. return copy;
  13478. }
  13479. #else
  13480. return PyNumber_Negative(n);
  13481. #endif
  13482. }
  13483. #endif
  13484. /* RaiseClosureNameError */
  13485. static void __Pyx_RaiseClosureNameError(const char *varname) {
  13486. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  13487. }
  13488. /* GetException (used by pep479) */
  13489. #if CYTHON_FAST_THREAD_STATE
  13490. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  13491. #else
  13492. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  13493. #endif
  13494. {
  13495. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  13496. #if CYTHON_FAST_THREAD_STATE
  13497. PyObject *tmp_type, *tmp_value, *tmp_tb;
  13498. #if PY_VERSION_HEX >= 0x030C0000
  13499. local_value = tstate->current_exception;
  13500. tstate->current_exception = 0;
  13501. #else
  13502. local_type = tstate->curexc_type;
  13503. local_value = tstate->curexc_value;
  13504. local_tb = tstate->curexc_traceback;
  13505. tstate->curexc_type = 0;
  13506. tstate->curexc_value = 0;
  13507. tstate->curexc_traceback = 0;
  13508. #endif
  13509. #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13510. local_value = PyErr_GetRaisedException();
  13511. #else
  13512. PyErr_Fetch(&local_type, &local_value, &local_tb);
  13513. #endif
  13514. #if __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13515. if (likely(local_value)) {
  13516. local_type = (PyObject*) Py_TYPE(local_value);
  13517. Py_INCREF(local_type);
  13518. local_tb = PyException_GetTraceback(local_value);
  13519. }
  13520. #else
  13521. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  13522. #if CYTHON_FAST_THREAD_STATE
  13523. if (unlikely(tstate->curexc_type))
  13524. #else
  13525. if (unlikely(PyErr_Occurred()))
  13526. #endif
  13527. goto bad;
  13528. if (local_tb) {
  13529. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  13530. goto bad;
  13531. }
  13532. #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13533. Py_XINCREF(local_tb);
  13534. Py_XINCREF(local_type);
  13535. Py_XINCREF(local_value);
  13536. *type = local_type;
  13537. *value = local_value;
  13538. *tb = local_tb;
  13539. #if CYTHON_FAST_THREAD_STATE
  13540. #if CYTHON_USE_EXC_INFO_STACK
  13541. {
  13542. _PyErr_StackItem *exc_info = tstate->exc_info;
  13543. #if PY_VERSION_HEX >= 0x030B00a4
  13544. tmp_value = exc_info->exc_value;
  13545. exc_info->exc_value = local_value;
  13546. tmp_type = NULL;
  13547. tmp_tb = NULL;
  13548. Py_XDECREF(local_type);
  13549. Py_XDECREF(local_tb);
  13550. #else
  13551. tmp_type = exc_info->exc_type;
  13552. tmp_value = exc_info->exc_value;
  13553. tmp_tb = exc_info->exc_traceback;
  13554. exc_info->exc_type = local_type;
  13555. exc_info->exc_value = local_value;
  13556. exc_info->exc_traceback = local_tb;
  13557. #endif
  13558. }
  13559. #else
  13560. tmp_type = tstate->exc_type;
  13561. tmp_value = tstate->exc_value;
  13562. tmp_tb = tstate->exc_traceback;
  13563. tstate->exc_type = local_type;
  13564. tstate->exc_value = local_value;
  13565. tstate->exc_traceback = local_tb;
  13566. #endif
  13567. Py_XDECREF(tmp_type);
  13568. Py_XDECREF(tmp_value);
  13569. Py_XDECREF(tmp_tb);
  13570. #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  13571. PyErr_SetHandledException(local_value);
  13572. Py_XDECREF(local_value);
  13573. Py_XDECREF(local_type);
  13574. Py_XDECREF(local_tb);
  13575. #else
  13576. PyErr_SetExcInfo(local_type, local_value, local_tb);
  13577. #endif
  13578. return 0;
  13579. #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
  13580. bad:
  13581. *type = 0;
  13582. *value = 0;
  13583. *tb = 0;
  13584. Py_XDECREF(local_type);
  13585. Py_XDECREF(local_value);
  13586. Py_XDECREF(local_tb);
  13587. return -1;
  13588. #endif
  13589. }
  13590. /* pep479 */
  13591. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  13592. PyObject *exc, *val, *tb, *cur_exc, *new_exc;
  13593. __Pyx_PyThreadState_declare
  13594. int is_async_stopiteration = 0;
  13595. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  13596. __Pyx_PyThreadState_assign
  13597. cur_exc = __Pyx_PyErr_CurrentExceptionType();
  13598. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  13599. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
  13600. is_async_stopiteration = 1;
  13601. } else {
  13602. return;
  13603. }
  13604. }
  13605. __Pyx_GetException(&exc, &val, &tb);
  13606. Py_XDECREF(exc);
  13607. Py_XDECREF(tb);
  13608. new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
  13609. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  13610. in_async_gen ? "async generator raised StopIteration" :
  13611. "generator raised StopIteration");
  13612. if (!new_exc) {
  13613. Py_XDECREF(val);
  13614. return;
  13615. }
  13616. PyException_SetCause(new_exc, val); // steals ref to val
  13617. PyErr_SetObject(PyExc_RuntimeError, new_exc);
  13618. }
  13619. /* ArgTypeTestFunc (used by ArgTypeTest) */
  13620. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  13621. {
  13622. __Pyx_TypeName type_name;
  13623. __Pyx_TypeName obj_type_name;
  13624. PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
  13625. int from_annotation_subclass = 0;
  13626. if (unlikely(!type)) {
  13627. PyErr_SetString(PyExc_SystemError, "Missing type object");
  13628. return 0;
  13629. }
  13630. else if (!exact) {
  13631. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  13632. } else if (exact == 2) {
  13633. if (__Pyx_TypeCheck(obj, type)) {
  13634. from_annotation_subclass = 1;
  13635. extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
  13636. }
  13637. }
  13638. type_name = __Pyx_PyType_GetFullyQualifiedName(type);
  13639. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13640. PyErr_Format(PyExc_TypeError,
  13641. "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
  13642. ", got " __Pyx_FMT_TYPENAME ")"
  13643. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  13644. "%s%U"
  13645. #endif
  13646. , name, type_name, obj_type_name
  13647. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  13648. , (from_annotation_subclass ? ". " : ""), extra_info
  13649. #endif
  13650. );
  13651. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  13652. if (exact == 2 && from_annotation_subclass) {
  13653. PyObject *res;
  13654. PyObject *vargs[2];
  13655. vargs[0] = PyErr_GetRaisedException();
  13656. vargs[1] = extra_info;
  13657. res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
  13658. Py_XDECREF(res);
  13659. PyErr_SetRaisedException(vargs[0]);
  13660. }
  13661. #endif
  13662. __Pyx_DECREF_TypeName(type_name);
  13663. __Pyx_DECREF_TypeName(obj_type_name);
  13664. return 0;
  13665. }
  13666. /* DictGetItem */
  13667. #if !CYTHON_COMPILING_IN_PYPY
  13668. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  13669. PyObject *value;
  13670. if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
  13671. if (unlikely(PyTuple_Check(key))) {
  13672. PyObject* args = PyTuple_Pack(1, key);
  13673. if (likely(args)) {
  13674. PyErr_SetObject(PyExc_KeyError, args);
  13675. Py_DECREF(args);
  13676. }
  13677. } else {
  13678. PyErr_SetObject(PyExc_KeyError, key);
  13679. }
  13680. }
  13681. return value;
  13682. }
  13683. #endif
  13684. /* PyObjectCallNoArg (used by pyfrozenset_new) */
  13685. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  13686. PyObject *arg[2] = {NULL, NULL};
  13687. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  13688. }
  13689. /* pyfrozenset_new (used by PySetContains) */
  13690. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  13691. if (it) {
  13692. PyObject* result;
  13693. #if CYTHON_COMPILING_IN_PYPY
  13694. PyObject* args;
  13695. args = PyTuple_Pack(1, it);
  13696. if (unlikely(!args))
  13697. return NULL;
  13698. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  13699. Py_DECREF(args);
  13700. return result;
  13701. #else
  13702. if (PyFrozenSet_CheckExact(it)) {
  13703. Py_INCREF(it);
  13704. return it;
  13705. }
  13706. result = PyFrozenSet_New(it);
  13707. if (unlikely(!result))
  13708. return NULL;
  13709. if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  13710. #if CYTHON_COMPILING_IN_LIMITED_API
  13711. || __Pyx_get_runtime_version() >= 0x030A0000
  13712. #endif
  13713. )
  13714. return result;
  13715. {
  13716. Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
  13717. if (likely(size > 0))
  13718. return result;
  13719. #if !CYTHON_ASSUME_SAFE_SIZE
  13720. if (unlikely(size < 0)) {
  13721. Py_DECREF(result);
  13722. return NULL;
  13723. }
  13724. #endif
  13725. }
  13726. Py_DECREF(result);
  13727. #endif
  13728. }
  13729. return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
  13730. }
  13731. /* PySetContains */
  13732. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  13733. int result = -1;
  13734. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  13735. PyObject *tmpkey;
  13736. PyErr_Clear();
  13737. tmpkey = __Pyx_PyFrozenSet_New(key);
  13738. if (tmpkey != NULL) {
  13739. result = PySet_Contains(set, tmpkey);
  13740. Py_DECREF(tmpkey);
  13741. }
  13742. }
  13743. return result;
  13744. }
  13745. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  13746. int result = PySet_Contains(set, key);
  13747. if (unlikely(result < 0)) {
  13748. result = __Pyx_PySet_ContainsUnhashable(set, key);
  13749. }
  13750. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  13751. }
  13752. /* pybuiltin_invalid (used by pyint_simplify) */
  13753. static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
  13754. __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13755. if (argname) {
  13756. PyErr_Format(PyExc_TypeError,
  13757. "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
  13758. argname, type_name, obj_type_name
  13759. );
  13760. } else {
  13761. PyErr_Format(PyExc_TypeError,
  13762. "Expected %.200s, got " __Pyx_FMT_TYPENAME,
  13763. type_name, obj_type_name
  13764. );
  13765. }
  13766. __Pyx_DECREF_TypeName(obj_type_name);
  13767. }
  13768. /* pyint_simplify */
  13769. static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
  13770. PyObject *number = *number_var;
  13771. if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
  13772. return 0;
  13773. }
  13774. PyObject *int_object;
  13775. if (likely(PyNumber_Check(number))) {
  13776. int_object = PyNumber_Long(number);
  13777. if (unlikely(!int_object)) goto bad;
  13778. } else {
  13779. __Pyx_PyBuiltin_Invalid(number, "int", argname);
  13780. goto bad;
  13781. }
  13782. *number_var = int_object;
  13783. Py_DECREF(number);
  13784. return 0;
  13785. bad:
  13786. *number_var = NULL;
  13787. Py_DECREF(number);
  13788. return -1;
  13789. }
  13790. /* SliceTupleAndList */
  13791. #if CYTHON_COMPILING_IN_CPYTHON
  13792. static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
  13793. Py_ssize_t start = *_start, stop = *_stop, length = *_length;
  13794. if (start < 0) {
  13795. start += length;
  13796. if (start < 0)
  13797. start = 0;
  13798. }
  13799. if (stop < 0)
  13800. stop += length;
  13801. else if (stop > length)
  13802. stop = length;
  13803. *_length = stop - start;
  13804. *_start = start;
  13805. *_stop = stop;
  13806. }
  13807. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
  13808. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13809. Py_ssize_t length = PyTuple_GET_SIZE(src);
  13810. __Pyx_crop_slice(&start, &stop, &length);
  13811. return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
  13812. }
  13813. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked(
  13814. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13815. Py_ssize_t length = PyList_GET_SIZE(src);
  13816. __Pyx_crop_slice(&start, &stop, &length);
  13817. if (length <= 0) {
  13818. return PyList_New(0);
  13819. }
  13820. return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
  13821. }
  13822. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
  13823. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13824. PyObject *result;
  13825. __Pyx_BEGIN_CRITICAL_SECTION(src);
  13826. result = __Pyx_PyList_GetSlice_locked(src, start, stop);
  13827. __Pyx_END_CRITICAL_SECTION();
  13828. return result;
  13829. }
  13830. #endif // CYTHON_COMPILING_IN_CPYTHON
  13831. /* set_iter */
  13832. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  13833. Py_ssize_t* p_orig_length, int* p_source_is_set) {
  13834. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13835. is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
  13836. *p_source_is_set = is_set;
  13837. if (likely(is_set)) {
  13838. *p_orig_length = PySet_Size(iterable);
  13839. Py_INCREF(iterable);
  13840. return iterable;
  13841. }
  13842. #else
  13843. CYTHON_UNUSED_VAR(is_set);
  13844. *p_source_is_set = 0;
  13845. #endif
  13846. *p_orig_length = 0;
  13847. return PyObject_GetIter(iterable);
  13848. }
  13849. static CYTHON_INLINE int __Pyx_set_iter_next(
  13850. PyObject* iter_obj, Py_ssize_t orig_length,
  13851. Py_ssize_t* ppos, PyObject **value,
  13852. int source_is_set) {
  13853. if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
  13854. *value = PyIter_Next(iter_obj);
  13855. if (unlikely(!*value)) {
  13856. return __Pyx_IterFinish();
  13857. }
  13858. CYTHON_UNUSED_VAR(orig_length);
  13859. CYTHON_UNUSED_VAR(ppos);
  13860. return 1;
  13861. }
  13862. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13863. if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
  13864. PyErr_SetString(
  13865. PyExc_RuntimeError,
  13866. "set changed size during iteration");
  13867. return -1;
  13868. }
  13869. {
  13870. Py_hash_t hash;
  13871. int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
  13872. assert (ret != -1);
  13873. if (likely(ret)) {
  13874. Py_INCREF(*value);
  13875. return 1;
  13876. }
  13877. }
  13878. #endif
  13879. return 0;
  13880. }
  13881. /* PyLongCompare */
  13882. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  13883. CYTHON_MAYBE_UNUSED_VAR(intval);
  13884. CYTHON_UNUSED_VAR(inplace);
  13885. if (op1 == op2) {
  13886. return 1;
  13887. }
  13888. #if CYTHON_USE_PYLONG_INTERNALS
  13889. if (likely(PyLong_CheckExact(op1))) {
  13890. int unequal;
  13891. unsigned long uintval;
  13892. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13893. const digit* digits = __Pyx_PyLong_Digits(op1);
  13894. if (intval == 0) {
  13895. return (__Pyx_PyLong_IsZero(op1) == 1);
  13896. } else if (intval < 0) {
  13897. if (__Pyx_PyLong_IsNonNeg(op1))
  13898. return 0;
  13899. intval = -intval;
  13900. } else {
  13901. if (__Pyx_PyLong_IsNeg(op1))
  13902. return 0;
  13903. }
  13904. uintval = (unsigned long) intval;
  13905. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  13906. if (uintval >> (PyLong_SHIFT * 4)) {
  13907. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13908. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13909. } else
  13910. #endif
  13911. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  13912. if (uintval >> (PyLong_SHIFT * 3)) {
  13913. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13914. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13915. } else
  13916. #endif
  13917. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  13918. if (uintval >> (PyLong_SHIFT * 2)) {
  13919. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13920. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13921. } else
  13922. #endif
  13923. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  13924. if (uintval >> (PyLong_SHIFT * 1)) {
  13925. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13926. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13927. } else
  13928. #endif
  13929. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  13930. return (unequal == 0);
  13931. }
  13932. #endif
  13933. if (PyFloat_CheckExact(op1)) {
  13934. const long b = intval;
  13935. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  13936. return ((double)a == (double)b);
  13937. }
  13938. return __Pyx_PyObject_IsTrueAndDecref(
  13939. PyObject_RichCompare(op1, op2, Py_EQ));
  13940. }
  13941. /* py_set_discard_unhashable (used by py_set_remove) */
  13942. static int __Pyx_PySet_DiscardUnhashable(PyObject *set, PyObject *key) {
  13943. PyObject *tmpkey;
  13944. int rv;
  13945. if (likely(!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)))
  13946. return -1;
  13947. PyErr_Clear();
  13948. tmpkey = __Pyx_PyFrozenSet_New(key);
  13949. if (tmpkey == NULL)
  13950. return -1;
  13951. rv = PySet_Discard(set, tmpkey);
  13952. Py_DECREF(tmpkey);
  13953. return rv;
  13954. }
  13955. /* py_set_remove */
  13956. static int __Pyx_PySet_RemoveNotFound(PyObject *set, PyObject *key, int found) {
  13957. if (unlikely(found < 0)) {
  13958. found = __Pyx_PySet_DiscardUnhashable(set, key);
  13959. }
  13960. if (likely(found == 0)) {
  13961. PyObject *tup;
  13962. tup = PyTuple_Pack(1, key);
  13963. if (!tup)
  13964. return -1;
  13965. PyErr_SetObject(PyExc_KeyError, tup);
  13966. Py_DECREF(tup);
  13967. return -1;
  13968. }
  13969. return found;
  13970. }
  13971. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key) {
  13972. int found = PySet_Discard(set, key);
  13973. if (unlikely(found != 1)) {
  13974. return __Pyx_PySet_RemoveNotFound(set, key, found);
  13975. }
  13976. return 0;
  13977. }
  13978. /* AllocateExtensionType */
  13979. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
  13980. if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
  13981. allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
  13982. return alloc_func(t, 0);
  13983. } else {
  13984. newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
  13985. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  13986. if (!tp_new) {
  13987. PyObject *new_str = PyUnicode_FromString("__new__");
  13988. if (likely(new_str)) {
  13989. PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
  13990. Py_DECREF(new_str);
  13991. return o;
  13992. } else
  13993. return NULL;
  13994. } else
  13995. #endif
  13996. return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  13997. }
  13998. }
  13999. /* CallTypeTraverse */
  14000. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  14001. #else
  14002. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
  14003. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
  14004. if (__Pyx_get_runtime_version() < 0x03090000) return 0;
  14005. #endif
  14006. if (!always_call) {
  14007. PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
  14008. unsigned long flags = PyType_GetFlags(base);
  14009. if (flags & Py_TPFLAGS_HEAPTYPE) {
  14010. return 0;
  14011. }
  14012. }
  14013. Py_VISIT((PyObject*)Py_TYPE(o));
  14014. return 0;
  14015. }
  14016. #endif
  14017. /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
  14018. #if CYTHON_COMPILING_IN_LIMITED_API
  14019. static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
  14020. PyObject *tp_dictoffset_o;
  14021. Py_ssize_t tp_dictoffset;
  14022. tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
  14023. if (unlikely(!tp_dictoffset_o)) return -1;
  14024. tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
  14025. Py_DECREF(tp_dictoffset_o);
  14026. if (unlikely(tp_dictoffset == 0)) {
  14027. PyErr_SetString(
  14028. PyExc_TypeError,
  14029. "'type' doesn't have a dictoffset");
  14030. return -1;
  14031. } else if (unlikely(tp_dictoffset < 0)) {
  14032. PyErr_SetString(
  14033. PyExc_TypeError,
  14034. "'type' has an unexpected negative dictoffset. "
  14035. "Please report this as Cython bug");
  14036. return -1;
  14037. }
  14038. return tp_dictoffset;
  14039. }
  14040. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
  14041. static Py_ssize_t tp_dictoffset = 0;
  14042. if (unlikely(tp_dictoffset == 0)) {
  14043. tp_dictoffset = __Pyx_GetTypeDictOffset();
  14044. if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
  14045. tp_dictoffset = 0; // try again next time?
  14046. return NULL;
  14047. }
  14048. }
  14049. return *(PyObject**)((char*)tp + tp_dictoffset);
  14050. }
  14051. #endif
  14052. /* SetItemOnTypeDict (used by FixUpExtensionType) */
  14053. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
  14054. int result;
  14055. PyObject *tp_dict;
  14056. #if CYTHON_COMPILING_IN_LIMITED_API
  14057. tp_dict = __Pyx_GetTypeDict(tp);
  14058. if (unlikely(!tp_dict)) return -1;
  14059. #else
  14060. tp_dict = tp->tp_dict;
  14061. #endif
  14062. result = PyDict_SetItem(tp_dict, k, v);
  14063. if (likely(!result)) {
  14064. PyType_Modified(tp);
  14065. if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
  14066. PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL);
  14067. if (!setNameResult) return -1;
  14068. Py_DECREF(setNameResult);
  14069. }
  14070. }
  14071. return result;
  14072. }
  14073. /* FixUpExtensionType */
  14074. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  14075. #if __PYX_LIMITED_VERSION_HEX > 0x030900B1
  14076. CYTHON_UNUSED_VAR(spec);
  14077. CYTHON_UNUSED_VAR(type);
  14078. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14079. #else
  14080. const PyType_Slot *slot = spec->slots;
  14081. int changed = 0;
  14082. #if !CYTHON_COMPILING_IN_LIMITED_API
  14083. while (slot && slot->slot && slot->slot != Py_tp_members)
  14084. slot++;
  14085. if (slot && slot->slot == Py_tp_members) {
  14086. #if !CYTHON_COMPILING_IN_CPYTHON
  14087. const
  14088. #endif // !CYTHON_COMPILING_IN_CPYTHON)
  14089. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  14090. while (memb && memb->name) {
  14091. if (memb->name[0] == '_' && memb->name[1] == '_') {
  14092. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  14093. assert(memb->type == T_PYSSIZET);
  14094. assert(memb->flags == READONLY);
  14095. type->tp_weaklistoffset = memb->offset;
  14096. changed = 1;
  14097. }
  14098. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  14099. assert(memb->type == T_PYSSIZET);
  14100. assert(memb->flags == READONLY);
  14101. type->tp_dictoffset = memb->offset;
  14102. changed = 1;
  14103. }
  14104. #if CYTHON_METH_FASTCALL
  14105. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  14106. assert(memb->type == T_PYSSIZET);
  14107. assert(memb->flags == READONLY);
  14108. type->tp_vectorcall_offset = memb->offset;
  14109. changed = 1;
  14110. }
  14111. #endif // CYTHON_METH_FASTCALL
  14112. #if !CYTHON_COMPILING_IN_PYPY
  14113. else if (strcmp(memb->name, "__module__") == 0) {
  14114. PyObject *descr;
  14115. assert(memb->type == T_OBJECT);
  14116. assert(memb->flags == 0 || memb->flags == READONLY);
  14117. descr = PyDescr_NewMember(type, memb);
  14118. if (unlikely(!descr))
  14119. return -1;
  14120. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  14121. Py_DECREF(descr);
  14122. if (unlikely(set_item_result < 0)) {
  14123. return -1;
  14124. }
  14125. changed = 1;
  14126. }
  14127. #endif // !CYTHON_COMPILING_IN_PYPY
  14128. }
  14129. memb++;
  14130. }
  14131. }
  14132. #endif // !CYTHON_COMPILING_IN_LIMITED_API
  14133. #if !CYTHON_COMPILING_IN_PYPY
  14134. slot = spec->slots;
  14135. while (slot && slot->slot && slot->slot != Py_tp_getset)
  14136. slot++;
  14137. if (slot && slot->slot == Py_tp_getset) {
  14138. PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
  14139. while (getset && getset->name) {
  14140. if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
  14141. PyObject *descr = PyDescr_NewGetSet(type, getset);
  14142. if (unlikely(!descr))
  14143. return -1;
  14144. #if CYTHON_COMPILING_IN_LIMITED_API
  14145. PyObject *pyname = PyUnicode_FromString(getset->name);
  14146. if (unlikely(!pyname)) {
  14147. Py_DECREF(descr);
  14148. return -1;
  14149. }
  14150. int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
  14151. Py_DECREF(pyname);
  14152. #else
  14153. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14154. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  14155. #endif
  14156. Py_DECREF(descr);
  14157. if (unlikely(set_item_result < 0)) {
  14158. return -1;
  14159. }
  14160. changed = 1;
  14161. }
  14162. ++getset;
  14163. }
  14164. }
  14165. #else
  14166. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14167. #endif // !CYTHON_COMPILING_IN_PYPY
  14168. if (changed)
  14169. PyType_Modified(type);
  14170. #endif // PY_VERSION_HEX > 0x030900B1
  14171. return 0;
  14172. }
  14173. /* PyObjectGetMethod (used by PyObjectCallMethod0) */
  14174. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  14175. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  14176. PyObject *attr;
  14177. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  14178. __Pyx_TypeName type_name;
  14179. PyTypeObject *tp = Py_TYPE(obj);
  14180. PyObject *descr;
  14181. descrgetfunc f = NULL;
  14182. PyObject **dictptr, *dict;
  14183. int meth_found = 0;
  14184. assert (*method == NULL);
  14185. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  14186. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14187. goto try_unpack;
  14188. }
  14189. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  14190. return 0;
  14191. }
  14192. descr = _PyType_Lookup(tp, name);
  14193. if (likely(descr != NULL)) {
  14194. Py_INCREF(descr);
  14195. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  14196. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  14197. #else
  14198. #ifdef __Pyx_CyFunction_USED
  14199. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  14200. #else
  14201. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  14202. #endif
  14203. #endif
  14204. {
  14205. meth_found = 1;
  14206. } else {
  14207. f = Py_TYPE(descr)->tp_descr_get;
  14208. if (f != NULL && PyDescr_IsData(descr)) {
  14209. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14210. Py_DECREF(descr);
  14211. goto try_unpack;
  14212. }
  14213. }
  14214. }
  14215. dictptr = _PyObject_GetDictPtr(obj);
  14216. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  14217. Py_INCREF(dict);
  14218. attr = __Pyx_PyDict_GetItemStr(dict, name);
  14219. if (attr != NULL) {
  14220. Py_INCREF(attr);
  14221. Py_DECREF(dict);
  14222. Py_XDECREF(descr);
  14223. goto try_unpack;
  14224. }
  14225. Py_DECREF(dict);
  14226. }
  14227. if (meth_found) {
  14228. *method = descr;
  14229. return 1;
  14230. }
  14231. if (f != NULL) {
  14232. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14233. Py_DECREF(descr);
  14234. goto try_unpack;
  14235. }
  14236. if (likely(descr != NULL)) {
  14237. *method = descr;
  14238. return 0;
  14239. }
  14240. type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
  14241. PyErr_Format(PyExc_AttributeError,
  14242. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  14243. type_name, name);
  14244. __Pyx_DECREF_TypeName(type_name);
  14245. return 0;
  14246. #else
  14247. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14248. goto try_unpack;
  14249. #endif
  14250. try_unpack:
  14251. #if CYTHON_UNPACK_METHODS
  14252. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  14253. PyObject *function = PyMethod_GET_FUNCTION(attr);
  14254. Py_INCREF(function);
  14255. Py_DECREF(attr);
  14256. *method = function;
  14257. return 1;
  14258. }
  14259. #endif
  14260. *method = attr;
  14261. return 0;
  14262. }
  14263. #endif
  14264. /* PyObjectCallMethod0 (used by PyType_Ready) */
  14265. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  14266. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  14267. PyObject *args[1] = {obj};
  14268. (void) __Pyx_PyObject_CallOneArg;
  14269. (void) __Pyx_PyObject_CallNoArg;
  14270. return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  14271. #else
  14272. PyObject *method = NULL, *result = NULL;
  14273. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  14274. if (likely(is_method)) {
  14275. result = __Pyx_PyObject_CallOneArg(method, obj);
  14276. Py_DECREF(method);
  14277. return result;
  14278. }
  14279. if (unlikely(!method)) goto bad;
  14280. result = __Pyx_PyObject_CallNoArg(method);
  14281. Py_DECREF(method);
  14282. bad:
  14283. return result;
  14284. #endif
  14285. }
  14286. /* ValidateBasesTuple (used by PyType_Ready) */
  14287. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  14288. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  14289. Py_ssize_t i, n;
  14290. #if CYTHON_ASSUME_SAFE_SIZE
  14291. n = PyTuple_GET_SIZE(bases);
  14292. #else
  14293. n = PyTuple_Size(bases);
  14294. if (unlikely(n < 0)) return -1;
  14295. #endif
  14296. for (i = 1; i < n; i++)
  14297. {
  14298. PyTypeObject *b;
  14299. #if CYTHON_AVOID_BORROWED_REFS
  14300. PyObject *b0 = PySequence_GetItem(bases, i);
  14301. if (!b0) return -1;
  14302. #elif CYTHON_ASSUME_SAFE_MACROS
  14303. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  14304. #else
  14305. PyObject *b0 = PyTuple_GetItem(bases, i);
  14306. if (!b0) return -1;
  14307. #endif
  14308. b = (PyTypeObject*) b0;
  14309. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  14310. {
  14311. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  14312. PyErr_Format(PyExc_TypeError,
  14313. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  14314. __Pyx_DECREF_TypeName(b_name);
  14315. #if CYTHON_AVOID_BORROWED_REFS
  14316. Py_DECREF(b0);
  14317. #endif
  14318. return -1;
  14319. }
  14320. if (dictoffset == 0)
  14321. {
  14322. Py_ssize_t b_dictoffset = 0;
  14323. #if CYTHON_USE_TYPE_SLOTS
  14324. b_dictoffset = b->tp_dictoffset;
  14325. #else
  14326. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  14327. if (!py_b_dictoffset) goto dictoffset_return;
  14328. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  14329. Py_DECREF(py_b_dictoffset);
  14330. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  14331. #endif
  14332. if (b_dictoffset) {
  14333. {
  14334. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  14335. PyErr_Format(PyExc_TypeError,
  14336. "extension type '%.200s' has no __dict__ slot, "
  14337. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  14338. "either add 'cdef dict __dict__' to the extension type "
  14339. "or add '__slots__ = [...]' to the base type",
  14340. type_name, b_name);
  14341. __Pyx_DECREF_TypeName(b_name);
  14342. }
  14343. #if !CYTHON_USE_TYPE_SLOTS
  14344. dictoffset_return:
  14345. #endif
  14346. #if CYTHON_AVOID_BORROWED_REFS
  14347. Py_DECREF(b0);
  14348. #endif
  14349. return -1;
  14350. }
  14351. }
  14352. #if CYTHON_AVOID_BORROWED_REFS
  14353. Py_DECREF(b0);
  14354. #endif
  14355. }
  14356. return 0;
  14357. }
  14358. #endif
  14359. /* PyType_Ready */
  14360. CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
  14361. while (t) {
  14362. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  14363. if (bases) {
  14364. return 1;
  14365. }
  14366. t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
  14367. }
  14368. return 0;
  14369. }
  14370. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  14371. #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
  14372. (void)__Pyx_PyObject_CallMethod0;
  14373. #if CYTHON_USE_TYPE_SPECS
  14374. (void)__Pyx_validate_bases_tuple;
  14375. #endif
  14376. return PyType_Ready(t);
  14377. #else
  14378. int r;
  14379. if (!__Pyx_PyType_HasMultipleInheritance(t)) {
  14380. return PyType_Ready(t);
  14381. }
  14382. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  14383. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  14384. return -1;
  14385. #if !defined(PYSTON_MAJOR_VERSION)
  14386. {
  14387. int gc_was_enabled;
  14388. #if PY_VERSION_HEX >= 0x030A00b1
  14389. gc_was_enabled = PyGC_Disable();
  14390. (void)__Pyx_PyObject_CallMethod0;
  14391. #else
  14392. PyObject *ret, *py_status;
  14393. PyObject *gc = NULL;
  14394. #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
  14395. !CYTHON_COMPILING_IN_GRAAL
  14396. gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
  14397. #endif
  14398. if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
  14399. if (unlikely(!gc)) return -1;
  14400. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
  14401. if (unlikely(!py_status)) {
  14402. Py_DECREF(gc);
  14403. return -1;
  14404. }
  14405. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  14406. Py_DECREF(py_status);
  14407. if (gc_was_enabled > 0) {
  14408. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
  14409. if (unlikely(!ret)) {
  14410. Py_DECREF(gc);
  14411. return -1;
  14412. }
  14413. Py_DECREF(ret);
  14414. } else if (unlikely(gc_was_enabled == -1)) {
  14415. Py_DECREF(gc);
  14416. return -1;
  14417. }
  14418. #endif
  14419. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  14420. #if PY_VERSION_HEX >= 0x030A0000
  14421. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  14422. #endif
  14423. #else
  14424. (void)__Pyx_PyObject_CallMethod0;
  14425. #endif
  14426. r = PyType_Ready(t);
  14427. #if !defined(PYSTON_MAJOR_VERSION)
  14428. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  14429. #if PY_VERSION_HEX >= 0x030A00b1
  14430. if (gc_was_enabled)
  14431. PyGC_Enable();
  14432. #else
  14433. if (gc_was_enabled) {
  14434. PyObject *tp, *v, *tb;
  14435. PyErr_Fetch(&tp, &v, &tb);
  14436. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
  14437. if (likely(ret || r == -1)) {
  14438. Py_XDECREF(ret);
  14439. PyErr_Restore(tp, v, tb);
  14440. } else {
  14441. Py_XDECREF(tp);
  14442. Py_XDECREF(v);
  14443. Py_XDECREF(tb);
  14444. r = -1;
  14445. }
  14446. }
  14447. Py_DECREF(gc);
  14448. #endif
  14449. }
  14450. #endif
  14451. return r;
  14452. #endif
  14453. }
  14454. /* HasAttr (used by ImportImpl) */
  14455. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  14456. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  14457. PyObject *r;
  14458. if (unlikely(!PyUnicode_Check(n))) {
  14459. PyErr_SetString(PyExc_TypeError,
  14460. "hasattr(): attribute name must be string");
  14461. return -1;
  14462. }
  14463. r = __Pyx_PyObject_GetAttrStrNoError(o, n);
  14464. if (!r) {
  14465. return (unlikely(PyErr_Occurred())) ? -1 : 0;
  14466. } else {
  14467. Py_DECREF(r);
  14468. return 1;
  14469. }
  14470. }
  14471. #endif
  14472. /* ImportImpl (used by Import) */
  14473. static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
  14474. PyObject *imported_module = PyImport_GetModule(qualname);
  14475. if (unlikely(!imported_module)) {
  14476. *module = NULL;
  14477. if (PyErr_Occurred()) {
  14478. return -1;
  14479. }
  14480. return 0;
  14481. }
  14482. *module = imported_module;
  14483. return 1;
  14484. }
  14485. static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
  14486. PyObject *imported_module;
  14487. PyObject *top_level_package_name;
  14488. Py_ssize_t i;
  14489. int status, module_found;
  14490. Py_ssize_t dot_index;
  14491. module_found = __Pyx__Import_GetModule(qualname, &imported_module);
  14492. if (unlikely(!module_found || module_found == -1)) {
  14493. *module = NULL;
  14494. return module_found;
  14495. }
  14496. if (imported_names) {
  14497. for (i = 0; i < len_imported_names; i++) {
  14498. PyObject *imported_name = imported_names[i];
  14499. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  14500. int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
  14501. #else
  14502. int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
  14503. if (unlikely(has_imported_attribute == -1)) goto error;
  14504. #endif
  14505. if (!has_imported_attribute) {
  14506. goto not_found;
  14507. }
  14508. }
  14509. *module = imported_module;
  14510. return 1;
  14511. }
  14512. dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
  14513. if (dot_index == -1) {
  14514. *module = imported_module;
  14515. return 1;
  14516. }
  14517. if (unlikely(dot_index == -2)) goto error;
  14518. top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
  14519. if (unlikely(!top_level_package_name)) goto error;
  14520. Py_DECREF(imported_module);
  14521. status = __Pyx__Import_GetModule(top_level_package_name, module);
  14522. Py_DECREF(top_level_package_name);
  14523. return status;
  14524. error:
  14525. Py_DECREF(imported_module);
  14526. *module = NULL;
  14527. return -1;
  14528. not_found:
  14529. Py_DECREF(imported_module);
  14530. *module = NULL;
  14531. return 0;
  14532. }
  14533. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
  14534. PyObject *module = 0;
  14535. PyObject *empty_dict = 0;
  14536. PyObject *from_list = 0;
  14537. int module_found;
  14538. if (!qualname) {
  14539. qualname = name;
  14540. }
  14541. module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
  14542. if (likely(module_found == 1)) {
  14543. return module;
  14544. } else if (unlikely(module_found == -1)) {
  14545. return NULL;
  14546. }
  14547. empty_dict = PyDict_New();
  14548. if (unlikely(!empty_dict))
  14549. goto bad;
  14550. if (imported_names) {
  14551. #if CYTHON_COMPILING_IN_CPYTHON
  14552. from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
  14553. if (unlikely(!from_list))
  14554. goto bad;
  14555. #else
  14556. from_list = PyList_New(len_imported_names);
  14557. if (unlikely(!from_list)) goto bad;
  14558. for (Py_ssize_t i=0; i<len_imported_names; ++i) {
  14559. if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
  14560. }
  14561. #endif
  14562. }
  14563. if (level == -1) {
  14564. const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
  14565. if (package_sep != (0)) {
  14566. module = PyImport_ImportModuleLevelObject(
  14567. name, moddict, empty_dict, from_list, 1);
  14568. if (unlikely(!module)) {
  14569. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  14570. goto bad;
  14571. PyErr_Clear();
  14572. }
  14573. }
  14574. level = 0;
  14575. }
  14576. if (!module) {
  14577. module = PyImport_ImportModuleLevelObject(
  14578. name, moddict, empty_dict, from_list, level);
  14579. }
  14580. bad:
  14581. Py_XDECREF(from_list);
  14582. Py_XDECREF(empty_dict);
  14583. return module;
  14584. }
  14585. /* Import */
  14586. static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
  14587. return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
  14588. }
  14589. /* ImportFrom */
  14590. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  14591. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  14592. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  14593. const char* module_name_str = 0;
  14594. PyObject* module_name = 0;
  14595. PyObject* module_dot = 0;
  14596. PyObject* full_name = 0;
  14597. PyErr_Clear();
  14598. module_name_str = PyModule_GetName(module);
  14599. if (unlikely(!module_name_str)) { goto modbad; }
  14600. module_name = PyUnicode_FromString(module_name_str);
  14601. if (unlikely(!module_name)) { goto modbad; }
  14602. module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_);
  14603. if (unlikely(!module_dot)) { goto modbad; }
  14604. full_name = PyUnicode_Concat(module_dot, name);
  14605. if (unlikely(!full_name)) { goto modbad; }
  14606. #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\
  14607. CYTHON_COMPILING_IN_GRAAL
  14608. {
  14609. PyObject *modules = PyImport_GetModuleDict();
  14610. if (unlikely(!modules))
  14611. goto modbad;
  14612. value = PyObject_GetItem(modules, full_name);
  14613. }
  14614. #else
  14615. value = PyImport_GetModule(full_name);
  14616. #endif
  14617. modbad:
  14618. Py_XDECREF(full_name);
  14619. Py_XDECREF(module_dot);
  14620. Py_XDECREF(module_name);
  14621. }
  14622. if (unlikely(!value)) {
  14623. PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
  14624. }
  14625. return value;
  14626. }
  14627. /* dict_setdefault (used by FetchCommonType) */
  14628. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
  14629. PyObject* value;
  14630. #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
  14631. PyDict_SetDefaultRef(d, key, default_value, &value);
  14632. #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  14633. PyObject *args[] = {d, key, default_value};
  14634. value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  14635. #elif CYTHON_COMPILING_IN_LIMITED_API
  14636. value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
  14637. #else
  14638. value = PyDict_SetDefault(d, key, default_value);
  14639. if (unlikely(!value)) return NULL;
  14640. Py_INCREF(value);
  14641. #endif
  14642. return value;
  14643. }
  14644. /* AddModuleRef (used by FetchSharedCythonModule) */
  14645. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  14646. static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
  14647. PyObject *module_dict = PyImport_GetModuleDict();
  14648. PyObject *m;
  14649. if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
  14650. return NULL;
  14651. }
  14652. if (m != NULL && PyModule_Check(m)) {
  14653. return m;
  14654. }
  14655. Py_XDECREF(m);
  14656. m = PyModule_NewObject(name);
  14657. if (m == NULL)
  14658. return NULL;
  14659. if (PyDict_CheckExact(module_dict)) {
  14660. PyObject *new_m;
  14661. (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
  14662. Py_DECREF(m);
  14663. return new_m;
  14664. } else {
  14665. if (PyObject_SetItem(module_dict, name, m) != 0) {
  14666. Py_DECREF(m);
  14667. return NULL;
  14668. }
  14669. return m;
  14670. }
  14671. }
  14672. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  14673. PyObject *py_name = PyUnicode_FromString(name);
  14674. if (!py_name) return NULL;
  14675. PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
  14676. Py_DECREF(py_name);
  14677. return module;
  14678. }
  14679. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  14680. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  14681. #else
  14682. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  14683. PyObject *module = PyImport_AddModule(name);
  14684. Py_XINCREF(module);
  14685. return module;
  14686. }
  14687. #endif
  14688. /* FetchSharedCythonModule (used by FetchCommonType) */
  14689. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  14690. return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
  14691. }
  14692. /* FetchCommonType (used by CommonTypesMetaclass) */
  14693. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  14694. static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  14695. PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
  14696. if (result && metaclass) {
  14697. PyObject *old_tp = (PyObject*)Py_TYPE(result);
  14698. Py_INCREF((PyObject*)metaclass);
  14699. #if __PYX_LIMITED_VERSION_HEX >= 0x03090000
  14700. Py_SET_TYPE(result, metaclass);
  14701. #else
  14702. result->ob_type = metaclass;
  14703. #endif
  14704. Py_DECREF(old_tp);
  14705. }
  14706. return result;
  14707. }
  14708. #else
  14709. #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
  14710. #endif
  14711. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  14712. const char *name,
  14713. Py_ssize_t expected_basicsize) {
  14714. Py_ssize_t basicsize;
  14715. if (!PyType_Check(cached_type)) {
  14716. PyErr_Format(PyExc_TypeError,
  14717. "Shared Cython type %.200s is not a type object", name);
  14718. return -1;
  14719. }
  14720. if (expected_basicsize == 0) {
  14721. return 0; // size is inherited, nothing useful to check
  14722. }
  14723. #if CYTHON_COMPILING_IN_LIMITED_API
  14724. PyObject *py_basicsize;
  14725. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  14726. if (unlikely(!py_basicsize)) return -1;
  14727. basicsize = PyLong_AsSsize_t(py_basicsize);
  14728. Py_DECREF(py_basicsize);
  14729. py_basicsize = NULL;
  14730. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
  14731. #else
  14732. basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
  14733. #endif
  14734. if (basicsize != expected_basicsize) {
  14735. PyErr_Format(PyExc_TypeError,
  14736. "Shared Cython type %.200s has the wrong size, try recompiling",
  14737. name);
  14738. return -1;
  14739. }
  14740. return 0;
  14741. }
  14742. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  14743. PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
  14744. int get_item_ref_result;
  14745. const char* object_name = strrchr(spec->name, '.');
  14746. object_name = object_name ? object_name+1 : spec->name;
  14747. py_object_name = PyUnicode_FromString(object_name);
  14748. if (!py_object_name) return NULL;
  14749. abi_module = __Pyx_FetchSharedCythonABIModule();
  14750. if (!abi_module) goto done;
  14751. abi_module_dict = PyModule_GetDict(abi_module);
  14752. if (!abi_module_dict) goto done;
  14753. get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
  14754. if (get_item_ref_result == 1) {
  14755. if (__Pyx_VerifyCachedType(
  14756. cached_type,
  14757. object_name,
  14758. spec->basicsize) < 0) {
  14759. goto bad;
  14760. }
  14761. goto done;
  14762. } else if (unlikely(get_item_ref_result == -1)) {
  14763. goto bad;
  14764. }
  14765. cached_type = __Pyx_PyType_FromMetaclass(
  14766. metaclass,
  14767. CYTHON_USE_MODULE_STATE ? module : abi_module,
  14768. spec, bases);
  14769. if (unlikely(!cached_type)) goto bad;
  14770. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  14771. new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
  14772. if (unlikely(new_cached_type != cached_type)) {
  14773. if (unlikely(!new_cached_type)) goto bad;
  14774. Py_DECREF(cached_type);
  14775. cached_type = new_cached_type;
  14776. if (__Pyx_VerifyCachedType(
  14777. cached_type,
  14778. object_name,
  14779. spec->basicsize) < 0) {
  14780. goto bad;
  14781. }
  14782. goto done;
  14783. } else {
  14784. Py_DECREF(new_cached_type);
  14785. }
  14786. done:
  14787. Py_XDECREF(abi_module);
  14788. Py_DECREF(py_object_name);
  14789. assert(cached_type == NULL || PyType_Check(cached_type));
  14790. return (PyTypeObject *) cached_type;
  14791. bad:
  14792. Py_XDECREF(cached_type);
  14793. cached_type = NULL;
  14794. goto done;
  14795. }
  14796. /* CommonTypesMetaclass (used by CythonFunctionShared) */
  14797. static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
  14798. return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
  14799. }
  14800. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  14801. static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
  14802. PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
  14803. return NULL;
  14804. }
  14805. static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
  14806. PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
  14807. return -1;
  14808. }
  14809. #endif
  14810. static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
  14811. {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
  14812. {0, 0, 0, 0, 0}
  14813. };
  14814. static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
  14815. {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
  14816. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  14817. {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
  14818. {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
  14819. {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
  14820. #endif
  14821. {0, 0}
  14822. };
  14823. static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
  14824. __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
  14825. 0,
  14826. 0,
  14827. Py_TPFLAGS_IMMUTABLETYPE |
  14828. Py_TPFLAGS_DISALLOW_INSTANTIATION |
  14829. Py_TPFLAGS_DEFAULT,
  14830. __pyx_CommonTypesMetaclass_slots
  14831. };
  14832. static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
  14833. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  14834. PyObject *bases = PyTuple_Pack(1, &PyType_Type);
  14835. if (unlikely(!bases)) {
  14836. return -1;
  14837. }
  14838. mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
  14839. Py_DECREF(bases);
  14840. if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
  14841. return -1;
  14842. }
  14843. return 0;
  14844. }
  14845. /* PyMethodNew (used by CythonFunctionShared) */
  14846. #if CYTHON_COMPILING_IN_LIMITED_API
  14847. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  14848. PyObject *result;
  14849. CYTHON_UNUSED_VAR(typ);
  14850. if (!self)
  14851. return __Pyx_NewRef(func);
  14852. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  14853. {
  14854. PyObject *args[] = {func, self};
  14855. result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
  14856. }
  14857. #else
  14858. result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
  14859. #endif
  14860. return result;
  14861. }
  14862. #else
  14863. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  14864. CYTHON_UNUSED_VAR(typ);
  14865. if (!self)
  14866. return __Pyx_NewRef(func);
  14867. return PyMethod_New(func, self);
  14868. }
  14869. #endif
  14870. /* PyVectorcallFastCallDict (used by CythonFunctionShared) */
  14871. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  14872. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14873. {
  14874. PyObject *res = NULL;
  14875. PyObject *kwnames;
  14876. PyObject **newargs;
  14877. PyObject **kwvalues;
  14878. Py_ssize_t i;
  14879. #if CYTHON_AVOID_BORROWED_REFS
  14880. PyObject *pos;
  14881. #else
  14882. Py_ssize_t pos;
  14883. #endif
  14884. size_t j;
  14885. PyObject *key, *value;
  14886. unsigned long keys_are_strings;
  14887. #if !CYTHON_ASSUME_SAFE_SIZE
  14888. Py_ssize_t nkw = PyDict_Size(kw);
  14889. if (unlikely(nkw == -1)) return NULL;
  14890. #else
  14891. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  14892. #endif
  14893. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  14894. if (unlikely(newargs == NULL)) {
  14895. PyErr_NoMemory();
  14896. return NULL;
  14897. }
  14898. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  14899. kwnames = PyTuple_New(nkw);
  14900. if (unlikely(kwnames == NULL)) {
  14901. PyMem_Free(newargs);
  14902. return NULL;
  14903. }
  14904. kwvalues = newargs + nargs;
  14905. pos = 0;
  14906. i = 0;
  14907. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  14908. while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
  14909. keys_are_strings &=
  14910. #if CYTHON_COMPILING_IN_LIMITED_API
  14911. PyType_GetFlags(Py_TYPE(key));
  14912. #else
  14913. Py_TYPE(key)->tp_flags;
  14914. #endif
  14915. #if !CYTHON_ASSUME_SAFE_MACROS
  14916. if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
  14917. #else
  14918. PyTuple_SET_ITEM(kwnames, i, key);
  14919. #endif
  14920. kwvalues[i] = value;
  14921. i++;
  14922. }
  14923. if (unlikely(!keys_are_strings)) {
  14924. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  14925. goto cleanup;
  14926. }
  14927. res = vc(func, newargs, nargs, kwnames);
  14928. cleanup:
  14929. #if CYTHON_AVOID_BORROWED_REFS
  14930. Py_DECREF(pos);
  14931. #endif
  14932. Py_DECREF(kwnames);
  14933. for (i = 0; i < nkw; i++)
  14934. Py_DECREF(kwvalues[i]);
  14935. PyMem_Free(newargs);
  14936. return res;
  14937. }
  14938. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14939. {
  14940. Py_ssize_t kw_size =
  14941. likely(kw == NULL) ?
  14942. 0 :
  14943. #if !CYTHON_ASSUME_SAFE_SIZE
  14944. PyDict_Size(kw);
  14945. #else
  14946. PyDict_GET_SIZE(kw);
  14947. #endif
  14948. if (kw_size == 0) {
  14949. return vc(func, args, nargs, NULL);
  14950. }
  14951. #if !CYTHON_ASSUME_SAFE_SIZE
  14952. else if (unlikely(kw_size == -1)) {
  14953. return NULL;
  14954. }
  14955. #endif
  14956. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  14957. }
  14958. #endif
  14959. /* CythonFunctionShared (used by CythonFunction) */
  14960. #if CYTHON_COMPILING_IN_LIMITED_API
  14961. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
  14962. if (__Pyx_CyFunction_Check(func)) {
  14963. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  14964. } else if (PyCFunction_Check(func)) {
  14965. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  14966. }
  14967. return 0;
  14968. }
  14969. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  14970. if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
  14971. int result;
  14972. PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
  14973. if (unlikely(!newFunc)) {
  14974. PyErr_Clear(); // It's only an optimization, so don't throw an error
  14975. return 0;
  14976. }
  14977. result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
  14978. Py_DECREF(newFunc);
  14979. return result;
  14980. }
  14981. return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
  14982. }
  14983. #else
  14984. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  14985. if (PyMethod_Check(func)) {
  14986. func = PyMethod_GET_FUNCTION(func);
  14987. }
  14988. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  14989. }
  14990. #endif
  14991. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  14992. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  14993. __Pyx_Py_XDECREF_SET(
  14994. __Pyx_CyFunction_GetClassObj(f),
  14995. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  14996. #else
  14997. __Pyx_Py_XDECREF_SET(
  14998. ((PyCMethodObject *) (f))->mm_class,
  14999. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  15000. #endif
  15001. }
  15002. static PyObject *
  15003. __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
  15004. {
  15005. if (unlikely(op->func_doc == NULL)) {
  15006. #if CYTHON_COMPILING_IN_LIMITED_API
  15007. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  15008. if (unlikely(!op->func_doc)) return NULL;
  15009. #else
  15010. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  15011. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  15012. if (unlikely(op->func_doc == NULL))
  15013. return NULL;
  15014. } else {
  15015. Py_INCREF(Py_None);
  15016. return Py_None;
  15017. }
  15018. #endif
  15019. }
  15020. Py_INCREF(op->func_doc);
  15021. return op->func_doc;
  15022. }
  15023. static PyObject *
  15024. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
  15025. PyObject *result;
  15026. CYTHON_UNUSED_VAR(closure);
  15027. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15028. result = __Pyx_CyFunction_get_doc_locked(op);
  15029. __Pyx_END_CRITICAL_SECTION();
  15030. return result;
  15031. }
  15032. static int
  15033. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15034. {
  15035. CYTHON_UNUSED_VAR(context);
  15036. if (value == NULL) {
  15037. value = Py_None;
  15038. }
  15039. Py_INCREF(value);
  15040. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15041. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  15042. __Pyx_END_CRITICAL_SECTION();
  15043. return 0;
  15044. }
  15045. static PyObject *
  15046. __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
  15047. {
  15048. if (unlikely(op->func_name == NULL)) {
  15049. #if CYTHON_COMPILING_IN_LIMITED_API
  15050. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  15051. #else
  15052. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  15053. #endif
  15054. if (unlikely(op->func_name == NULL))
  15055. return NULL;
  15056. }
  15057. Py_INCREF(op->func_name);
  15058. return op->func_name;
  15059. }
  15060. static PyObject *
  15061. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  15062. {
  15063. PyObject *result = NULL;
  15064. CYTHON_UNUSED_VAR(context);
  15065. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15066. result = __Pyx_CyFunction_get_name_locked(op);
  15067. __Pyx_END_CRITICAL_SECTION();
  15068. return result;
  15069. }
  15070. static int
  15071. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15072. {
  15073. CYTHON_UNUSED_VAR(context);
  15074. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  15075. PyErr_SetString(PyExc_TypeError,
  15076. "__name__ must be set to a string object");
  15077. return -1;
  15078. }
  15079. Py_INCREF(value);
  15080. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15081. __Pyx_Py_XDECREF_SET(op->func_name, value);
  15082. __Pyx_END_CRITICAL_SECTION();
  15083. return 0;
  15084. }
  15085. static PyObject *
  15086. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  15087. {
  15088. CYTHON_UNUSED_VAR(context);
  15089. PyObject *result;
  15090. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15091. Py_INCREF(op->func_qualname);
  15092. result = op->func_qualname;
  15093. __Pyx_END_CRITICAL_SECTION();
  15094. return result;
  15095. }
  15096. static int
  15097. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15098. {
  15099. CYTHON_UNUSED_VAR(context);
  15100. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  15101. PyErr_SetString(PyExc_TypeError,
  15102. "__qualname__ must be set to a string object");
  15103. return -1;
  15104. }
  15105. Py_INCREF(value);
  15106. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15107. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  15108. __Pyx_END_CRITICAL_SECTION();
  15109. return 0;
  15110. }
  15111. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15112. static PyObject *
  15113. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  15114. {
  15115. CYTHON_UNUSED_VAR(context);
  15116. if (unlikely(op->func_dict == NULL)) {
  15117. op->func_dict = PyDict_New();
  15118. if (unlikely(op->func_dict == NULL))
  15119. return NULL;
  15120. }
  15121. Py_INCREF(op->func_dict);
  15122. return op->func_dict;
  15123. }
  15124. #endif
  15125. static PyObject *
  15126. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  15127. {
  15128. CYTHON_UNUSED_VAR(context);
  15129. Py_INCREF(op->func_globals);
  15130. return op->func_globals;
  15131. }
  15132. static PyObject *
  15133. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  15134. {
  15135. CYTHON_UNUSED_VAR(op);
  15136. CYTHON_UNUSED_VAR(context);
  15137. Py_INCREF(Py_None);
  15138. return Py_None;
  15139. }
  15140. static PyObject *
  15141. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  15142. {
  15143. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  15144. CYTHON_UNUSED_VAR(context);
  15145. Py_INCREF(result);
  15146. return result;
  15147. }
  15148. static int
  15149. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  15150. int result = 0;
  15151. PyObject *res = op->defaults_getter((PyObject *) op);
  15152. if (unlikely(!res))
  15153. return -1;
  15154. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15155. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  15156. Py_INCREF(op->defaults_tuple);
  15157. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  15158. Py_INCREF(op->defaults_kwdict);
  15159. #else
  15160. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  15161. if (unlikely(!op->defaults_tuple)) result = -1;
  15162. else {
  15163. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  15164. if (unlikely(!op->defaults_kwdict)) result = -1;
  15165. }
  15166. #endif
  15167. Py_DECREF(res);
  15168. return result;
  15169. }
  15170. static int
  15171. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15172. CYTHON_UNUSED_VAR(context);
  15173. if (!value) {
  15174. value = Py_None;
  15175. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  15176. PyErr_SetString(PyExc_TypeError,
  15177. "__defaults__ must be set to a tuple object");
  15178. return -1;
  15179. }
  15180. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  15181. "currently affect the values used in function calls", 1);
  15182. Py_INCREF(value);
  15183. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15184. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  15185. __Pyx_END_CRITICAL_SECTION();
  15186. return 0;
  15187. }
  15188. static PyObject *
  15189. __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
  15190. PyObject* result = op->defaults_tuple;
  15191. if (unlikely(!result)) {
  15192. if (op->defaults_getter) {
  15193. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15194. result = op->defaults_tuple;
  15195. } else {
  15196. result = Py_None;
  15197. }
  15198. }
  15199. Py_INCREF(result);
  15200. return result;
  15201. }
  15202. static PyObject *
  15203. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  15204. PyObject* result = NULL;
  15205. CYTHON_UNUSED_VAR(context);
  15206. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15207. result = __Pyx_CyFunction_get_defaults_locked(op);
  15208. __Pyx_END_CRITICAL_SECTION();
  15209. return result;
  15210. }
  15211. static int
  15212. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15213. CYTHON_UNUSED_VAR(context);
  15214. if (!value) {
  15215. value = Py_None;
  15216. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  15217. PyErr_SetString(PyExc_TypeError,
  15218. "__kwdefaults__ must be set to a dict object");
  15219. return -1;
  15220. }
  15221. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  15222. "currently affect the values used in function calls", 1);
  15223. Py_INCREF(value);
  15224. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15225. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  15226. __Pyx_END_CRITICAL_SECTION();
  15227. return 0;
  15228. }
  15229. static PyObject *
  15230. __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
  15231. PyObject* result = op->defaults_kwdict;
  15232. if (unlikely(!result)) {
  15233. if (op->defaults_getter) {
  15234. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15235. result = op->defaults_kwdict;
  15236. } else {
  15237. result = Py_None;
  15238. }
  15239. }
  15240. Py_INCREF(result);
  15241. return result;
  15242. }
  15243. static PyObject *
  15244. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  15245. PyObject* result;
  15246. CYTHON_UNUSED_VAR(context);
  15247. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15248. result = __Pyx_CyFunction_get_kwdefaults_locked(op);
  15249. __Pyx_END_CRITICAL_SECTION();
  15250. return result;
  15251. }
  15252. static int
  15253. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15254. CYTHON_UNUSED_VAR(context);
  15255. if (!value || value == Py_None) {
  15256. value = NULL;
  15257. } else if (unlikely(!PyDict_Check(value))) {
  15258. PyErr_SetString(PyExc_TypeError,
  15259. "__annotations__ must be set to a dict object");
  15260. return -1;
  15261. }
  15262. Py_XINCREF(value);
  15263. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15264. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  15265. __Pyx_END_CRITICAL_SECTION();
  15266. return 0;
  15267. }
  15268. static PyObject *
  15269. __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
  15270. PyObject* result = op->func_annotations;
  15271. if (unlikely(!result)) {
  15272. result = PyDict_New();
  15273. if (unlikely(!result)) return NULL;
  15274. op->func_annotations = result;
  15275. }
  15276. Py_INCREF(result);
  15277. return result;
  15278. }
  15279. static PyObject *
  15280. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  15281. PyObject *result;
  15282. CYTHON_UNUSED_VAR(context);
  15283. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15284. result = __Pyx_CyFunction_get_annotations_locked(op);
  15285. __Pyx_END_CRITICAL_SECTION();
  15286. return result;
  15287. }
  15288. static PyObject *
  15289. __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
  15290. int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  15291. if (is_coroutine) {
  15292. PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
  15293. fromlist = PyList_New(1);
  15294. if (unlikely(!fromlist)) return NULL;
  15295. Py_INCREF(marker);
  15296. #if CYTHON_ASSUME_SAFE_MACROS
  15297. PyList_SET_ITEM(fromlist, 0, marker);
  15298. #else
  15299. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  15300. Py_DECREF(marker);
  15301. Py_DECREF(fromlist);
  15302. return NULL;
  15303. }
  15304. #endif
  15305. module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
  15306. Py_DECREF(fromlist);
  15307. if (unlikely(!module)) goto ignore;
  15308. is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
  15309. Py_DECREF(module);
  15310. if (likely(is_coroutine_value)) {
  15311. return is_coroutine_value;
  15312. }
  15313. ignore:
  15314. PyErr_Clear();
  15315. }
  15316. return __Pyx_PyBool_FromLong(is_coroutine);
  15317. }
  15318. static PyObject *
  15319. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  15320. PyObject *result;
  15321. CYTHON_UNUSED_VAR(context);
  15322. if (op->func_is_coroutine) {
  15323. return __Pyx_NewRef(op->func_is_coroutine);
  15324. }
  15325. result = __Pyx_CyFunction_get_is_coroutine_value(op);
  15326. if (unlikely(!result))
  15327. return NULL;
  15328. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15329. if (op->func_is_coroutine) {
  15330. Py_DECREF(result);
  15331. result = __Pyx_NewRef(op->func_is_coroutine);
  15332. } else {
  15333. op->func_is_coroutine = __Pyx_NewRef(result);
  15334. }
  15335. __Pyx_END_CRITICAL_SECTION();
  15336. return result;
  15337. }
  15338. static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
  15339. #if CYTHON_COMPILING_IN_LIMITED_API
  15340. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  15341. if (!py_name) return;
  15342. PyErr_Format(PyExc_TypeError,
  15343. "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15344. py_name, message, size);
  15345. Py_DECREF(py_name);
  15346. #else
  15347. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  15348. PyErr_Format(PyExc_TypeError,
  15349. "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15350. name, message, size);
  15351. #endif
  15352. }
  15353. static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
  15354. #if CYTHON_COMPILING_IN_LIMITED_API
  15355. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  15356. if (!py_name) return;
  15357. PyErr_Format(PyExc_TypeError,
  15358. "%.200S() %s",
  15359. py_name, message);
  15360. Py_DECREF(py_name);
  15361. #else
  15362. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  15363. PyErr_Format(PyExc_TypeError,
  15364. "%.200s() %s",
  15365. name, message);
  15366. #endif
  15367. }
  15368. #if CYTHON_COMPILING_IN_LIMITED_API
  15369. static PyObject *
  15370. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  15371. CYTHON_UNUSED_VAR(context);
  15372. return PyObject_GetAttrString(op->func, "__module__");
  15373. }
  15374. static int
  15375. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15376. CYTHON_UNUSED_VAR(context);
  15377. return PyObject_SetAttrString(op->func, "__module__", value);
  15378. }
  15379. #endif
  15380. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  15381. {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15382. {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15383. {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15384. {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15385. {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  15386. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15387. {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  15388. {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  15389. #else
  15390. {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  15391. {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  15392. #endif
  15393. {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15394. {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15395. {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15396. {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15397. {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15398. {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15399. {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15400. {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15401. {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  15402. {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  15403. {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  15404. #if CYTHON_COMPILING_IN_LIMITED_API
  15405. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  15406. #endif
  15407. {0, 0, 0, 0, 0}
  15408. };
  15409. static PyMemberDef __pyx_CyFunction_members[] = {
  15410. #if !CYTHON_COMPILING_IN_LIMITED_API
  15411. {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  15412. #endif
  15413. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15414. {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  15415. #endif
  15416. #if CYTHON_METH_FASTCALL
  15417. #if CYTHON_COMPILING_IN_LIMITED_API
  15418. {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  15419. #else
  15420. {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  15421. #endif
  15422. #if CYTHON_COMPILING_IN_LIMITED_API
  15423. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  15424. #else
  15425. {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  15426. #endif
  15427. #endif
  15428. {0, 0, 0, 0, 0}
  15429. };
  15430. static PyObject *
  15431. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  15432. {
  15433. PyObject *result = NULL;
  15434. CYTHON_UNUSED_VAR(args);
  15435. __Pyx_BEGIN_CRITICAL_SECTION(m);
  15436. Py_INCREF(m->func_qualname);
  15437. result = m->func_qualname;
  15438. __Pyx_END_CRITICAL_SECTION();
  15439. return result;
  15440. }
  15441. static PyMethodDef __pyx_CyFunction_methods[] = {
  15442. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  15443. {0, 0, 0, 0}
  15444. };
  15445. #if CYTHON_COMPILING_IN_LIMITED_API
  15446. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  15447. #else
  15448. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  15449. #endif
  15450. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  15451. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  15452. #if !CYTHON_COMPILING_IN_LIMITED_API
  15453. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  15454. #endif
  15455. if (unlikely(op == NULL))
  15456. return NULL;
  15457. #if CYTHON_COMPILING_IN_LIMITED_API
  15458. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  15459. if (unlikely(!op->func)) return NULL;
  15460. #endif
  15461. op->flags = flags;
  15462. __Pyx_CyFunction_weakreflist(op) = NULL;
  15463. #if !CYTHON_COMPILING_IN_LIMITED_API
  15464. cf->m_ml = ml;
  15465. cf->m_self = (PyObject *) op;
  15466. #endif
  15467. Py_XINCREF(closure);
  15468. op->func_closure = closure;
  15469. #if !CYTHON_COMPILING_IN_LIMITED_API
  15470. Py_XINCREF(module);
  15471. cf->m_module = module;
  15472. #endif
  15473. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15474. op->func_dict = NULL;
  15475. #endif
  15476. op->func_name = NULL;
  15477. Py_INCREF(qualname);
  15478. op->func_qualname = qualname;
  15479. op->func_doc = NULL;
  15480. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  15481. op->func_classobj = NULL;
  15482. #else
  15483. ((PyCMethodObject*)op)->mm_class = NULL;
  15484. #endif
  15485. op->func_globals = globals;
  15486. Py_INCREF(op->func_globals);
  15487. Py_XINCREF(code);
  15488. op->func_code = code;
  15489. op->defaults = NULL;
  15490. op->defaults_tuple = NULL;
  15491. op->defaults_kwdict = NULL;
  15492. op->defaults_getter = NULL;
  15493. op->func_annotations = NULL;
  15494. op->func_is_coroutine = NULL;
  15495. #if CYTHON_METH_FASTCALL
  15496. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  15497. case METH_NOARGS:
  15498. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  15499. break;
  15500. case METH_O:
  15501. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  15502. break;
  15503. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  15504. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  15505. break;
  15506. case METH_FASTCALL | METH_KEYWORDS:
  15507. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  15508. break;
  15509. case METH_VARARGS | METH_KEYWORDS:
  15510. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  15511. break;
  15512. default:
  15513. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15514. Py_DECREF(op);
  15515. return NULL;
  15516. }
  15517. #endif
  15518. return (PyObject *) op;
  15519. }
  15520. static int
  15521. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  15522. {
  15523. Py_CLEAR(m->func_closure);
  15524. #if CYTHON_COMPILING_IN_LIMITED_API
  15525. Py_CLEAR(m->func);
  15526. #else
  15527. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  15528. #endif
  15529. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15530. Py_CLEAR(m->func_dict);
  15531. #elif PY_VERSION_HEX < 0x030d0000
  15532. _PyObject_ClearManagedDict((PyObject*)m);
  15533. #else
  15534. PyObject_ClearManagedDict((PyObject*)m);
  15535. #endif
  15536. Py_CLEAR(m->func_name);
  15537. Py_CLEAR(m->func_qualname);
  15538. Py_CLEAR(m->func_doc);
  15539. Py_CLEAR(m->func_globals);
  15540. Py_CLEAR(m->func_code);
  15541. #if !CYTHON_COMPILING_IN_LIMITED_API
  15542. #if PY_VERSION_HEX < 0x030900B1
  15543. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  15544. #else
  15545. {
  15546. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  15547. ((PyCMethodObject *) (m))->mm_class = NULL;
  15548. Py_XDECREF(cls);
  15549. }
  15550. #endif
  15551. #endif
  15552. Py_CLEAR(m->defaults_tuple);
  15553. Py_CLEAR(m->defaults_kwdict);
  15554. Py_CLEAR(m->func_annotations);
  15555. Py_CLEAR(m->func_is_coroutine);
  15556. Py_CLEAR(m->defaults);
  15557. return 0;
  15558. }
  15559. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15560. {
  15561. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  15562. PyObject_ClearWeakRefs((PyObject *) m);
  15563. __Pyx_CyFunction_clear(m);
  15564. __Pyx_PyHeapTypeObject_GC_Del(m);
  15565. }
  15566. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15567. {
  15568. PyObject_GC_UnTrack(m);
  15569. __Pyx__CyFunction_dealloc(m);
  15570. }
  15571. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  15572. {
  15573. {
  15574. int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
  15575. if (e) return e;
  15576. }
  15577. Py_VISIT(m->func_closure);
  15578. #if CYTHON_COMPILING_IN_LIMITED_API
  15579. Py_VISIT(m->func);
  15580. #else
  15581. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  15582. #endif
  15583. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15584. Py_VISIT(m->func_dict);
  15585. #else
  15586. {
  15587. int e =
  15588. #if PY_VERSION_HEX < 0x030d0000
  15589. _PyObject_VisitManagedDict
  15590. #else
  15591. PyObject_VisitManagedDict
  15592. #endif
  15593. ((PyObject*)m, visit, arg);
  15594. if (e != 0) return e;
  15595. }
  15596. #endif
  15597. __Pyx_VISIT_CONST(m->func_name);
  15598. __Pyx_VISIT_CONST(m->func_qualname);
  15599. Py_VISIT(m->func_doc);
  15600. Py_VISIT(m->func_globals);
  15601. __Pyx_VISIT_CONST(m->func_code);
  15602. #if !CYTHON_COMPILING_IN_LIMITED_API
  15603. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  15604. #endif
  15605. Py_VISIT(m->defaults_tuple);
  15606. Py_VISIT(m->defaults_kwdict);
  15607. Py_VISIT(m->func_is_coroutine);
  15608. Py_VISIT(m->defaults);
  15609. return 0;
  15610. }
  15611. static PyObject*
  15612. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  15613. {
  15614. PyObject *repr;
  15615. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15616. repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
  15617. op->func_qualname, (void *)op);
  15618. __Pyx_END_CRITICAL_SECTION();
  15619. return repr;
  15620. }
  15621. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  15622. #if CYTHON_COMPILING_IN_LIMITED_API
  15623. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  15624. PyCFunction meth;
  15625. int flags;
  15626. meth = PyCFunction_GetFunction(f);
  15627. if (unlikely(!meth)) return NULL;
  15628. flags = PyCFunction_GetFlags(f);
  15629. if (unlikely(flags < 0)) return NULL;
  15630. #else
  15631. PyCFunctionObject* f = (PyCFunctionObject*)func;
  15632. PyCFunction meth = f->m_ml->ml_meth;
  15633. int flags = f->m_ml->ml_flags;
  15634. #endif
  15635. Py_ssize_t size;
  15636. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  15637. case METH_VARARGS:
  15638. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  15639. return (*meth)(self, arg);
  15640. break;
  15641. case METH_VARARGS | METH_KEYWORDS:
  15642. return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
  15643. case METH_NOARGS:
  15644. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15645. #if CYTHON_ASSUME_SAFE_SIZE
  15646. size = PyTuple_GET_SIZE(arg);
  15647. #else
  15648. size = PyTuple_Size(arg);
  15649. if (unlikely(size < 0)) return NULL;
  15650. #endif
  15651. if (likely(size == 0))
  15652. return (*meth)(self, NULL);
  15653. __Pyx_CyFunction_raise_argument_count_error(
  15654. (__pyx_CyFunctionObject*)func,
  15655. "takes no arguments", size);
  15656. return NULL;
  15657. }
  15658. break;
  15659. case METH_O:
  15660. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15661. #if CYTHON_ASSUME_SAFE_SIZE
  15662. size = PyTuple_GET_SIZE(arg);
  15663. #else
  15664. size = PyTuple_Size(arg);
  15665. if (unlikely(size < 0)) return NULL;
  15666. #endif
  15667. if (likely(size == 1)) {
  15668. PyObject *result, *arg0;
  15669. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15670. arg0 = PyTuple_GET_ITEM(arg, 0);
  15671. #else
  15672. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  15673. #endif
  15674. result = (*meth)(self, arg0);
  15675. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  15676. Py_DECREF(arg0);
  15677. #endif
  15678. return result;
  15679. }
  15680. __Pyx_CyFunction_raise_argument_count_error(
  15681. (__pyx_CyFunctionObject*)func,
  15682. "takes exactly one argument", size);
  15683. return NULL;
  15684. }
  15685. break;
  15686. default:
  15687. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15688. return NULL;
  15689. }
  15690. __Pyx_CyFunction_raise_type_error(
  15691. (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
  15692. return NULL;
  15693. }
  15694. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  15695. PyObject *self, *result;
  15696. #if CYTHON_COMPILING_IN_LIMITED_API
  15697. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  15698. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15699. #else
  15700. self = ((PyCFunctionObject*)func)->m_self;
  15701. #endif
  15702. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  15703. return result;
  15704. }
  15705. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  15706. PyObject *result;
  15707. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  15708. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  15709. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  15710. if (vc) {
  15711. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  15712. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  15713. #else
  15714. (void) &__Pyx_PyVectorcall_FastCallDict;
  15715. return PyVectorcall_Call(func, args, kw);
  15716. #endif
  15717. }
  15718. #endif
  15719. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15720. Py_ssize_t argc;
  15721. PyObject *new_args;
  15722. PyObject *self;
  15723. #if CYTHON_ASSUME_SAFE_SIZE
  15724. argc = PyTuple_GET_SIZE(args);
  15725. #else
  15726. argc = PyTuple_Size(args);
  15727. if (unlikely(argc < 0)) return NULL;
  15728. #endif
  15729. new_args = PyTuple_GetSlice(args, 1, argc);
  15730. if (unlikely(!new_args))
  15731. return NULL;
  15732. self = PyTuple_GetItem(args, 0);
  15733. if (unlikely(!self)) {
  15734. Py_DECREF(new_args);
  15735. PyErr_Format(PyExc_TypeError,
  15736. "unbound method %.200S() needs an argument",
  15737. cyfunc->func_qualname);
  15738. return NULL;
  15739. }
  15740. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  15741. Py_DECREF(new_args);
  15742. } else {
  15743. result = __Pyx_CyFunction_Call(func, args, kw);
  15744. }
  15745. return result;
  15746. }
  15747. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  15748. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  15749. {
  15750. int ret = 0;
  15751. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15752. if (unlikely(nargs < 1)) {
  15753. __Pyx_CyFunction_raise_type_error(
  15754. cyfunc, "needs an argument");
  15755. return -1;
  15756. }
  15757. ret = 1;
  15758. }
  15759. if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
  15760. __Pyx_CyFunction_raise_type_error(
  15761. cyfunc, "takes no keyword arguments");
  15762. return -1;
  15763. }
  15764. return ret;
  15765. }
  15766. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15767. {
  15768. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15769. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15770. PyObject *self;
  15771. #if CYTHON_COMPILING_IN_LIMITED_API
  15772. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15773. if (unlikely(!meth)) return NULL;
  15774. #else
  15775. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15776. #endif
  15777. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15778. case 1:
  15779. self = args[0];
  15780. args += 1;
  15781. nargs -= 1;
  15782. break;
  15783. case 0:
  15784. #if CYTHON_COMPILING_IN_LIMITED_API
  15785. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15786. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15787. #else
  15788. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15789. #endif
  15790. break;
  15791. default:
  15792. return NULL;
  15793. }
  15794. if (unlikely(nargs != 0)) {
  15795. __Pyx_CyFunction_raise_argument_count_error(
  15796. cyfunc, "takes no arguments", nargs);
  15797. return NULL;
  15798. }
  15799. return meth(self, NULL);
  15800. }
  15801. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15802. {
  15803. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15804. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15805. PyObject *self;
  15806. #if CYTHON_COMPILING_IN_LIMITED_API
  15807. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15808. if (unlikely(!meth)) return NULL;
  15809. #else
  15810. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15811. #endif
  15812. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15813. case 1:
  15814. self = args[0];
  15815. args += 1;
  15816. nargs -= 1;
  15817. break;
  15818. case 0:
  15819. #if CYTHON_COMPILING_IN_LIMITED_API
  15820. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15821. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15822. #else
  15823. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15824. #endif
  15825. break;
  15826. default:
  15827. return NULL;
  15828. }
  15829. if (unlikely(nargs != 1)) {
  15830. __Pyx_CyFunction_raise_argument_count_error(
  15831. cyfunc, "takes exactly one argument", nargs);
  15832. return NULL;
  15833. }
  15834. return meth(self, args[0]);
  15835. }
  15836. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15837. {
  15838. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15839. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15840. PyObject *self;
  15841. #if CYTHON_COMPILING_IN_LIMITED_API
  15842. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15843. if (unlikely(!meth)) return NULL;
  15844. #else
  15845. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15846. #endif
  15847. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15848. case 1:
  15849. self = args[0];
  15850. args += 1;
  15851. nargs -= 1;
  15852. break;
  15853. case 0:
  15854. #if CYTHON_COMPILING_IN_LIMITED_API
  15855. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15856. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15857. #else
  15858. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15859. #endif
  15860. break;
  15861. default:
  15862. return NULL;
  15863. }
  15864. return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
  15865. }
  15866. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15867. {
  15868. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15869. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  15870. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15871. PyObject *self;
  15872. #if CYTHON_COMPILING_IN_LIMITED_API
  15873. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15874. if (unlikely(!meth)) return NULL;
  15875. #else
  15876. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15877. #endif
  15878. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15879. case 1:
  15880. self = args[0];
  15881. args += 1;
  15882. nargs -= 1;
  15883. break;
  15884. case 0:
  15885. #if CYTHON_COMPILING_IN_LIMITED_API
  15886. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15887. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15888. #else
  15889. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15890. #endif
  15891. break;
  15892. default:
  15893. return NULL;
  15894. }
  15895. #if PY_VERSION_HEX < 0x030e00A6
  15896. size_t nargs_value = (size_t) nargs;
  15897. #else
  15898. Py_ssize_t nargs_value = nargs;
  15899. #endif
  15900. return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
  15901. }
  15902. #endif
  15903. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  15904. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  15905. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  15906. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  15907. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  15908. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  15909. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  15910. {Py_tp_members, (void *)__pyx_CyFunction_members},
  15911. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  15912. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  15913. {0, 0},
  15914. };
  15915. static PyType_Spec __pyx_CyFunctionType_spec = {
  15916. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  15917. sizeof(__pyx_CyFunctionObject),
  15918. 0,
  15919. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  15920. Py_TPFLAGS_METHOD_DESCRIPTOR |
  15921. #endif
  15922. #if CYTHON_METH_FASTCALL
  15923. #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
  15924. Py_TPFLAGS_HAVE_VECTORCALL |
  15925. #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
  15926. _Py_TPFLAGS_HAVE_VECTORCALL |
  15927. #endif
  15928. #endif // CYTHON_METH_FASTCALL
  15929. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  15930. Py_TPFLAGS_MANAGED_DICT |
  15931. #endif
  15932. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  15933. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  15934. __pyx_CyFunctionType_slots
  15935. };
  15936. static int __pyx_CyFunction_init(PyObject *module) {
  15937. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  15938. mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
  15939. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
  15940. if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
  15941. return -1;
  15942. }
  15943. return 0;
  15944. }
  15945. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
  15946. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15947. m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
  15948. if (unlikely(!m->defaults))
  15949. return NULL;
  15950. return m->defaults;
  15951. }
  15952. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  15953. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15954. m->defaults_tuple = tuple;
  15955. Py_INCREF(tuple);
  15956. }
  15957. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  15958. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15959. m->defaults_kwdict = dict;
  15960. Py_INCREF(dict);
  15961. }
  15962. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  15963. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15964. m->func_annotations = dict;
  15965. Py_INCREF(dict);
  15966. }
  15967. /* CythonFunction */
  15968. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  15969. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  15970. PyObject *op = __Pyx_CyFunction_Init(
  15971. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
  15972. ml, flags, qualname, closure, module, globals, code
  15973. );
  15974. if (likely(op)) {
  15975. PyObject_GC_Track(op);
  15976. }
  15977. return op;
  15978. }
  15979. /* CLineInTraceback (used by AddTraceback) */
  15980. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  15981. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15982. #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  15983. #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  15984. #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  15985. #else
  15986. PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
  15987. PyObject **dict_ptr = _PyObject_GetDictPtr(o);
  15988. return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  15989. }
  15990. #endif
  15991. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  15992. PyObject *use_cline = NULL;
  15993. PyObject *ptype, *pvalue, *ptraceback;
  15994. PyObject *cython_runtime_dict;
  15995. CYTHON_MAYBE_UNUSED_VAR(tstate);
  15996. if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
  15997. return c_line;
  15998. }
  15999. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  16000. cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
  16001. if (likely(cython_runtime_dict)) {
  16002. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  16003. use_cline, cython_runtime_dict,
  16004. __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
  16005. }
  16006. if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  16007. c_line = 0;
  16008. }
  16009. Py_XDECREF(use_cline);
  16010. Py_XDECREF(cython_runtime_dict);
  16011. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  16012. return c_line;
  16013. }
  16014. #endif
  16015. /* CodeObjectCache (used by AddTraceback) */
  16016. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  16017. int start = 0, mid = 0, end = count - 1;
  16018. if (end >= 0 && code_line > entries[end].code_line) {
  16019. return count;
  16020. }
  16021. while (start < end) {
  16022. mid = start + (end - start) / 2;
  16023. if (code_line < entries[mid].code_line) {
  16024. end = mid;
  16025. } else if (code_line > entries[mid].code_line) {
  16026. start = mid + 1;
  16027. } else {
  16028. return mid;
  16029. }
  16030. }
  16031. if (code_line <= entries[mid].code_line) {
  16032. return mid;
  16033. } else {
  16034. return mid + 1;
  16035. }
  16036. }
  16037. static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
  16038. __Pyx_CachedCodeObjectType* code_object;
  16039. int pos;
  16040. if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
  16041. return NULL;
  16042. }
  16043. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  16044. if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
  16045. return NULL;
  16046. }
  16047. code_object = code_cache->entries[pos].code_object;
  16048. Py_INCREF(code_object);
  16049. return code_object;
  16050. }
  16051. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  16052. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  16053. (void)__pyx__find_code_object;
  16054. return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  16055. #else
  16056. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  16057. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16058. __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
  16059. if (old_count < 0) {
  16060. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  16061. return NULL;
  16062. }
  16063. #endif
  16064. __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  16065. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16066. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  16067. #endif
  16068. return result;
  16069. #endif
  16070. }
  16071. static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  16072. {
  16073. int pos, i;
  16074. __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
  16075. if (unlikely(!code_line)) {
  16076. return;
  16077. }
  16078. if (unlikely(!entries)) {
  16079. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  16080. if (likely(entries)) {
  16081. code_cache->entries = entries;
  16082. code_cache->max_count = 64;
  16083. code_cache->count = 1;
  16084. entries[0].code_line = code_line;
  16085. entries[0].code_object = code_object;
  16086. Py_INCREF(code_object);
  16087. }
  16088. return;
  16089. }
  16090. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  16091. if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
  16092. __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
  16093. entries[pos].code_object = code_object;
  16094. Py_INCREF(code_object);
  16095. Py_DECREF(tmp);
  16096. return;
  16097. }
  16098. if (code_cache->count == code_cache->max_count) {
  16099. int new_max = code_cache->max_count + 64;
  16100. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  16101. code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  16102. if (unlikely(!entries)) {
  16103. return;
  16104. }
  16105. code_cache->entries = entries;
  16106. code_cache->max_count = new_max;
  16107. }
  16108. for (i=code_cache->count; i>pos; i--) {
  16109. entries[i] = entries[i-1];
  16110. }
  16111. entries[pos].code_line = code_line;
  16112. entries[pos].code_object = code_object;
  16113. code_cache->count++;
  16114. Py_INCREF(code_object);
  16115. }
  16116. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  16117. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  16118. (void)__pyx__insert_code_object;
  16119. return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  16120. #else
  16121. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  16122. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16123. __pyx_nonatomic_int_type expected = 0;
  16124. if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
  16125. return;
  16126. }
  16127. #endif
  16128. __pyx__insert_code_object(code_cache, code_line, code_object);
  16129. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16130. __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  16131. #endif
  16132. #endif
  16133. }
  16134. /* AddTraceback */
  16135. #include "compile.h"
  16136. #include "frameobject.h"
  16137. #include "traceback.h"
  16138. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  16139. #ifndef Py_BUILD_CORE
  16140. #define Py_BUILD_CORE 1
  16141. #endif
  16142. #include "internal/pycore_frame.h"
  16143. #endif
  16144. #if CYTHON_COMPILING_IN_LIMITED_API
  16145. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  16146. PyObject *firstlineno, PyObject *name) {
  16147. PyObject *replace = NULL;
  16148. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  16149. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  16150. replace = PyObject_GetAttrString(code, "replace");
  16151. if (likely(replace)) {
  16152. PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
  16153. Py_DECREF(replace);
  16154. return result;
  16155. }
  16156. PyErr_Clear();
  16157. return NULL;
  16158. }
  16159. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16160. int py_line, const char *filename) {
  16161. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  16162. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  16163. PyObject *exc_type, *exc_value, *exc_traceback;
  16164. int success = 0;
  16165. if (c_line) {
  16166. c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  16167. }
  16168. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  16169. code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
  16170. if (!code_object) {
  16171. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  16172. if (unlikely(!code_object)) goto bad;
  16173. py_py_line = PyLong_FromLong(py_line);
  16174. if (unlikely(!py_py_line)) goto bad;
  16175. if (c_line) {
  16176. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16177. } else {
  16178. py_funcname = PyUnicode_FromString(funcname);
  16179. }
  16180. if (unlikely(!py_funcname)) goto bad;
  16181. dict = PyDict_New();
  16182. if (unlikely(!dict)) goto bad;
  16183. {
  16184. PyObject *old_code_object = code_object;
  16185. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  16186. Py_DECREF(old_code_object);
  16187. }
  16188. if (unlikely(!code_object)) goto bad;
  16189. __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
  16190. } else {
  16191. dict = PyDict_New();
  16192. }
  16193. getframe = PySys_GetObject("_getframe");
  16194. if (unlikely(!getframe)) goto bad;
  16195. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  16196. frame = PyEval_EvalCode(code_object, dict, dict);
  16197. if (unlikely(!frame) || frame == Py_None) goto bad;
  16198. success = 1;
  16199. bad:
  16200. PyErr_Restore(exc_type, exc_value, exc_traceback);
  16201. Py_XDECREF(code_object);
  16202. Py_XDECREF(py_py_line);
  16203. Py_XDECREF(py_funcname);
  16204. Py_XDECREF(dict);
  16205. Py_XDECREF(replace);
  16206. if (success) {
  16207. PyTraceBack_Here(
  16208. (struct _frame*)frame);
  16209. }
  16210. Py_XDECREF(frame);
  16211. }
  16212. #else
  16213. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  16214. const char *funcname, int c_line,
  16215. int py_line, const char *filename) {
  16216. PyCodeObject *py_code = NULL;
  16217. PyObject *py_funcname = NULL;
  16218. if (c_line) {
  16219. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16220. if (!py_funcname) goto bad;
  16221. funcname = PyUnicode_AsUTF8(py_funcname);
  16222. if (!funcname) goto bad;
  16223. }
  16224. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  16225. Py_XDECREF(py_funcname);
  16226. return py_code;
  16227. bad:
  16228. Py_XDECREF(py_funcname);
  16229. return NULL;
  16230. }
  16231. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16232. int py_line, const char *filename) {
  16233. PyCodeObject *py_code = 0;
  16234. PyFrameObject *py_frame = 0;
  16235. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  16236. PyObject *ptype, *pvalue, *ptraceback;
  16237. if (c_line) {
  16238. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  16239. }
  16240. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  16241. if (!py_code) {
  16242. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  16243. py_code = __Pyx_CreateCodeObjectForTraceback(
  16244. funcname, c_line, py_line, filename);
  16245. if (!py_code) {
  16246. /* If the code object creation fails, then we should clear the
  16247. fetched exception references and propagate the new exception */
  16248. Py_XDECREF(ptype);
  16249. Py_XDECREF(pvalue);
  16250. Py_XDECREF(ptraceback);
  16251. goto bad;
  16252. }
  16253. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  16254. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  16255. }
  16256. py_frame = PyFrame_New(
  16257. tstate, /*PyThreadState *tstate,*/
  16258. py_code, /*PyCodeObject *code,*/
  16259. __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/
  16260. 0 /*PyObject *locals*/
  16261. );
  16262. if (!py_frame) goto bad;
  16263. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  16264. PyTraceBack_Here(py_frame);
  16265. bad:
  16266. Py_XDECREF(py_code);
  16267. Py_XDECREF(py_frame);
  16268. }
  16269. #endif
  16270. /* CIntFromPyVerify */
  16271. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  16272. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  16273. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  16274. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  16275. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  16276. {\
  16277. func_type value = func_value;\
  16278. if (sizeof(target_type) < sizeof(func_type)) {\
  16279. if (unlikely(value != (func_type) (target_type) value)) {\
  16280. func_type zero = 0;\
  16281. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  16282. return (target_type) -1;\
  16283. if (is_unsigned && unlikely(value < zero))\
  16284. goto raise_neg_overflow;\
  16285. else\
  16286. goto raise_overflow;\
  16287. }\
  16288. }\
  16289. return (target_type) value;\
  16290. }
  16291. /* CIntFromPy */
  16292. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  16293. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16294. #pragma GCC diagnostic push
  16295. #pragma GCC diagnostic ignored "-Wconversion"
  16296. #endif
  16297. const int neg_one = (int) -1, const_zero = (int) 0;
  16298. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16299. #pragma GCC diagnostic pop
  16300. #endif
  16301. const int is_unsigned = neg_one > const_zero;
  16302. if (unlikely(!PyLong_Check(x))) {
  16303. int val;
  16304. PyObject *tmp = __Pyx_PyNumber_Long(x);
  16305. if (!tmp) return (int) -1;
  16306. val = __Pyx_PyLong_As_int(tmp);
  16307. Py_DECREF(tmp);
  16308. return val;
  16309. }
  16310. if (is_unsigned) {
  16311. #if CYTHON_USE_PYLONG_INTERNALS
  16312. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16313. goto raise_neg_overflow;
  16314. } else if (__Pyx_PyLong_IsCompact(x)) {
  16315. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16316. } else {
  16317. const digit* digits = __Pyx_PyLong_Digits(x);
  16318. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16319. switch (__Pyx_PyLong_DigitCount(x)) {
  16320. case 2:
  16321. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16322. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16323. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16324. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  16325. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16326. }
  16327. }
  16328. break;
  16329. case 3:
  16330. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16331. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16332. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16333. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  16334. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16335. }
  16336. }
  16337. break;
  16338. case 4:
  16339. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16340. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16341. __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])))
  16342. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  16343. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16344. }
  16345. }
  16346. break;
  16347. }
  16348. }
  16349. #endif
  16350. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16351. if (unlikely(Py_SIZE(x) < 0)) {
  16352. goto raise_neg_overflow;
  16353. }
  16354. #else
  16355. {
  16356. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16357. if (unlikely(result < 0))
  16358. return (int) -1;
  16359. if (unlikely(result == 1))
  16360. goto raise_neg_overflow;
  16361. }
  16362. #endif
  16363. if ((sizeof(int) <= sizeof(unsigned long))) {
  16364. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  16365. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  16366. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16367. }
  16368. } else {
  16369. #if CYTHON_USE_PYLONG_INTERNALS
  16370. if (__Pyx_PyLong_IsCompact(x)) {
  16371. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16372. } else {
  16373. const digit* digits = __Pyx_PyLong_Digits(x);
  16374. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16375. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16376. case -2:
  16377. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  16378. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16379. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16380. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16381. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16382. }
  16383. }
  16384. break;
  16385. case 2:
  16386. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16387. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16388. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16389. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16390. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16391. }
  16392. }
  16393. break;
  16394. case -3:
  16395. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16396. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16397. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16398. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16399. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16400. }
  16401. }
  16402. break;
  16403. case 3:
  16404. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16405. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16406. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16407. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16408. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16409. }
  16410. }
  16411. break;
  16412. case -4:
  16413. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16414. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16415. __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])))
  16416. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16417. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16418. }
  16419. }
  16420. break;
  16421. case 4:
  16422. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16423. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16424. __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])))
  16425. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16426. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16427. }
  16428. }
  16429. break;
  16430. }
  16431. }
  16432. #endif
  16433. if ((sizeof(int) <= sizeof(long))) {
  16434. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  16435. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  16436. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  16437. }
  16438. }
  16439. {
  16440. int val;
  16441. int ret = -1;
  16442. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  16443. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  16444. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  16445. if (unlikely(bytes_copied == -1)) {
  16446. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  16447. goto raise_overflow;
  16448. } else {
  16449. ret = 0;
  16450. }
  16451. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16452. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16453. unsigned char *bytes = (unsigned char *)&val;
  16454. ret = _PyLong_AsByteArray((PyLongObject *)x,
  16455. bytes, sizeof(val),
  16456. is_little, !is_unsigned);
  16457. #else
  16458. PyObject *v;
  16459. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16460. int bits, remaining_bits, is_negative = 0;
  16461. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16462. if (likely(PyLong_CheckExact(x))) {
  16463. v = __Pyx_NewRef(x);
  16464. } else {
  16465. v = PyNumber_Long(x);
  16466. if (unlikely(!v)) return (int) -1;
  16467. assert(PyLong_CheckExact(v));
  16468. }
  16469. {
  16470. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  16471. if (unlikely(result < 0)) {
  16472. Py_DECREF(v);
  16473. return (int) -1;
  16474. }
  16475. is_negative = result == 1;
  16476. }
  16477. if (is_unsigned && unlikely(is_negative)) {
  16478. Py_DECREF(v);
  16479. goto raise_neg_overflow;
  16480. } else if (is_negative) {
  16481. stepval = PyNumber_Invert(v);
  16482. Py_DECREF(v);
  16483. if (unlikely(!stepval))
  16484. return (int) -1;
  16485. } else {
  16486. stepval = v;
  16487. }
  16488. v = NULL;
  16489. val = (int) 0;
  16490. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16491. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16492. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  16493. PyObject *tmp, *digit;
  16494. long idigit;
  16495. digit = PyNumber_And(stepval, mask);
  16496. if (unlikely(!digit)) goto done;
  16497. idigit = PyLong_AsLong(digit);
  16498. Py_DECREF(digit);
  16499. if (unlikely(idigit < 0)) goto done;
  16500. val |= ((int) idigit) << bits;
  16501. tmp = PyNumber_Rshift(stepval, shift);
  16502. if (unlikely(!tmp)) goto done;
  16503. Py_DECREF(stepval); stepval = tmp;
  16504. }
  16505. Py_DECREF(shift); shift = NULL;
  16506. Py_DECREF(mask); mask = NULL;
  16507. {
  16508. long idigit = PyLong_AsLong(stepval);
  16509. if (unlikely(idigit < 0)) goto done;
  16510. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  16511. if (unlikely(idigit >= (1L << remaining_bits)))
  16512. goto raise_overflow;
  16513. val |= ((int) idigit) << bits;
  16514. }
  16515. if (!is_unsigned) {
  16516. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  16517. goto raise_overflow;
  16518. if (is_negative)
  16519. val = ~val;
  16520. }
  16521. ret = 0;
  16522. done:
  16523. Py_XDECREF(shift);
  16524. Py_XDECREF(mask);
  16525. Py_XDECREF(stepval);
  16526. #endif
  16527. if (unlikely(ret))
  16528. return (int) -1;
  16529. return val;
  16530. }
  16531. raise_overflow:
  16532. PyErr_SetString(PyExc_OverflowError,
  16533. "value too large to convert to int");
  16534. return (int) -1;
  16535. raise_neg_overflow:
  16536. PyErr_SetString(PyExc_OverflowError,
  16537. "can't convert negative value to int");
  16538. return (int) -1;
  16539. }
  16540. /* PyObjectVectorCallKwBuilder (used by CIntToPy) */
  16541. #if CYTHON_VECTORCALL
  16542. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16543. (void)__Pyx_PyObject_FastCallDict;
  16544. if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
  16545. Py_INCREF(key);
  16546. args[n] = value;
  16547. return 0;
  16548. }
  16549. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16550. (void)__Pyx_VectorcallBuilder_AddArgStr;
  16551. if (unlikely(!PyUnicode_Check(key))) {
  16552. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  16553. return -1;
  16554. }
  16555. return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
  16556. }
  16557. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16558. PyObject *pyKey = PyUnicode_FromString(key);
  16559. if (!pyKey) return -1;
  16560. return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
  16561. }
  16562. #else // CYTHON_VECTORCALL
  16563. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
  16564. if (unlikely(!PyUnicode_Check(key))) {
  16565. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  16566. return -1;
  16567. }
  16568. return PyDict_SetItem(builder, key, value);
  16569. }
  16570. #endif
  16571. /* CIntToPy */
  16572. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
  16573. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16574. #pragma GCC diagnostic push
  16575. #pragma GCC diagnostic ignored "-Wconversion"
  16576. #endif
  16577. const int neg_one = (int) -1, const_zero = (int) 0;
  16578. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16579. #pragma GCC diagnostic pop
  16580. #endif
  16581. const int is_unsigned = neg_one > const_zero;
  16582. if (is_unsigned) {
  16583. if (sizeof(int) < sizeof(long)) {
  16584. return PyLong_FromLong((long) value);
  16585. } else if (sizeof(int) <= sizeof(unsigned long)) {
  16586. return PyLong_FromUnsignedLong((unsigned long) value);
  16587. #if !CYTHON_COMPILING_IN_PYPY
  16588. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  16589. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16590. #endif
  16591. }
  16592. } else {
  16593. if (sizeof(int) <= sizeof(long)) {
  16594. return PyLong_FromLong((long) value);
  16595. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  16596. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16597. }
  16598. }
  16599. {
  16600. unsigned char *bytes = (unsigned char *)&value;
  16601. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  16602. if (is_unsigned) {
  16603. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  16604. } else {
  16605. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  16606. }
  16607. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16608. int one = 1; int little = (int)*(unsigned char *)&one;
  16609. return _PyLong_FromByteArray(bytes, sizeof(int),
  16610. little, !is_unsigned);
  16611. #else
  16612. int one = 1; int little = (int)*(unsigned char *)&one;
  16613. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  16614. PyObject *py_bytes = NULL, *order_str = NULL;
  16615. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16616. if (!from_bytes) return NULL;
  16617. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
  16618. if (!py_bytes) goto limited_bad;
  16619. order_str = PyUnicode_FromString(little ? "little" : "big");
  16620. if (!order_str) goto limited_bad;
  16621. {
  16622. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  16623. if (!is_unsigned) {
  16624. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  16625. if (!kwds) goto limited_bad;
  16626. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  16627. }
  16628. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  16629. }
  16630. limited_bad:
  16631. Py_XDECREF(kwds);
  16632. Py_XDECREF(order_str);
  16633. Py_XDECREF(py_bytes);
  16634. Py_XDECREF(from_bytes);
  16635. return result;
  16636. #endif
  16637. }
  16638. }
  16639. /* CIntToPy */
  16640. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  16641. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16642. #pragma GCC diagnostic push
  16643. #pragma GCC diagnostic ignored "-Wconversion"
  16644. #endif
  16645. const long neg_one = (long) -1, const_zero = (long) 0;
  16646. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16647. #pragma GCC diagnostic pop
  16648. #endif
  16649. const int is_unsigned = neg_one > const_zero;
  16650. if (is_unsigned) {
  16651. if (sizeof(long) < sizeof(long)) {
  16652. return PyLong_FromLong((long) value);
  16653. } else if (sizeof(long) <= sizeof(unsigned long)) {
  16654. return PyLong_FromUnsignedLong((unsigned long) value);
  16655. #if !CYTHON_COMPILING_IN_PYPY
  16656. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  16657. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16658. #endif
  16659. }
  16660. } else {
  16661. if (sizeof(long) <= sizeof(long)) {
  16662. return PyLong_FromLong((long) value);
  16663. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  16664. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16665. }
  16666. }
  16667. {
  16668. unsigned char *bytes = (unsigned char *)&value;
  16669. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  16670. if (is_unsigned) {
  16671. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  16672. } else {
  16673. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  16674. }
  16675. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16676. int one = 1; int little = (int)*(unsigned char *)&one;
  16677. return _PyLong_FromByteArray(bytes, sizeof(long),
  16678. little, !is_unsigned);
  16679. #else
  16680. int one = 1; int little = (int)*(unsigned char *)&one;
  16681. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  16682. PyObject *py_bytes = NULL, *order_str = NULL;
  16683. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16684. if (!from_bytes) return NULL;
  16685. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  16686. if (!py_bytes) goto limited_bad;
  16687. order_str = PyUnicode_FromString(little ? "little" : "big");
  16688. if (!order_str) goto limited_bad;
  16689. {
  16690. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  16691. if (!is_unsigned) {
  16692. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  16693. if (!kwds) goto limited_bad;
  16694. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  16695. }
  16696. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  16697. }
  16698. limited_bad:
  16699. Py_XDECREF(kwds);
  16700. Py_XDECREF(order_str);
  16701. Py_XDECREF(py_bytes);
  16702. Py_XDECREF(from_bytes);
  16703. return result;
  16704. #endif
  16705. }
  16706. }
  16707. /* CIntFromPy */
  16708. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
  16709. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16710. #pragma GCC diagnostic push
  16711. #pragma GCC diagnostic ignored "-Wconversion"
  16712. #endif
  16713. const long neg_one = (long) -1, const_zero = (long) 0;
  16714. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16715. #pragma GCC diagnostic pop
  16716. #endif
  16717. const int is_unsigned = neg_one > const_zero;
  16718. if (unlikely(!PyLong_Check(x))) {
  16719. long val;
  16720. PyObject *tmp = __Pyx_PyNumber_Long(x);
  16721. if (!tmp) return (long) -1;
  16722. val = __Pyx_PyLong_As_long(tmp);
  16723. Py_DECREF(tmp);
  16724. return val;
  16725. }
  16726. if (is_unsigned) {
  16727. #if CYTHON_USE_PYLONG_INTERNALS
  16728. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16729. goto raise_neg_overflow;
  16730. } else if (__Pyx_PyLong_IsCompact(x)) {
  16731. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16732. } else {
  16733. const digit* digits = __Pyx_PyLong_Digits(x);
  16734. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16735. switch (__Pyx_PyLong_DigitCount(x)) {
  16736. case 2:
  16737. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16738. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16739. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16740. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  16741. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16742. }
  16743. }
  16744. break;
  16745. case 3:
  16746. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16747. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16748. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16749. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  16750. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16751. }
  16752. }
  16753. break;
  16754. case 4:
  16755. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16756. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16757. __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])))
  16758. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  16759. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16760. }
  16761. }
  16762. break;
  16763. }
  16764. }
  16765. #endif
  16766. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16767. if (unlikely(Py_SIZE(x) < 0)) {
  16768. goto raise_neg_overflow;
  16769. }
  16770. #else
  16771. {
  16772. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16773. if (unlikely(result < 0))
  16774. return (long) -1;
  16775. if (unlikely(result == 1))
  16776. goto raise_neg_overflow;
  16777. }
  16778. #endif
  16779. if ((sizeof(long) <= sizeof(unsigned long))) {
  16780. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  16781. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  16782. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16783. }
  16784. } else {
  16785. #if CYTHON_USE_PYLONG_INTERNALS
  16786. if (__Pyx_PyLong_IsCompact(x)) {
  16787. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16788. } else {
  16789. const digit* digits = __Pyx_PyLong_Digits(x);
  16790. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16791. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16792. case -2:
  16793. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  16794. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16795. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16796. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16797. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16798. }
  16799. }
  16800. break;
  16801. case 2:
  16802. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16803. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16804. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16805. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16806. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16807. }
  16808. }
  16809. break;
  16810. case -3:
  16811. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16812. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16813. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16814. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16815. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16816. }
  16817. }
  16818. break;
  16819. case 3:
  16820. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16821. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16822. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16823. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16824. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16825. }
  16826. }
  16827. break;
  16828. case -4:
  16829. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16830. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16831. __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])))
  16832. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16833. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16834. }
  16835. }
  16836. break;
  16837. case 4:
  16838. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16839. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16840. __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])))
  16841. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16842. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16843. }
  16844. }
  16845. break;
  16846. }
  16847. }
  16848. #endif
  16849. if ((sizeof(long) <= sizeof(long))) {
  16850. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  16851. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  16852. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  16853. }
  16854. }
  16855. {
  16856. long val;
  16857. int ret = -1;
  16858. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  16859. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  16860. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  16861. if (unlikely(bytes_copied == -1)) {
  16862. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  16863. goto raise_overflow;
  16864. } else {
  16865. ret = 0;
  16866. }
  16867. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16868. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16869. unsigned char *bytes = (unsigned char *)&val;
  16870. ret = _PyLong_AsByteArray((PyLongObject *)x,
  16871. bytes, sizeof(val),
  16872. is_little, !is_unsigned);
  16873. #else
  16874. PyObject *v;
  16875. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16876. int bits, remaining_bits, is_negative = 0;
  16877. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16878. if (likely(PyLong_CheckExact(x))) {
  16879. v = __Pyx_NewRef(x);
  16880. } else {
  16881. v = PyNumber_Long(x);
  16882. if (unlikely(!v)) return (long) -1;
  16883. assert(PyLong_CheckExact(v));
  16884. }
  16885. {
  16886. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  16887. if (unlikely(result < 0)) {
  16888. Py_DECREF(v);
  16889. return (long) -1;
  16890. }
  16891. is_negative = result == 1;
  16892. }
  16893. if (is_unsigned && unlikely(is_negative)) {
  16894. Py_DECREF(v);
  16895. goto raise_neg_overflow;
  16896. } else if (is_negative) {
  16897. stepval = PyNumber_Invert(v);
  16898. Py_DECREF(v);
  16899. if (unlikely(!stepval))
  16900. return (long) -1;
  16901. } else {
  16902. stepval = v;
  16903. }
  16904. v = NULL;
  16905. val = (long) 0;
  16906. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16907. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16908. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  16909. PyObject *tmp, *digit;
  16910. long idigit;
  16911. digit = PyNumber_And(stepval, mask);
  16912. if (unlikely(!digit)) goto done;
  16913. idigit = PyLong_AsLong(digit);
  16914. Py_DECREF(digit);
  16915. if (unlikely(idigit < 0)) goto done;
  16916. val |= ((long) idigit) << bits;
  16917. tmp = PyNumber_Rshift(stepval, shift);
  16918. if (unlikely(!tmp)) goto done;
  16919. Py_DECREF(stepval); stepval = tmp;
  16920. }
  16921. Py_DECREF(shift); shift = NULL;
  16922. Py_DECREF(mask); mask = NULL;
  16923. {
  16924. long idigit = PyLong_AsLong(stepval);
  16925. if (unlikely(idigit < 0)) goto done;
  16926. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  16927. if (unlikely(idigit >= (1L << remaining_bits)))
  16928. goto raise_overflow;
  16929. val |= ((long) idigit) << bits;
  16930. }
  16931. if (!is_unsigned) {
  16932. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  16933. goto raise_overflow;
  16934. if (is_negative)
  16935. val = ~val;
  16936. }
  16937. ret = 0;
  16938. done:
  16939. Py_XDECREF(shift);
  16940. Py_XDECREF(mask);
  16941. Py_XDECREF(stepval);
  16942. #endif
  16943. if (unlikely(ret))
  16944. return (long) -1;
  16945. return val;
  16946. }
  16947. raise_overflow:
  16948. PyErr_SetString(PyExc_OverflowError,
  16949. "value too large to convert to long");
  16950. return (long) -1;
  16951. raise_neg_overflow:
  16952. PyErr_SetString(PyExc_OverflowError,
  16953. "can't convert negative value to long");
  16954. return (long) -1;
  16955. }
  16956. /* FormatTypeName */
  16957. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  16958. static __Pyx_TypeName
  16959. __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  16960. {
  16961. PyObject *module = NULL, *name = NULL, *result = NULL;
  16962. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  16963. name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  16964. __pyx_mstate_global->__pyx_n_u_qualname);
  16965. #else
  16966. name = PyType_GetQualName(tp);
  16967. #endif
  16968. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
  16969. module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  16970. __pyx_mstate_global->__pyx_n_u_module);
  16971. if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
  16972. if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
  16973. result = name;
  16974. name = NULL;
  16975. goto done;
  16976. }
  16977. result = PyUnicode_FromFormat("%U.%U", module, name);
  16978. if (unlikely(result == NULL)) goto bad;
  16979. done:
  16980. Py_XDECREF(name);
  16981. Py_XDECREF(module);
  16982. return result;
  16983. bad:
  16984. PyErr_Clear();
  16985. if (name) {
  16986. result = name;
  16987. name = NULL;
  16988. } else {
  16989. result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2);
  16990. }
  16991. goto done;
  16992. }
  16993. #endif
  16994. /* FastTypeChecks */
  16995. #if CYTHON_COMPILING_IN_CPYTHON
  16996. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  16997. while (a) {
  16998. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  16999. if (a == b)
  17000. return 1;
  17001. }
  17002. return b == &PyBaseObject_Type;
  17003. }
  17004. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  17005. PyObject *mro;
  17006. if (a == b) return 1;
  17007. mro = a->tp_mro;
  17008. if (likely(mro)) {
  17009. Py_ssize_t i, n;
  17010. n = PyTuple_GET_SIZE(mro);
  17011. for (i = 0; i < n; i++) {
  17012. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  17013. return 1;
  17014. }
  17015. return 0;
  17016. }
  17017. return __Pyx_InBases(a, b);
  17018. }
  17019. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  17020. PyObject *mro;
  17021. if (cls == a || cls == b) return 1;
  17022. mro = cls->tp_mro;
  17023. if (likely(mro)) {
  17024. Py_ssize_t i, n;
  17025. n = PyTuple_GET_SIZE(mro);
  17026. for (i = 0; i < n; i++) {
  17027. PyObject *base = PyTuple_GET_ITEM(mro, i);
  17028. if (base == (PyObject *)a || base == (PyObject *)b)
  17029. return 1;
  17030. }
  17031. return 0;
  17032. }
  17033. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  17034. }
  17035. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  17036. if (exc_type1) {
  17037. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  17038. } else {
  17039. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  17040. }
  17041. }
  17042. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  17043. Py_ssize_t i, n;
  17044. assert(PyExceptionClass_Check(exc_type));
  17045. n = PyTuple_GET_SIZE(tuple);
  17046. for (i=0; i<n; i++) {
  17047. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  17048. }
  17049. for (i=0; i<n; i++) {
  17050. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  17051. if (likely(PyExceptionClass_Check(t))) {
  17052. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  17053. } else {
  17054. }
  17055. }
  17056. return 0;
  17057. }
  17058. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  17059. if (likely(err == exc_type)) return 1;
  17060. if (likely(PyExceptionClass_Check(err))) {
  17061. if (likely(PyExceptionClass_Check(exc_type))) {
  17062. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  17063. } else if (likely(PyTuple_Check(exc_type))) {
  17064. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  17065. } else {
  17066. }
  17067. }
  17068. return PyErr_GivenExceptionMatches(err, exc_type);
  17069. }
  17070. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  17071. assert(PyExceptionClass_Check(exc_type1));
  17072. assert(PyExceptionClass_Check(exc_type2));
  17073. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  17074. if (likely(PyExceptionClass_Check(err))) {
  17075. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  17076. }
  17077. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  17078. }
  17079. #endif
  17080. /* GetRuntimeVersion */
  17081. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  17082. void __Pyx_init_runtime_version(void) {
  17083. if (__Pyx_cached_runtime_version == 0) {
  17084. const char* rt_version = Py_GetVersion();
  17085. unsigned long version = 0;
  17086. unsigned long factor = 0x01000000UL;
  17087. unsigned int digit = 0;
  17088. int i = 0;
  17089. while (factor) {
  17090. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  17091. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  17092. ++i;
  17093. }
  17094. version += factor * digit;
  17095. if (rt_version[i] != '.')
  17096. break;
  17097. digit = 0;
  17098. factor >>= 8;
  17099. ++i;
  17100. }
  17101. __Pyx_cached_runtime_version = version;
  17102. }
  17103. }
  17104. #endif
  17105. static unsigned long __Pyx_get_runtime_version(void) {
  17106. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  17107. return Py_Version & ~0xFFUL;
  17108. #else
  17109. return __Pyx_cached_runtime_version;
  17110. #endif
  17111. }
  17112. /* GetTopmostException (used by SaveResetException) */
  17113. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  17114. static _PyErr_StackItem *
  17115. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  17116. {
  17117. _PyErr_StackItem *exc_info = tstate->exc_info;
  17118. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  17119. exc_info->previous_item != NULL)
  17120. {
  17121. exc_info = exc_info->previous_item;
  17122. }
  17123. return exc_info;
  17124. }
  17125. #endif
  17126. /* SaveResetException (used by CoroutineBase) */
  17127. #if CYTHON_FAST_THREAD_STATE
  17128. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17129. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17130. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  17131. PyObject *exc_value = exc_info->exc_value;
  17132. if (exc_value == NULL || exc_value == Py_None) {
  17133. *value = NULL;
  17134. *type = NULL;
  17135. *tb = NULL;
  17136. } else {
  17137. *value = exc_value;
  17138. Py_INCREF(*value);
  17139. *type = (PyObject*) Py_TYPE(exc_value);
  17140. Py_INCREF(*type);
  17141. *tb = PyException_GetTraceback(exc_value);
  17142. }
  17143. #elif CYTHON_USE_EXC_INFO_STACK
  17144. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  17145. *type = exc_info->exc_type;
  17146. *value = exc_info->exc_value;
  17147. *tb = exc_info->exc_traceback;
  17148. Py_XINCREF(*type);
  17149. Py_XINCREF(*value);
  17150. Py_XINCREF(*tb);
  17151. #else
  17152. *type = tstate->exc_type;
  17153. *value = tstate->exc_value;
  17154. *tb = tstate->exc_traceback;
  17155. Py_XINCREF(*type);
  17156. Py_XINCREF(*value);
  17157. Py_XINCREF(*tb);
  17158. #endif
  17159. }
  17160. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  17161. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17162. _PyErr_StackItem *exc_info = tstate->exc_info;
  17163. PyObject *tmp_value = exc_info->exc_value;
  17164. exc_info->exc_value = value;
  17165. Py_XDECREF(tmp_value);
  17166. Py_XDECREF(type);
  17167. Py_XDECREF(tb);
  17168. #else
  17169. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17170. #if CYTHON_USE_EXC_INFO_STACK
  17171. _PyErr_StackItem *exc_info = tstate->exc_info;
  17172. tmp_type = exc_info->exc_type;
  17173. tmp_value = exc_info->exc_value;
  17174. tmp_tb = exc_info->exc_traceback;
  17175. exc_info->exc_type = type;
  17176. exc_info->exc_value = value;
  17177. exc_info->exc_traceback = tb;
  17178. #else
  17179. tmp_type = tstate->exc_type;
  17180. tmp_value = tstate->exc_value;
  17181. tmp_tb = tstate->exc_traceback;
  17182. tstate->exc_type = type;
  17183. tstate->exc_value = value;
  17184. tstate->exc_traceback = tb;
  17185. #endif
  17186. Py_XDECREF(tmp_type);
  17187. Py_XDECREF(tmp_value);
  17188. Py_XDECREF(tmp_tb);
  17189. #endif
  17190. }
  17191. #endif
  17192. /* SwapException (used by CoroutineBase) */
  17193. #if CYTHON_FAST_THREAD_STATE
  17194. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17195. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17196. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17197. _PyErr_StackItem *exc_info = tstate->exc_info;
  17198. tmp_value = exc_info->exc_value;
  17199. exc_info->exc_value = *value;
  17200. if (tmp_value == NULL || tmp_value == Py_None) {
  17201. Py_XDECREF(tmp_value);
  17202. tmp_value = NULL;
  17203. tmp_type = NULL;
  17204. tmp_tb = NULL;
  17205. } else {
  17206. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  17207. Py_INCREF(tmp_type);
  17208. #if CYTHON_COMPILING_IN_CPYTHON
  17209. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  17210. Py_XINCREF(tmp_tb);
  17211. #else
  17212. tmp_tb = PyException_GetTraceback(tmp_value);
  17213. #endif
  17214. }
  17215. #elif CYTHON_USE_EXC_INFO_STACK
  17216. _PyErr_StackItem *exc_info = tstate->exc_info;
  17217. tmp_type = exc_info->exc_type;
  17218. tmp_value = exc_info->exc_value;
  17219. tmp_tb = exc_info->exc_traceback;
  17220. exc_info->exc_type = *type;
  17221. exc_info->exc_value = *value;
  17222. exc_info->exc_traceback = *tb;
  17223. #else
  17224. tmp_type = tstate->exc_type;
  17225. tmp_value = tstate->exc_value;
  17226. tmp_tb = tstate->exc_traceback;
  17227. tstate->exc_type = *type;
  17228. tstate->exc_value = *value;
  17229. tstate->exc_traceback = *tb;
  17230. #endif
  17231. *type = tmp_type;
  17232. *value = tmp_value;
  17233. *tb = tmp_tb;
  17234. }
  17235. #else
  17236. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  17237. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17238. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  17239. PyErr_SetExcInfo(*type, *value, *tb);
  17240. *type = tmp_type;
  17241. *value = tmp_value;
  17242. *tb = tmp_tb;
  17243. }
  17244. #endif
  17245. /* PyObjectCall2Args (used by PyObjectCallMethod1) */
  17246. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  17247. PyObject *args[3] = {NULL, arg1, arg2};
  17248. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17249. }
  17250. /* PyObjectCallMethod1 (used by CoroutineBase) */
  17251. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  17252. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  17253. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  17254. Py_DECREF(method);
  17255. return result;
  17256. }
  17257. #endif
  17258. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  17259. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  17260. PyObject *args[2] = {obj, arg};
  17261. (void) __Pyx_PyObject_CallOneArg;
  17262. (void) __Pyx_PyObject_Call2Args;
  17263. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  17264. #else
  17265. PyObject *method = NULL, *result;
  17266. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  17267. if (likely(is_method)) {
  17268. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  17269. Py_DECREF(method);
  17270. return result;
  17271. }
  17272. if (unlikely(!method)) return NULL;
  17273. return __Pyx__PyObject_CallMethod1(method, arg);
  17274. #endif
  17275. }
  17276. /* ReturnWithStopIteration (used by CoroutineBase) */
  17277. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
  17278. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
  17279. if (value == Py_None) {
  17280. if (async || !iternext)
  17281. PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
  17282. return;
  17283. }
  17284. __Pyx__ReturnWithStopIteration(value, async);
  17285. }
  17286. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
  17287. #if CYTHON_COMPILING_IN_CPYTHON
  17288. __Pyx_PyThreadState_declare
  17289. #endif
  17290. PyObject *exc;
  17291. PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
  17292. #if CYTHON_COMPILING_IN_CPYTHON
  17293. if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
  17294. if (PY_VERSION_HEX >= (0x030e00A1)) {
  17295. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  17296. } else {
  17297. PyObject *args_tuple = PyTuple_New(1);
  17298. if (unlikely(!args_tuple)) return;
  17299. Py_INCREF(value);
  17300. PyTuple_SET_ITEM(args_tuple, 0, value);
  17301. exc = PyObject_Call(exc_type, args_tuple, NULL);
  17302. Py_DECREF(args_tuple);
  17303. }
  17304. if (unlikely(!exc)) return;
  17305. } else {
  17306. Py_INCREF(value);
  17307. exc = value;
  17308. }
  17309. #if CYTHON_FAST_THREAD_STATE
  17310. __Pyx_PyThreadState_assign
  17311. #if CYTHON_USE_EXC_INFO_STACK
  17312. if (!__pyx_tstate->exc_info->exc_value)
  17313. #else
  17314. if (!__pyx_tstate->exc_type)
  17315. #endif
  17316. {
  17317. Py_INCREF(exc_type);
  17318. __Pyx_ErrRestore(exc_type, exc, NULL);
  17319. return;
  17320. }
  17321. #endif
  17322. #else
  17323. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  17324. if (unlikely(!exc)) return;
  17325. #endif
  17326. PyErr_SetObject(exc_type, exc);
  17327. Py_DECREF(exc);
  17328. }
  17329. /* CoroutineBase (used by Generator) */
  17330. #if !CYTHON_COMPILING_IN_LIMITED_API
  17331. #include <frameobject.h>
  17332. #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  17333. #ifndef Py_BUILD_CORE
  17334. #define Py_BUILD_CORE 1
  17335. #endif
  17336. #include "internal/pycore_frame.h"
  17337. #endif
  17338. #endif // CYTHON_COMPILING_IN_LIMITED_API
  17339. static CYTHON_INLINE void
  17340. __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
  17341. #if CYTHON_USE_AM_SEND
  17342. gen->yieldfrom_am_send = NULL;
  17343. #endif
  17344. Py_CLEAR(gen->yieldfrom);
  17345. }
  17346. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  17347. PyObject *et, *ev, *tb;
  17348. PyObject *value = NULL;
  17349. CYTHON_UNUSED_VAR(__pyx_tstate);
  17350. __Pyx_ErrFetch(&et, &ev, &tb);
  17351. if (!et) {
  17352. Py_XDECREF(tb);
  17353. Py_XDECREF(ev);
  17354. Py_INCREF(Py_None);
  17355. *pvalue = Py_None;
  17356. return 0;
  17357. }
  17358. if (likely(et == PyExc_StopIteration)) {
  17359. if (!ev) {
  17360. Py_INCREF(Py_None);
  17361. value = Py_None;
  17362. }
  17363. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17364. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  17365. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  17366. if (unlikely(!value)) goto limited_api_failure;
  17367. #else
  17368. value = ((PyStopIterationObject *)ev)->value;
  17369. Py_INCREF(value);
  17370. #endif
  17371. Py_DECREF(ev);
  17372. }
  17373. else if (unlikely(PyTuple_Check(ev))) {
  17374. Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
  17375. #if !CYTHON_ASSUME_SAFE_SIZE
  17376. if (unlikely(tuple_size < 0)) {
  17377. Py_XDECREF(tb);
  17378. Py_DECREF(ev);
  17379. Py_DECREF(et);
  17380. return -1;
  17381. }
  17382. #endif
  17383. if (tuple_size >= 1) {
  17384. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17385. value = PyTuple_GET_ITEM(ev, 0);
  17386. Py_INCREF(value);
  17387. #elif CYTHON_ASSUME_SAFE_MACROS
  17388. value = PySequence_ITEM(ev, 0);
  17389. #else
  17390. value = PySequence_GetItem(ev, 0);
  17391. if (!value) goto limited_api_failure;
  17392. #endif
  17393. } else {
  17394. Py_INCREF(Py_None);
  17395. value = Py_None;
  17396. }
  17397. Py_DECREF(ev);
  17398. }
  17399. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  17400. value = ev;
  17401. }
  17402. if (likely(value)) {
  17403. Py_XDECREF(tb);
  17404. Py_DECREF(et);
  17405. *pvalue = value;
  17406. return 0;
  17407. }
  17408. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  17409. __Pyx_ErrRestore(et, ev, tb);
  17410. return -1;
  17411. }
  17412. PyErr_NormalizeException(&et, &ev, &tb);
  17413. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17414. __Pyx_ErrRestore(et, ev, tb);
  17415. return -1;
  17416. }
  17417. Py_XDECREF(tb);
  17418. Py_DECREF(et);
  17419. #if CYTHON_COMPILING_IN_LIMITED_API
  17420. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  17421. #else
  17422. value = ((PyStopIterationObject *)ev)->value;
  17423. Py_INCREF(value);
  17424. #endif
  17425. Py_DECREF(ev);
  17426. #if CYTHON_COMPILING_IN_LIMITED_API
  17427. if (unlikely(!value)) return -1;
  17428. #endif
  17429. *pvalue = value;
  17430. return 0;
  17431. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  17432. limited_api_failure:
  17433. Py_XDECREF(et);
  17434. Py_XDECREF(tb);
  17435. Py_XDECREF(ev);
  17436. return -1;
  17437. #endif
  17438. }
  17439. static CYTHON_INLINE
  17440. __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
  17441. if (*retval) {
  17442. return PYGEN_NEXT;
  17443. } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
  17444. return PYGEN_RETURN;
  17445. } else {
  17446. return PYGEN_ERROR;
  17447. }
  17448. }
  17449. static CYTHON_INLINE
  17450. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  17451. #if PY_VERSION_HEX >= 0x030B00a4
  17452. Py_CLEAR(exc_state->exc_value);
  17453. #else
  17454. PyObject *t, *v, *tb;
  17455. t = exc_state->exc_type;
  17456. v = exc_state->exc_value;
  17457. tb = exc_state->exc_traceback;
  17458. exc_state->exc_type = NULL;
  17459. exc_state->exc_value = NULL;
  17460. exc_state->exc_traceback = NULL;
  17461. Py_XDECREF(t);
  17462. Py_XDECREF(v);
  17463. Py_XDECREF(tb);
  17464. #endif
  17465. }
  17466. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  17467. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  17468. const char *msg;
  17469. CYTHON_MAYBE_UNUSED_VAR(gen);
  17470. if ((0)) {
  17471. #ifdef __Pyx_Coroutine_USED
  17472. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  17473. msg = "coroutine already executing";
  17474. #endif
  17475. #ifdef __Pyx_AsyncGen_USED
  17476. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  17477. msg = "async generator already executing";
  17478. #endif
  17479. } else {
  17480. msg = "generator already executing";
  17481. }
  17482. PyErr_SetString(PyExc_ValueError, msg);
  17483. }
  17484. static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  17485. CYTHON_MAYBE_UNUSED_VAR(gen);
  17486. CYTHON_MAYBE_UNUSED_VAR(closing);
  17487. #ifdef __Pyx_Coroutine_USED
  17488. if (!closing && __Pyx_Coroutine_Check(gen)) {
  17489. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  17490. } else
  17491. #endif
  17492. if (value) {
  17493. #ifdef __Pyx_AsyncGen_USED
  17494. if (__Pyx_AsyncGen_CheckExact(gen))
  17495. PyErr_SetNone(PyExc_StopAsyncIteration);
  17496. else
  17497. #endif
  17498. PyErr_SetNone(PyExc_StopIteration);
  17499. }
  17500. }
  17501. static
  17502. __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
  17503. __Pyx_PyThreadState_declare
  17504. PyThreadState *tstate;
  17505. __Pyx_ExcInfoStruct *exc_state;
  17506. PyObject *retval;
  17507. assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running
  17508. if (unlikely(self->resume_label == -1)) {
  17509. __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  17510. return PYGEN_ERROR;
  17511. }
  17512. #if CYTHON_FAST_THREAD_STATE
  17513. __Pyx_PyThreadState_assign
  17514. tstate = __pyx_tstate;
  17515. #else
  17516. tstate = __Pyx_PyThreadState_Current;
  17517. #endif
  17518. exc_state = &self->gi_exc_state;
  17519. if (exc_state->exc_value) {
  17520. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  17521. #else
  17522. PyObject *exc_tb;
  17523. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17524. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17525. #elif PY_VERSION_HEX >= 0x030B00a4
  17526. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  17527. #else
  17528. exc_tb = exc_state->exc_traceback;
  17529. #endif
  17530. if (exc_tb) {
  17531. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17532. PyFrameObject *f = tb->tb_frame;
  17533. assert(f->f_back == NULL);
  17534. #if PY_VERSION_HEX >= 0x030B00A1
  17535. f->f_back = PyThreadState_GetFrame(tstate);
  17536. #else
  17537. Py_XINCREF(tstate->frame);
  17538. f->f_back = tstate->frame;
  17539. #endif
  17540. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17541. Py_DECREF(exc_tb);
  17542. #endif
  17543. }
  17544. #endif
  17545. }
  17546. #if CYTHON_USE_EXC_INFO_STACK
  17547. exc_state->previous_item = tstate->exc_info;
  17548. tstate->exc_info = exc_state;
  17549. #else
  17550. if (exc_state->exc_type) {
  17551. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17552. } else {
  17553. __Pyx_Coroutine_ExceptionClear(exc_state);
  17554. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17555. }
  17556. #endif
  17557. retval = self->body(self, tstate, value);
  17558. #if CYTHON_USE_EXC_INFO_STACK
  17559. exc_state = &self->gi_exc_state;
  17560. tstate->exc_info = exc_state->previous_item;
  17561. exc_state->previous_item = NULL;
  17562. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  17563. #endif
  17564. *result = retval;
  17565. if (self->resume_label == -1) {
  17566. return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
  17567. }
  17568. return PYGEN_NEXT;
  17569. }
  17570. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  17571. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  17572. CYTHON_UNUSED_VAR(exc_state);
  17573. #else
  17574. PyObject *exc_tb;
  17575. #if PY_VERSION_HEX >= 0x030B00a4
  17576. if (!exc_state->exc_value) return;
  17577. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17578. #else
  17579. exc_tb = exc_state->exc_traceback;
  17580. #endif
  17581. if (likely(exc_tb)) {
  17582. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17583. PyFrameObject *f = tb->tb_frame;
  17584. Py_CLEAR(f->f_back);
  17585. #if PY_VERSION_HEX >= 0x030B00a4
  17586. Py_DECREF(exc_tb);
  17587. #endif
  17588. }
  17589. #endif
  17590. }
  17591. #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
  17592. ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
  17593. static PyObject *
  17594. __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
  17595. CYTHON_MAYBE_UNUSED_VAR(gen);
  17596. if (likely(result == PYGEN_RETURN)) {
  17597. int is_async = 0;
  17598. #ifdef __Pyx_AsyncGen_USED
  17599. is_async = __Pyx_AsyncGen_CheckExact(gen);
  17600. #endif
  17601. __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
  17602. Py_XDECREF(retval);
  17603. }
  17604. return NULL;
  17605. }
  17606. #if CYTHON_COMPILING_IN_CPYTHON
  17607. static CYTHON_INLINE
  17608. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  17609. #if PY_VERSION_HEX <= 0x030A00A1
  17610. return _PyGen_Send(gen, arg);
  17611. #else
  17612. PyObject *result;
  17613. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  17614. if (PyAsyncGen_CheckExact(gen)) {
  17615. assert(result == Py_None);
  17616. PyErr_SetNone(PyExc_StopAsyncIteration);
  17617. }
  17618. else if (result == Py_None) {
  17619. PyErr_SetNone(PyExc_StopIteration);
  17620. }
  17621. else {
  17622. #if PY_VERSION_HEX < 0x030d00A1
  17623. _PyGen_SetStopIterationValue(result);
  17624. #else
  17625. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  17626. PyErr_SetObject(PyExc_StopIteration, result);
  17627. } else {
  17628. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  17629. if (likely(exc != NULL)) {
  17630. PyErr_SetObject(PyExc_StopIteration, exc);
  17631. Py_DECREF(exc);
  17632. }
  17633. }
  17634. #endif
  17635. }
  17636. Py_DECREF(result);
  17637. result = NULL;
  17638. }
  17639. return result;
  17640. #endif
  17641. }
  17642. #endif
  17643. static CYTHON_INLINE __Pyx_PySendResult
  17644. __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
  17645. __Pyx_PySendResult result;
  17646. PyObject *val = NULL;
  17647. assert(__Pyx_Coroutine_get_is_running(gen));
  17648. __Pyx_Coroutine_Undelegate(gen);
  17649. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  17650. result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
  17651. Py_XDECREF(val);
  17652. return result;
  17653. }
  17654. #if CYTHON_USE_AM_SEND
  17655. static __Pyx_PySendResult
  17656. __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
  17657. PyObject *ret = NULL;
  17658. __Pyx_PySendResult delegate_result, result;
  17659. assert(__Pyx_Coroutine_get_is_running(gen));
  17660. delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
  17661. if (delegate_result == PYGEN_NEXT) {
  17662. assert (ret != NULL);
  17663. *retval = ret;
  17664. return PYGEN_NEXT;
  17665. }
  17666. assert (delegate_result != PYGEN_ERROR || ret == NULL);
  17667. __Pyx_Coroutine_Undelegate(gen);
  17668. result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
  17669. Py_XDECREF(ret);
  17670. return result;
  17671. }
  17672. #endif
  17673. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  17674. PyObject *retval = NULL;
  17675. __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
  17676. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  17677. }
  17678. static __Pyx_PySendResult
  17679. __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
  17680. __Pyx_PySendResult result;
  17681. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17682. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17683. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  17684. return PYGEN_ERROR;
  17685. }
  17686. #if CYTHON_USE_AM_SEND
  17687. if (gen->yieldfrom_am_send) {
  17688. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
  17689. } else
  17690. #endif
  17691. if (gen->yieldfrom) {
  17692. PyObject *yf = gen->yieldfrom;
  17693. PyObject *ret;
  17694. #if !CYTHON_USE_AM_SEND
  17695. #ifdef __Pyx_Generator_USED
  17696. if (__Pyx_Generator_CheckExact(yf)) {
  17697. ret = __Pyx_Coroutine_Send(yf, value);
  17698. } else
  17699. #endif
  17700. #ifdef __Pyx_Coroutine_USED
  17701. if (__Pyx_Coroutine_Check(yf)) {
  17702. ret = __Pyx_Coroutine_Send(yf, value);
  17703. } else
  17704. #endif
  17705. #ifdef __Pyx_AsyncGen_USED
  17706. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17707. ret = __Pyx_async_gen_asend_send(yf, value);
  17708. } else
  17709. #endif
  17710. #if CYTHON_COMPILING_IN_CPYTHON
  17711. if (PyGen_CheckExact(yf)) {
  17712. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17713. } else
  17714. if (PyCoro_CheckExact(yf)) {
  17715. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17716. } else
  17717. #endif
  17718. #endif
  17719. {
  17720. #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
  17721. if (value == Py_None && PyIter_Check(yf))
  17722. ret = __Pyx_PyIter_Next_Plain(yf);
  17723. else
  17724. #endif
  17725. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
  17726. }
  17727. if (likely(ret)) {
  17728. __Pyx_Coroutine_unset_is_running(gen);
  17729. *retval = ret;
  17730. return PYGEN_NEXT;
  17731. }
  17732. result = __Pyx_Coroutine_FinishDelegation(gen, retval);
  17733. } else {
  17734. result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
  17735. }
  17736. __Pyx_Coroutine_unset_is_running(gen);
  17737. return result;
  17738. }
  17739. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  17740. __Pyx_PySendResult result;
  17741. PyObject *retval = NULL;
  17742. CYTHON_UNUSED_VAR(gen);
  17743. assert(__Pyx_Coroutine_get_is_running(gen));
  17744. #ifdef __Pyx_Generator_USED
  17745. if (__Pyx_Generator_CheckExact(yf)) {
  17746. result = __Pyx_Coroutine_Close(yf, &retval);
  17747. } else
  17748. #endif
  17749. #ifdef __Pyx_Coroutine_USED
  17750. if (__Pyx_Coroutine_Check(yf)) {
  17751. result = __Pyx_Coroutine_Close(yf, &retval);
  17752. } else
  17753. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17754. result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
  17755. } else
  17756. #endif
  17757. #ifdef __Pyx_AsyncGen_USED
  17758. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17759. retval = __Pyx_async_gen_asend_close(yf, NULL);
  17760. result = PYGEN_RETURN;
  17761. } else
  17762. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  17763. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  17764. result = PYGEN_RETURN;
  17765. } else
  17766. #endif
  17767. {
  17768. PyObject *meth;
  17769. result = PYGEN_RETURN;
  17770. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
  17771. if (unlikely(!meth)) {
  17772. if (unlikely(PyErr_Occurred())) {
  17773. PyErr_WriteUnraisable(yf);
  17774. }
  17775. } else {
  17776. retval = __Pyx_PyObject_CallNoArg(meth);
  17777. Py_DECREF(meth);
  17778. if (unlikely(!retval)) {
  17779. result = PYGEN_ERROR;
  17780. }
  17781. }
  17782. }
  17783. Py_XDECREF(retval);
  17784. return result == PYGEN_ERROR ? -1 : 0;
  17785. }
  17786. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  17787. __Pyx_PySendResult result;
  17788. PyObject *retval = NULL;
  17789. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17790. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17791. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17792. }
  17793. #if CYTHON_USE_AM_SEND
  17794. if (gen->yieldfrom_am_send) {
  17795. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
  17796. } else
  17797. #endif
  17798. if (gen->yieldfrom) {
  17799. PyObject *yf = gen->yieldfrom;
  17800. PyObject *ret;
  17801. #ifdef __Pyx_Generator_USED
  17802. if (__Pyx_Generator_CheckExact(yf)) {
  17803. ret = __Pyx_Generator_Next(yf);
  17804. } else
  17805. #endif
  17806. #ifdef __Pyx_Coroutine_USED
  17807. if (__Pyx_Coroutine_CheckExact(yf)) {
  17808. ret = __Pyx_Coroutine_Send(yf, Py_None);
  17809. } else
  17810. #endif
  17811. #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
  17812. if (PyGen_CheckExact(yf)) {
  17813. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  17814. } else
  17815. #endif
  17816. ret = __Pyx_PyIter_Next_Plain(yf);
  17817. if (likely(ret)) {
  17818. __Pyx_Coroutine_unset_is_running(gen);
  17819. return ret;
  17820. }
  17821. result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
  17822. } else {
  17823. result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  17824. }
  17825. __Pyx_Coroutine_unset_is_running(gen);
  17826. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
  17827. }
  17828. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  17829. PyObject *retval = NULL;
  17830. __Pyx_PySendResult result;
  17831. CYTHON_UNUSED_VAR(arg);
  17832. result = __Pyx_Coroutine_Close(self, &retval);
  17833. if (unlikely(result == PYGEN_ERROR))
  17834. return NULL;
  17835. Py_XDECREF(retval);
  17836. Py_RETURN_NONE;
  17837. }
  17838. static __Pyx_PySendResult
  17839. __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
  17840. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17841. __Pyx_PySendResult result;
  17842. PyObject *yf;
  17843. int err = 0;
  17844. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17845. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  17846. return PYGEN_ERROR;
  17847. }
  17848. yf = gen->yieldfrom;
  17849. if (yf) {
  17850. Py_INCREF(yf);
  17851. err = __Pyx_Coroutine_CloseIter(gen, yf);
  17852. __Pyx_Coroutine_Undelegate(gen);
  17853. Py_DECREF(yf);
  17854. }
  17855. if (err == 0)
  17856. PyErr_SetNone(PyExc_GeneratorExit);
  17857. result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
  17858. if (result == PYGEN_ERROR) {
  17859. __Pyx_PyThreadState_declare
  17860. __Pyx_PyThreadState_assign
  17861. __Pyx_Coroutine_unset_is_running(gen);
  17862. if (!__Pyx_PyErr_Occurred()) {
  17863. return PYGEN_RETURN;
  17864. } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
  17865. __Pyx_PyErr_Clear();
  17866. return PYGEN_RETURN;
  17867. }
  17868. return PYGEN_ERROR;
  17869. } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
  17870. __Pyx_Coroutine_unset_is_running(gen);
  17871. return PYGEN_RETURN;
  17872. } else {
  17873. const char *msg;
  17874. Py_DECREF(*retval);
  17875. *retval = NULL;
  17876. if ((0)) {
  17877. #ifdef __Pyx_Coroutine_USED
  17878. } else if (__Pyx_Coroutine_Check(self)) {
  17879. msg = "coroutine ignored GeneratorExit";
  17880. #endif
  17881. #ifdef __Pyx_AsyncGen_USED
  17882. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  17883. msg = "async generator ignored GeneratorExit";
  17884. #endif
  17885. } else {
  17886. msg = "generator ignored GeneratorExit";
  17887. }
  17888. PyErr_SetString(PyExc_RuntimeError, msg);
  17889. __Pyx_Coroutine_unset_is_running(gen);
  17890. return PYGEN_ERROR;
  17891. }
  17892. }
  17893. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  17894. PyObject *args, int close_on_genexit) {
  17895. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17896. PyObject *yf;
  17897. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
  17898. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17899. yf = gen->yieldfrom;
  17900. if (yf) {
  17901. __Pyx_PySendResult result;
  17902. PyObject *ret;
  17903. Py_INCREF(yf);
  17904. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  17905. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  17906. Py_DECREF(yf);
  17907. __Pyx_Coroutine_Undelegate(gen);
  17908. if (err < 0)
  17909. goto propagate_exception;
  17910. goto throw_here;
  17911. }
  17912. if (0
  17913. #ifdef __Pyx_Generator_USED
  17914. || __Pyx_Generator_CheckExact(yf)
  17915. #endif
  17916. #ifdef __Pyx_Coroutine_USED
  17917. || __Pyx_Coroutine_Check(yf)
  17918. #endif
  17919. ) {
  17920. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  17921. #ifdef __Pyx_Coroutine_USED
  17922. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17923. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  17924. #endif
  17925. } else {
  17926. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
  17927. if (unlikely(!meth)) {
  17928. Py_DECREF(yf);
  17929. if (unlikely(PyErr_Occurred())) {
  17930. __Pyx_Coroutine_unset_is_running(gen);
  17931. return NULL;
  17932. }
  17933. __Pyx_Coroutine_Undelegate(gen);
  17934. goto throw_here;
  17935. }
  17936. if (likely(args)) {
  17937. ret = __Pyx_PyObject_Call(meth, args, NULL);
  17938. } else {
  17939. PyObject *cargs[4] = {NULL, typ, val, tb};
  17940. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17941. }
  17942. Py_DECREF(meth);
  17943. }
  17944. Py_DECREF(yf);
  17945. if (ret) {
  17946. __Pyx_Coroutine_unset_is_running(gen);
  17947. return ret;
  17948. }
  17949. result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
  17950. __Pyx_Coroutine_unset_is_running(gen);
  17951. return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
  17952. }
  17953. throw_here:
  17954. __Pyx_Raise(typ, val, tb, NULL);
  17955. propagate_exception:
  17956. {
  17957. PyObject *retval = NULL;
  17958. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
  17959. __Pyx_Coroutine_unset_is_running(gen);
  17960. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  17961. }
  17962. }
  17963. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  17964. PyObject *typ;
  17965. PyObject *val = NULL;
  17966. PyObject *tb = NULL;
  17967. if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
  17968. return NULL;
  17969. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  17970. }
  17971. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  17972. #if PY_VERSION_HEX >= 0x030B00a4
  17973. Py_VISIT(exc_state->exc_value);
  17974. #else
  17975. Py_VISIT(exc_state->exc_type);
  17976. Py_VISIT(exc_state->exc_value);
  17977. Py_VISIT(exc_state->exc_traceback);
  17978. #endif
  17979. return 0;
  17980. }
  17981. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  17982. {
  17983. int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
  17984. if (e) return e;
  17985. }
  17986. Py_VISIT(gen->closure);
  17987. Py_VISIT(gen->classobj);
  17988. Py_VISIT(gen->yieldfrom);
  17989. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  17990. }
  17991. static int __Pyx_Coroutine_clear(PyObject *self) {
  17992. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17993. Py_CLEAR(gen->closure);
  17994. Py_CLEAR(gen->classobj);
  17995. __Pyx_Coroutine_Undelegate(gen);
  17996. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  17997. #ifdef __Pyx_AsyncGen_USED
  17998. if (__Pyx_AsyncGen_CheckExact(self)) {
  17999. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  18000. }
  18001. #endif
  18002. Py_CLEAR(gen->gi_code);
  18003. Py_CLEAR(gen->gi_frame);
  18004. Py_CLEAR(gen->gi_name);
  18005. Py_CLEAR(gen->gi_qualname);
  18006. Py_CLEAR(gen->gi_modulename);
  18007. return 0;
  18008. }
  18009. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  18010. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  18011. PyObject_GC_UnTrack(gen);
  18012. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  18013. if (gen->gi_weakreflist != NULL)
  18014. #endif
  18015. PyObject_ClearWeakRefs(self);
  18016. if (gen->resume_label >= 0) {
  18017. PyObject_GC_Track(self);
  18018. #if CYTHON_USE_TP_FINALIZE
  18019. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  18020. #else
  18021. {
  18022. destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
  18023. if (del) del(self);
  18024. }
  18025. if (unlikely(Py_REFCNT(self) > 0))
  18026. #endif
  18027. {
  18028. return;
  18029. }
  18030. PyObject_GC_UnTrack(self);
  18031. }
  18032. #ifdef __Pyx_AsyncGen_USED
  18033. if (__Pyx_AsyncGen_CheckExact(self)) {
  18034. /* We have to handle this case for asynchronous generators
  18035. right here, because this code has to be between UNTRACK
  18036. and GC_Del. */
  18037. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  18038. }
  18039. #endif
  18040. __Pyx_Coroutine_clear(self);
  18041. __Pyx_PyHeapTypeObject_GC_Del(gen);
  18042. }
  18043. #if CYTHON_USE_TP_FINALIZE
  18044. static void __Pyx_Coroutine_del(PyObject *self) {
  18045. PyObject *error_type, *error_value, *error_traceback;
  18046. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  18047. __Pyx_PyThreadState_declare
  18048. if (gen->resume_label < 0) {
  18049. return;
  18050. }
  18051. __Pyx_PyThreadState_assign
  18052. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  18053. #ifdef __Pyx_AsyncGen_USED
  18054. if (__Pyx_AsyncGen_CheckExact(self)) {
  18055. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  18056. PyObject *finalizer = agen->ag_finalizer;
  18057. if (finalizer && !agen->ag_closed) {
  18058. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  18059. if (unlikely(!res)) {
  18060. PyErr_WriteUnraisable(self);
  18061. } else {
  18062. Py_DECREF(res);
  18063. }
  18064. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  18065. return;
  18066. }
  18067. }
  18068. #endif
  18069. if (unlikely(gen->resume_label == 0 && !error_value)) {
  18070. #ifdef __Pyx_Coroutine_USED
  18071. #ifdef __Pyx_Generator_USED
  18072. if (!__Pyx_Generator_CheckExact(self))
  18073. #endif
  18074. {
  18075. PyObject_GC_UnTrack(self);
  18076. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  18077. PyErr_WriteUnraisable(self);
  18078. PyObject_GC_Track(self);
  18079. }
  18080. #endif
  18081. } else {
  18082. PyObject *retval = NULL;
  18083. __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
  18084. if (result == PYGEN_ERROR) {
  18085. PyErr_WriteUnraisable(self);
  18086. } else {
  18087. Py_XDECREF(retval);
  18088. }
  18089. }
  18090. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  18091. }
  18092. #endif
  18093. static PyObject *
  18094. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  18095. {
  18096. PyObject *name = self->gi_name;
  18097. CYTHON_UNUSED_VAR(context);
  18098. if (unlikely(!name)) name = Py_None;
  18099. Py_INCREF(name);
  18100. return name;
  18101. }
  18102. static int
  18103. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  18104. {
  18105. CYTHON_UNUSED_VAR(context);
  18106. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  18107. PyErr_SetString(PyExc_TypeError,
  18108. "__name__ must be set to a string object");
  18109. return -1;
  18110. }
  18111. Py_INCREF(value);
  18112. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  18113. return 0;
  18114. }
  18115. static PyObject *
  18116. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  18117. {
  18118. PyObject *name = self->gi_qualname;
  18119. CYTHON_UNUSED_VAR(context);
  18120. if (unlikely(!name)) name = Py_None;
  18121. Py_INCREF(name);
  18122. return name;
  18123. }
  18124. static int
  18125. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  18126. {
  18127. CYTHON_UNUSED_VAR(context);
  18128. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  18129. PyErr_SetString(PyExc_TypeError,
  18130. "__qualname__ must be set to a string object");
  18131. return -1;
  18132. }
  18133. Py_INCREF(value);
  18134. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  18135. return 0;
  18136. }
  18137. static PyObject *
  18138. __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
  18139. {
  18140. #if !CYTHON_COMPILING_IN_LIMITED_API
  18141. PyObject *frame;
  18142. #if PY_VERSION_HEX >= 0x030d0000
  18143. Py_BEGIN_CRITICAL_SECTION(self);
  18144. #endif
  18145. frame = self->gi_frame;
  18146. if (!frame) {
  18147. if (unlikely(!self->gi_code)) {
  18148. Py_RETURN_NONE;
  18149. }
  18150. PyObject *globals = PyDict_New();
  18151. if (unlikely(!globals)) return NULL;
  18152. frame = (PyObject *) PyFrame_New(
  18153. PyThreadState_Get(), /*PyThreadState *tstate,*/
  18154. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  18155. globals, /*PyObject *globals,*/
  18156. 0 /*PyObject *locals*/
  18157. );
  18158. Py_DECREF(globals);
  18159. if (unlikely(!frame))
  18160. return NULL;
  18161. if (unlikely(self->gi_frame)) {
  18162. Py_DECREF(frame);
  18163. frame = self->gi_frame;
  18164. } else {
  18165. self->gi_frame = frame;
  18166. }
  18167. }
  18168. Py_INCREF(frame);
  18169. #if PY_VERSION_HEX >= 0x030d0000
  18170. Py_END_CRITICAL_SECTION();
  18171. #endif
  18172. return frame;
  18173. #else
  18174. CYTHON_UNUSED_VAR(self);
  18175. Py_RETURN_NONE;
  18176. #endif
  18177. }
  18178. static PyObject *
  18179. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
  18180. CYTHON_UNUSED_VAR(context);
  18181. PyObject *frame = self->gi_frame;
  18182. if (frame)
  18183. return __Pyx_NewRef(frame);
  18184. return __Pyx__Coroutine_get_frame(self);
  18185. }
  18186. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  18187. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  18188. PyObject *name, PyObject *qualname, PyObject *module_name) {
  18189. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  18190. if (unlikely(!gen))
  18191. return NULL;
  18192. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  18193. }
  18194. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  18195. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  18196. PyObject *name, PyObject *qualname, PyObject *module_name) {
  18197. gen->body = body;
  18198. gen->closure = closure;
  18199. Py_XINCREF(closure);
  18200. gen->is_running = 0;
  18201. gen->resume_label = 0;
  18202. gen->classobj = NULL;
  18203. gen->yieldfrom = NULL;
  18204. gen->yieldfrom_am_send = NULL;
  18205. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
  18206. gen->gi_exc_state.exc_value = NULL;
  18207. #else
  18208. gen->gi_exc_state.exc_type = NULL;
  18209. gen->gi_exc_state.exc_value = NULL;
  18210. gen->gi_exc_state.exc_traceback = NULL;
  18211. #endif
  18212. #if CYTHON_USE_EXC_INFO_STACK
  18213. gen->gi_exc_state.previous_item = NULL;
  18214. #endif
  18215. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  18216. gen->gi_weakreflist = NULL;
  18217. #endif
  18218. Py_XINCREF(qualname);
  18219. gen->gi_qualname = qualname;
  18220. Py_XINCREF(name);
  18221. gen->gi_name = name;
  18222. Py_XINCREF(module_name);
  18223. gen->gi_modulename = module_name;
  18224. Py_XINCREF(code);
  18225. gen->gi_code = code;
  18226. gen->gi_frame = NULL;
  18227. PyObject_GC_Track(gen);
  18228. return gen;
  18229. }
  18230. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
  18231. char result;
  18232. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18233. Py_BEGIN_CRITICAL_SECTION(gen);
  18234. #endif
  18235. result = gen->is_running;
  18236. gen->is_running = 1;
  18237. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18238. Py_END_CRITICAL_SECTION();
  18239. #endif
  18240. return result;
  18241. }
  18242. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
  18243. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18244. Py_BEGIN_CRITICAL_SECTION(gen);
  18245. #endif
  18246. assert(gen->is_running);
  18247. gen->is_running = 0;
  18248. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18249. Py_END_CRITICAL_SECTION();
  18250. #endif
  18251. }
  18252. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
  18253. char result;
  18254. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18255. Py_BEGIN_CRITICAL_SECTION(gen);
  18256. #endif
  18257. result = gen->is_running;
  18258. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18259. Py_END_CRITICAL_SECTION();
  18260. #endif
  18261. return result;
  18262. }
  18263. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
  18264. CYTHON_UNUSED_VAR(closure);
  18265. char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
  18266. if (result) Py_RETURN_TRUE;
  18267. else Py_RETURN_FALSE;
  18268. }
  18269. #if __PYX_HAS_PY_AM_SEND == 2
  18270. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
  18271. Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
  18272. if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
  18273. return;
  18274. }
  18275. memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
  18276. static_amsend_methods->am_send = am_send;
  18277. type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
  18278. }
  18279. #endif
  18280. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
  18281. CYTHON_UNUSED_VAR(arg);
  18282. __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
  18283. PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
  18284. self_type_name);
  18285. __Pyx_DECREF_TypeName(self_type_name);
  18286. return NULL;
  18287. }
  18288. /* Generator */
  18289. static PyMethodDef __pyx_Generator_methods[] = {
  18290. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  18291. PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  18292. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  18293. PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  18294. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  18295. PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  18296. {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
  18297. {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
  18298. {0, 0, 0, 0}
  18299. };
  18300. static PyMemberDef __pyx_Generator_memberlist[] = {
  18301. {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  18302. PyDoc_STR("object being iterated by 'yield from', or None")},
  18303. {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  18304. {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  18305. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  18306. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  18307. #endif
  18308. {0, 0, 0, 0, 0}
  18309. };
  18310. static PyGetSetDef __pyx_Generator_getsets[] = {
  18311. {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  18312. PyDoc_STR("name of the generator"), 0},
  18313. {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  18314. PyDoc_STR("qualified name of the generator"), 0},
  18315. {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  18316. PyDoc_STR("Frame of the generator"), 0},
  18317. {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
  18318. {0, 0, 0, 0, 0}
  18319. };
  18320. static PyType_Slot __pyx_GeneratorType_slots[] = {
  18321. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  18322. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  18323. {Py_tp_iter, (void *)PyObject_SelfIter},
  18324. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  18325. {Py_tp_methods, (void *)__pyx_Generator_methods},
  18326. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  18327. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  18328. {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
  18329. #if CYTHON_USE_TP_FINALIZE
  18330. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  18331. #endif
  18332. #if __PYX_HAS_PY_AM_SEND == 1
  18333. {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
  18334. #endif
  18335. {0, 0},
  18336. };
  18337. static PyType_Spec __pyx_GeneratorType_spec = {
  18338. __PYX_TYPE_MODULE_PREFIX "generator",
  18339. sizeof(__pyx_CoroutineObject),
  18340. 0,
  18341. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18342. Py_TPFLAGS_MANAGED_WEAKREF |
  18343. #endif
  18344. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  18345. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
  18346. __pyx_GeneratorType_slots
  18347. };
  18348. #if __PYX_HAS_PY_AM_SEND == 2
  18349. static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
  18350. #endif
  18351. static int __pyx_Generator_init(PyObject *module) {
  18352. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  18353. mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
  18354. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
  18355. if (unlikely(!mstate->__pyx_GeneratorType)) {
  18356. return -1;
  18357. }
  18358. #if __PYX_HAS_PY_AM_SEND == 2
  18359. __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
  18360. #endif
  18361. return 0;
  18362. }
  18363. static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
  18364. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  18365. PyObject *retval = NULL;
  18366. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  18367. return __Pyx_Coroutine_AlreadyRunningError(gen);
  18368. }
  18369. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  18370. __Pyx_Coroutine_unset_is_running(gen);
  18371. (void) result;
  18372. assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
  18373. assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
  18374. return retval;
  18375. }
  18376. /* CheckBinaryVersion */
  18377. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  18378. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  18379. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  18380. return 0;
  18381. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  18382. return 1;
  18383. {
  18384. char message[200];
  18385. PyOS_snprintf(message, sizeof(message),
  18386. "compile time Python version %d.%d "
  18387. "of module '%.100s' "
  18388. "%s "
  18389. "runtime version %d.%d",
  18390. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  18391. __Pyx_MODULE_NAME,
  18392. (allow_newer) ? "was newer than" : "does not match",
  18393. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  18394. );
  18395. return PyErr_WarnEx(NULL, message, 1);
  18396. }
  18397. }
  18398. /* NewCodeObj */
  18399. #if CYTHON_COMPILING_IN_LIMITED_API
  18400. static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  18401. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  18402. PyObject *fv, PyObject *cell, PyObject* fn,
  18403. PyObject *name, int fline, PyObject *lnos) {
  18404. PyObject *exception_table = NULL;
  18405. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  18406. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  18407. PyObject *version_info;
  18408. PyObject *py_minor_version = NULL;
  18409. #endif
  18410. long minor_version = 0;
  18411. PyObject *type, *value, *traceback;
  18412. PyErr_Fetch(&type, &value, &traceback);
  18413. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  18414. minor_version = 11;
  18415. #else
  18416. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  18417. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  18418. minor_version = PyLong_AsLong(py_minor_version);
  18419. Py_DECREF(py_minor_version);
  18420. if (minor_version == -1 && PyErr_Occurred()) goto end;
  18421. #endif
  18422. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  18423. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  18424. if (minor_version <= 7) {
  18425. (void)p;
  18426. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
  18427. c, n, v, fn, name, fline, lnos, fv, cell);
  18428. } else if (minor_version <= 10) {
  18429. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
  18430. c, n, v, fn, name, fline, lnos, fv, cell);
  18431. } else {
  18432. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  18433. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
  18434. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  18435. }
  18436. end:
  18437. Py_XDECREF(code_type);
  18438. Py_XDECREF(exception_table);
  18439. Py_XDECREF(types_module);
  18440. if (type) {
  18441. PyErr_Restore(type, value, traceback);
  18442. }
  18443. return result;
  18444. }
  18445. #elif PY_VERSION_HEX >= 0x030B0000
  18446. static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  18447. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  18448. PyObject *fv, PyObject *cell, PyObject* fn,
  18449. PyObject *name, int fline, PyObject *lnos) {
  18450. PyCodeObject *result;
  18451. result =
  18452. #if PY_VERSION_HEX >= 0x030C0000
  18453. PyUnstable_Code_NewWithPosOnlyArgs
  18454. #else
  18455. PyCode_NewWithPosOnlyArgs
  18456. #endif
  18457. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
  18458. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
  18459. if (likely(result))
  18460. result->_co_firsttraceable = 0;
  18461. #endif
  18462. return result;
  18463. }
  18464. #elif !CYTHON_COMPILING_IN_PYPY
  18465. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  18466. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  18467. #else
  18468. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  18469. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  18470. #endif
  18471. static PyObject* __Pyx_PyCode_New(
  18472. const __Pyx_PyCode_New_function_description descr,
  18473. PyObject * const *varnames,
  18474. PyObject *filename,
  18475. PyObject *funcname,
  18476. PyObject *line_table,
  18477. PyObject *tuple_dedup_map
  18478. ) {
  18479. PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
  18480. Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
  18481. PyObject *varnames_tuple = PyTuple_New(var_count);
  18482. if (unlikely(!varnames_tuple)) return NULL;
  18483. for (Py_ssize_t i=0; i < var_count; i++) {
  18484. Py_INCREF(varnames[i]);
  18485. if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
  18486. }
  18487. #if CYTHON_COMPILING_IN_LIMITED_API
  18488. varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
  18489. if (!varnames_tuple_dedup) {
  18490. if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
  18491. varnames_tuple_dedup = varnames_tuple;
  18492. }
  18493. #else
  18494. varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
  18495. if (unlikely(!varnames_tuple_dedup)) goto done;
  18496. #endif
  18497. #if CYTHON_AVOID_BORROWED_REFS
  18498. Py_INCREF(varnames_tuple_dedup);
  18499. #endif
  18500. if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
  18501. Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
  18502. #if !CYTHON_ASSUME_SAFE_SIZE
  18503. if (unlikely(line_table_length == -1)) goto done;
  18504. #endif
  18505. Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
  18506. code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
  18507. if (unlikely(!code_bytes)) goto done;
  18508. char* c_code_bytes = PyBytes_AsString(code_bytes);
  18509. if (unlikely(!c_code_bytes)) goto done;
  18510. memset(c_code_bytes, 0, (size_t) code_len);
  18511. }
  18512. code_obj = (PyObject*) __Pyx__PyCode_New(
  18513. (int) descr.argcount,
  18514. (int) descr.num_posonly_args,
  18515. (int) descr.num_kwonly_args,
  18516. (int) descr.nlocals,
  18517. 0,
  18518. (int) descr.flags,
  18519. code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
  18520. __pyx_mstate_global->__pyx_empty_tuple,
  18521. __pyx_mstate_global->__pyx_empty_tuple,
  18522. varnames_tuple_dedup,
  18523. __pyx_mstate_global->__pyx_empty_tuple,
  18524. __pyx_mstate_global->__pyx_empty_tuple,
  18525. filename,
  18526. funcname,
  18527. (int) descr.first_line,
  18528. (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
  18529. );
  18530. done:
  18531. Py_XDECREF(code_bytes);
  18532. #if CYTHON_AVOID_BORROWED_REFS
  18533. Py_XDECREF(varnames_tuple_dedup);
  18534. #endif
  18535. Py_DECREF(varnames_tuple);
  18536. return code_obj;
  18537. }
  18538. /* DecompressString */
  18539. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
  18540. PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
  18541. const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
  18542. PyObject *methodname = PyUnicode_FromString("decompress");
  18543. if (unlikely(!methodname)) return NULL;
  18544. #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
  18545. if (algo == 3) {
  18546. PyObject *fromlist = Py_BuildValue("[O]", methodname);
  18547. if (unlikely(!fromlist)) goto bad;
  18548. module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
  18549. Py_DECREF(fromlist);
  18550. } else
  18551. #endif
  18552. module = PyImport_ImportModule(module_name);
  18553. if (unlikely(!module)) goto import_failed;
  18554. decompress = PyObject_GetAttr(module, methodname);
  18555. if (unlikely(!decompress)) goto import_failed;
  18556. {
  18557. #ifdef __cplusplus
  18558. char *memview_bytes = const_cast<char*>(s);
  18559. #else
  18560. #if defined(__clang__)
  18561. #pragma clang diagnostic push
  18562. #pragma clang diagnostic ignored "-Wcast-qual"
  18563. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  18564. #pragma GCC diagnostic push
  18565. #pragma GCC diagnostic ignored "-Wcast-qual"
  18566. #endif
  18567. char *memview_bytes = (char*) s;
  18568. #if defined(__clang__)
  18569. #pragma clang diagnostic pop
  18570. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  18571. #pragma GCC diagnostic pop
  18572. #endif
  18573. #endif
  18574. #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
  18575. int memview_flags = 0x100;
  18576. #else
  18577. int memview_flags = PyBUF_READ;
  18578. #endif
  18579. compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
  18580. }
  18581. if (unlikely(!compressed_bytes)) {
  18582. Py_DECREF(decompress);
  18583. goto bad;
  18584. }
  18585. decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
  18586. Py_DECREF(compressed_bytes);
  18587. Py_DECREF(decompress);
  18588. Py_DECREF(module);
  18589. Py_DECREF(methodname);
  18590. return decompressed;
  18591. import_failed:
  18592. PyErr_Format(PyExc_ImportError,
  18593. "Failed to import '%.20s.decompress' - cannot initialise module strings. "
  18594. "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
  18595. module_name, algo);
  18596. bad:
  18597. Py_XDECREF(module);
  18598. Py_DECREF(methodname);
  18599. return NULL;
  18600. }
  18601. #include <string.h>
  18602. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  18603. size_t len = strlen(s);
  18604. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  18605. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  18606. return -1;
  18607. }
  18608. return (Py_ssize_t) len;
  18609. }
  18610. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  18611. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18612. if (unlikely(len < 0)) return NULL;
  18613. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  18614. }
  18615. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  18616. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18617. if (unlikely(len < 0)) return NULL;
  18618. return PyByteArray_FromStringAndSize(c_str, len);
  18619. }
  18620. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  18621. Py_ssize_t ignore;
  18622. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  18623. }
  18624. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  18625. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18626. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  18627. #if CYTHON_COMPILING_IN_LIMITED_API
  18628. {
  18629. const char* result;
  18630. Py_ssize_t unicode_length;
  18631. CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18632. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  18633. if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
  18634. #else
  18635. result = PyUnicode_AsUTF8AndSize(o, length);
  18636. #endif
  18637. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18638. unicode_length = PyUnicode_GetLength(o);
  18639. if (unlikely(unicode_length < 0)) return NULL;
  18640. if (unlikely(unicode_length != *length)) {
  18641. PyUnicode_AsASCIIString(o);
  18642. return NULL;
  18643. }
  18644. #endif
  18645. return result;
  18646. }
  18647. #else
  18648. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18649. if (likely(PyUnicode_IS_ASCII(o))) {
  18650. *length = PyUnicode_GET_LENGTH(o);
  18651. return PyUnicode_AsUTF8(o);
  18652. } else {
  18653. PyUnicode_AsASCIIString(o);
  18654. return NULL;
  18655. }
  18656. #else
  18657. return PyUnicode_AsUTF8AndSize(o, length);
  18658. #endif
  18659. #endif
  18660. }
  18661. #endif
  18662. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18663. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  18664. if (PyUnicode_Check(o)) {
  18665. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  18666. } else
  18667. #endif
  18668. if (PyByteArray_Check(o)) {
  18669. #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
  18670. *length = PyByteArray_GET_SIZE(o);
  18671. return PyByteArray_AS_STRING(o);
  18672. #else
  18673. *length = PyByteArray_Size(o);
  18674. if (*length == -1) return NULL;
  18675. return PyByteArray_AsString(o);
  18676. #endif
  18677. } else
  18678. {
  18679. char* result;
  18680. int r = PyBytes_AsStringAndSize(o, &result, length);
  18681. if (unlikely(r < 0)) {
  18682. return NULL;
  18683. } else {
  18684. return result;
  18685. }
  18686. }
  18687. }
  18688. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  18689. int is_true = x == Py_True;
  18690. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  18691. else return PyObject_IsTrue(x);
  18692. }
  18693. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  18694. int retval;
  18695. if (unlikely(!x)) return -1;
  18696. retval = __Pyx_PyObject_IsTrue(x);
  18697. Py_DECREF(x);
  18698. return retval;
  18699. }
  18700. static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
  18701. __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
  18702. if (PyLong_Check(result)) {
  18703. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  18704. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  18705. "The ability to return an instance of a strict subclass of int is deprecated, "
  18706. "and may be removed in a future version of Python.",
  18707. result_type_name)) {
  18708. __Pyx_DECREF_TypeName(result_type_name);
  18709. Py_DECREF(result);
  18710. return NULL;
  18711. }
  18712. __Pyx_DECREF_TypeName(result_type_name);
  18713. return result;
  18714. }
  18715. PyErr_Format(PyExc_TypeError,
  18716. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
  18717. result_type_name);
  18718. __Pyx_DECREF_TypeName(result_type_name);
  18719. Py_DECREF(result);
  18720. return NULL;
  18721. }
  18722. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
  18723. #if CYTHON_USE_TYPE_SLOTS
  18724. PyNumberMethods *m;
  18725. #endif
  18726. PyObject *res = NULL;
  18727. if (likely(PyLong_Check(x)))
  18728. return __Pyx_NewRef(x);
  18729. #if CYTHON_USE_TYPE_SLOTS
  18730. m = Py_TYPE(x)->tp_as_number;
  18731. if (likely(m && m->nb_int)) {
  18732. res = m->nb_int(x);
  18733. }
  18734. #else
  18735. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  18736. res = PyNumber_Long(x);
  18737. }
  18738. #endif
  18739. if (likely(res)) {
  18740. if (unlikely(!PyLong_CheckExact(res))) {
  18741. return __Pyx_PyNumber_LongWrongResultType(res);
  18742. }
  18743. }
  18744. else if (!PyErr_Occurred()) {
  18745. PyErr_SetString(PyExc_TypeError,
  18746. "an integer is required");
  18747. }
  18748. return res;
  18749. }
  18750. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  18751. Py_ssize_t ival;
  18752. PyObject *x;
  18753. if (likely(PyLong_CheckExact(b))) {
  18754. #if CYTHON_USE_PYLONG_INTERNALS
  18755. if (likely(__Pyx_PyLong_IsCompact(b))) {
  18756. return __Pyx_PyLong_CompactValue(b);
  18757. } else {
  18758. const digit* digits = __Pyx_PyLong_Digits(b);
  18759. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  18760. switch (size) {
  18761. case 2:
  18762. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18763. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18764. }
  18765. break;
  18766. case -2:
  18767. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18768. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18769. }
  18770. break;
  18771. case 3:
  18772. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18773. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18774. }
  18775. break;
  18776. case -3:
  18777. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18778. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18779. }
  18780. break;
  18781. case 4:
  18782. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18783. 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]));
  18784. }
  18785. break;
  18786. case -4:
  18787. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18788. 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]));
  18789. }
  18790. break;
  18791. }
  18792. }
  18793. #endif
  18794. return PyLong_AsSsize_t(b);
  18795. }
  18796. x = PyNumber_Index(b);
  18797. if (!x) return -1;
  18798. ival = PyLong_AsSsize_t(x);
  18799. Py_DECREF(x);
  18800. return ival;
  18801. }
  18802. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  18803. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  18804. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  18805. } else {
  18806. Py_ssize_t ival;
  18807. PyObject *x;
  18808. x = PyNumber_Index(o);
  18809. if (!x) return -1;
  18810. ival = PyLong_AsLong(x);
  18811. Py_DECREF(x);
  18812. return ival;
  18813. }
  18814. }
  18815. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
  18816. CYTHON_UNUSED_VAR(b);
  18817. return __Pyx_NewRef(Py_None);
  18818. }
  18819. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  18820. return __Pyx_NewRef(b ? Py_True: Py_False);
  18821. }
  18822. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
  18823. return PyLong_FromSize_t(ival);
  18824. }
  18825. /* MultiPhaseInitModuleState */
  18826. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  18827. #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18828. #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  18829. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  18830. #else
  18831. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  18832. #endif
  18833. #endif
  18834. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  18835. #error "Module state with PEP489 requires atomics. Currently that's one of\
  18836. C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  18837. #endif
  18838. #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18839. #define __Pyx_ModuleStateLookup_Lock()
  18840. #define __Pyx_ModuleStateLookup_Unlock()
  18841. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  18842. static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  18843. #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  18844. #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  18845. #elif defined(__cplusplus) && __cplusplus >= 201103L
  18846. #include <mutex>
  18847. static std::mutex __Pyx_ModuleStateLookup_mutex;
  18848. #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  18849. #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  18850. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  18851. #include <threads.h>
  18852. static mtx_t __Pyx_ModuleStateLookup_mutex;
  18853. static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  18854. static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
  18855. mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  18856. }
  18857. #define __Pyx_ModuleStateLookup_Lock()\
  18858. call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  18859. mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  18860. #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  18861. #elif defined(HAVE_PTHREAD_H)
  18862. #include <pthread.h>
  18863. static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  18864. #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  18865. #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  18866. #elif defined(_WIN32)
  18867. #include <Windows.h> // synchapi.h on its own doesn't work
  18868. static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  18869. #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  18870. #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  18871. #else
  18872. #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
  18873. Requires C standard >= C11, or C++ standard >= C++11,\
  18874. or pthreads, or the Windows 32 API, or Python >= 3.13."
  18875. #endif
  18876. typedef struct {
  18877. int64_t id;
  18878. PyObject *module;
  18879. } __Pyx_InterpreterIdAndModule;
  18880. typedef struct {
  18881. char interpreter_id_as_index;
  18882. Py_ssize_t count;
  18883. Py_ssize_t allocated;
  18884. __Pyx_InterpreterIdAndModule table[1];
  18885. } __Pyx_ModuleStateLookupData;
  18886. #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  18887. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18888. static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  18889. #endif
  18890. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18891. static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  18892. #else
  18893. static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  18894. #endif
  18895. static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
  18896. __Pyx_InterpreterIdAndModule* table,
  18897. Py_ssize_t count,
  18898. int64_t interpreterId) {
  18899. __Pyx_InterpreterIdAndModule* begin = table;
  18900. __Pyx_InterpreterIdAndModule* end = begin + count;
  18901. if (begin->id == interpreterId) {
  18902. return begin;
  18903. }
  18904. while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  18905. __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
  18906. if (halfway->id == interpreterId) {
  18907. return halfway;
  18908. }
  18909. if (halfway->id < interpreterId) {
  18910. begin = halfway;
  18911. } else {
  18912. end = halfway;
  18913. }
  18914. }
  18915. for (; begin < end; ++begin) {
  18916. if (begin->id >= interpreterId) return begin;
  18917. }
  18918. return begin;
  18919. }
  18920. static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
  18921. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  18922. if (interpreter_id == -1) return NULL;
  18923. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18924. __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  18925. {
  18926. __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18927. if (likely(data)) {
  18928. __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
  18929. if (likely(data == new_data)) {
  18930. goto read_finished;
  18931. }
  18932. }
  18933. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18934. __Pyx_ModuleStateLookup_Lock();
  18935. __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
  18936. data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  18937. __Pyx_ModuleStateLookup_Unlock();
  18938. }
  18939. read_finished:;
  18940. #else
  18941. __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  18942. #endif
  18943. __Pyx_InterpreterIdAndModule* found = NULL;
  18944. if (unlikely(!data)) goto end;
  18945. if (data->interpreter_id_as_index) {
  18946. if (interpreter_id < data->count) {
  18947. found = data->table+interpreter_id;
  18948. }
  18949. } else {
  18950. found = __Pyx_State_FindModuleStateLookupTableLowerBound(
  18951. data->table, data->count, interpreter_id);
  18952. }
  18953. end:
  18954. {
  18955. PyObject *result=NULL;
  18956. if (found && found->id == interpreter_id) {
  18957. result = found->module;
  18958. }
  18959. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18960. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18961. #endif
  18962. return result;
  18963. }
  18964. }
  18965. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18966. static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
  18967. while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  18968. }
  18969. #else
  18970. #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  18971. #endif
  18972. static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
  18973. Py_ssize_t to_allocate = (*old_data)->allocated;
  18974. while (to_allocate <= interpreter_id) {
  18975. if (to_allocate == 0) to_allocate = 1;
  18976. else to_allocate *= 2;
  18977. }
  18978. __Pyx_ModuleStateLookupData *new_data = *old_data;
  18979. if (to_allocate != (*old_data)->allocated) {
  18980. new_data = (__Pyx_ModuleStateLookupData *)realloc(
  18981. *old_data,
  18982. sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  18983. if (!new_data) {
  18984. PyErr_NoMemory();
  18985. return -1;
  18986. }
  18987. for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
  18988. new_data->table[i].id = i;
  18989. new_data->table[i].module = NULL;
  18990. }
  18991. new_data->allocated = to_allocate;
  18992. }
  18993. new_data->table[interpreter_id].module = module;
  18994. if (new_data->count < interpreter_id+1) {
  18995. new_data->count = interpreter_id+1;
  18996. }
  18997. *old_data = new_data;
  18998. return 0;
  18999. }
  19000. static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
  19001. __Pyx_InterpreterIdAndModule *read = data->table;
  19002. __Pyx_InterpreterIdAndModule *write = data->table;
  19003. __Pyx_InterpreterIdAndModule *end = read + data->count;
  19004. for (; read<end; ++read) {
  19005. if (read->module) {
  19006. write->id = read->id;
  19007. write->module = read->module;
  19008. ++write;
  19009. }
  19010. }
  19011. data->count = write - data->table;
  19012. for (; write<end; ++write) {
  19013. write->id = 0;
  19014. write->module = NULL;
  19015. }
  19016. data->interpreter_id_as_index = 0;
  19017. }
  19018. static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
  19019. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  19020. if (interpreter_id == -1) return -1;
  19021. int result = 0;
  19022. __Pyx_ModuleStateLookup_Lock();
  19023. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19024. __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
  19025. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  19026. #else
  19027. __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  19028. #endif
  19029. __Pyx_ModuleStateLookupData *new_data = old_data;
  19030. if (!new_data) {
  19031. new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
  19032. if (!new_data) {
  19033. result = -1;
  19034. PyErr_NoMemory();
  19035. goto end;
  19036. }
  19037. new_data->allocated = 1;
  19038. new_data->interpreter_id_as_index = 1;
  19039. }
  19040. __Pyx_ModuleStateLookup_wait_until_no_readers();
  19041. if (new_data->interpreter_id_as_index) {
  19042. if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  19043. result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
  19044. goto end;
  19045. }
  19046. __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
  19047. }
  19048. {
  19049. Py_ssize_t insert_at = 0;
  19050. {
  19051. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  19052. new_data->table, new_data->count, interpreter_id);
  19053. assert(lower_bound);
  19054. insert_at = lower_bound - new_data->table;
  19055. if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
  19056. lower_bound->module = module;
  19057. goto end; // already in table, nothing more to do
  19058. }
  19059. }
  19060. if (new_data->count+1 >= new_data->allocated) {
  19061. Py_ssize_t to_allocate = (new_data->count+1)*2;
  19062. new_data =
  19063. (__Pyx_ModuleStateLookupData*)realloc(
  19064. new_data,
  19065. sizeof(__Pyx_ModuleStateLookupData) +
  19066. (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  19067. if (!new_data) {
  19068. result = -1;
  19069. new_data = old_data;
  19070. PyErr_NoMemory();
  19071. goto end;
  19072. }
  19073. new_data->allocated = to_allocate;
  19074. }
  19075. ++new_data->count;
  19076. int64_t last_id = interpreter_id;
  19077. PyObject *last_module = module;
  19078. for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
  19079. int64_t current_id = new_data->table[i].id;
  19080. new_data->table[i].id = last_id;
  19081. last_id = current_id;
  19082. PyObject *current_module = new_data->table[i].module;
  19083. new_data->table[i].module = last_module;
  19084. last_module = current_module;
  19085. }
  19086. }
  19087. end:
  19088. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19089. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  19090. #else
  19091. __Pyx_ModuleStateLookup_data = new_data;
  19092. #endif
  19093. __Pyx_ModuleStateLookup_Unlock();
  19094. return result;
  19095. }
  19096. static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
  19097. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  19098. if (interpreter_id == -1) return -1;
  19099. __Pyx_ModuleStateLookup_Lock();
  19100. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19101. __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
  19102. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  19103. #else
  19104. __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  19105. #endif
  19106. if (data->interpreter_id_as_index) {
  19107. if (interpreter_id < data->count) {
  19108. data->table[interpreter_id].module = NULL;
  19109. }
  19110. goto done;
  19111. }
  19112. {
  19113. __Pyx_ModuleStateLookup_wait_until_no_readers();
  19114. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  19115. data->table, data->count, interpreter_id);
  19116. if (!lower_bound) goto done;
  19117. if (lower_bound->id != interpreter_id) goto done;
  19118. __Pyx_InterpreterIdAndModule *end = data->table+data->count;
  19119. for (;lower_bound<end-1; ++lower_bound) {
  19120. lower_bound->id = (lower_bound+1)->id;
  19121. lower_bound->module = (lower_bound+1)->module;
  19122. }
  19123. }
  19124. --data->count;
  19125. if (data->count == 0) {
  19126. free(data);
  19127. data = NULL;
  19128. }
  19129. done:
  19130. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19131. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  19132. #else
  19133. __Pyx_ModuleStateLookup_data = data;
  19134. #endif
  19135. __Pyx_ModuleStateLookup_Unlock();
  19136. return 0;
  19137. }
  19138. #endif
  19139. /* #### Code section: utility_code_pragmas_end ### */
  19140. #ifdef _MSC_VER
  19141. #pragma warning( pop )
  19142. #endif
  19143. /* #### Code section: end ### */
  19144. #endif /* Py_PYTHON_H */