iup.c 815 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815
  1. /* Generated by Cython 3.2.2 */
  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_2"
  35. #define CYTHON_HEX_VERSION 0x030202F0
  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. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1130. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1131. #define __PYX_DEFAULT_STRING_ENCODING ""
  1132. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1133. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1134. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1135. #define __Pyx_long_cast(x) ((long)x)
  1136. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1137. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1138. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1139. likely(v < (type)PY_SSIZE_T_MAX ||\
  1140. v == (type)PY_SSIZE_T_MAX) &&\
  1141. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1142. v == (type)PY_SSIZE_T_MIN))) ||\
  1143. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1144. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1145. v == (type)PY_SSIZE_T_MAX))) )
  1146. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1147. return (size_t) i < (size_t) limit;
  1148. }
  1149. #if defined (__cplusplus) && __cplusplus >= 201103L
  1150. #include <cstdlib>
  1151. #define __Pyx_sst_abs(value) std::abs(value)
  1152. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1153. #define __Pyx_sst_abs(value) abs(value)
  1154. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1155. #define __Pyx_sst_abs(value) labs(value)
  1156. #elif defined (_MSC_VER)
  1157. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1158. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1159. #define __Pyx_sst_abs(value) llabs(value)
  1160. #elif defined (__GNUC__)
  1161. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1162. #else
  1163. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1164. #endif
  1165. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1166. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1167. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1168. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1169. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1170. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1171. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1172. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1173. #if CYTHON_ASSUME_SAFE_MACROS
  1174. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1175. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1176. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1177. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1178. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1179. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1180. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
  1181. #else
  1182. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
  1183. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
  1184. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
  1185. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
  1186. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
  1187. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
  1188. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
  1189. #endif
  1190. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1191. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1192. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1193. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1194. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1195. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1196. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1197. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1198. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1199. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1200. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1201. static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
  1202. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
  1203. return Py_NewRef(obj);
  1204. #else
  1205. Py_INCREF(obj);
  1206. return obj;
  1207. #endif
  1208. }
  1209. static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
  1210. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
  1211. return Py_XNewRef(obj);
  1212. #else
  1213. Py_XINCREF(obj);
  1214. return obj;
  1215. #endif
  1216. }
  1217. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
  1218. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1219. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1220. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1221. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
  1222. #define __Pyx_PySequence_Tuple(obj)\
  1223. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1224. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1225. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
  1226. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1227. #if CYTHON_ASSUME_SAFE_MACROS
  1228. #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1229. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
  1230. #else
  1231. #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1232. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
  1233. #endif
  1234. #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
  1235. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1236. #if CYTHON_USE_PYLONG_INTERNALS
  1237. #if PY_VERSION_HEX >= 0x030C00A7
  1238. #ifndef _PyLong_SIGN_MASK
  1239. #define _PyLong_SIGN_MASK 3
  1240. #endif
  1241. #ifndef _PyLong_NON_SIZE_BITS
  1242. #define _PyLong_NON_SIZE_BITS 3
  1243. #endif
  1244. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1245. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1246. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1247. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1248. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1249. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1250. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1251. #define __Pyx_PyLong_SignedDigitCount(x)\
  1252. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1253. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1254. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1255. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1256. #else
  1257. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1258. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1259. #endif
  1260. typedef Py_ssize_t __Pyx_compact_pylong;
  1261. typedef size_t __Pyx_compact_upylong;
  1262. #else
  1263. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1264. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1265. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1266. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1267. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1268. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1269. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1270. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1271. #define __Pyx_PyLong_CompactValue(x)\
  1272. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1273. typedef sdigit __Pyx_compact_pylong;
  1274. typedef digit __Pyx_compact_upylong;
  1275. #endif
  1276. #if PY_VERSION_HEX >= 0x030C00A5
  1277. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1278. #else
  1279. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1280. #endif
  1281. #endif
  1282. #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  1283. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1284. #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1285. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
  1286. #else
  1287. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1288. #endif
  1289. /* Test for GCC > 2.95 */
  1290. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1291. #define likely(x) __builtin_expect(!!(x), 1)
  1292. #define unlikely(x) __builtin_expect(!!(x), 0)
  1293. #else /* !__GNUC__ or GCC < 2.95 */
  1294. #define likely(x) (x)
  1295. #define unlikely(x) (x)
  1296. #endif /* __GNUC__ */
  1297. /* PretendToInitialize */
  1298. #ifdef __cplusplus
  1299. #if __cplusplus > 201103L
  1300. #include <type_traits>
  1301. #endif
  1302. template <typename T>
  1303. static void __Pyx_pretend_to_initialize(T* ptr) {
  1304. #if __cplusplus > 201103L
  1305. if ((std::is_trivially_default_constructible<T>::value))
  1306. #endif
  1307. *ptr = T();
  1308. (void)ptr;
  1309. }
  1310. #else
  1311. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1312. #endif
  1313. #if !CYTHON_USE_MODULE_STATE
  1314. static PyObject *__pyx_m = NULL;
  1315. #endif
  1316. static int __pyx_lineno;
  1317. static int __pyx_clineno = 0;
  1318. static const char * const __pyx_cfilenm = __FILE__;
  1319. static const char *__pyx_filename;
  1320. /* #### Code section: filename_table ### */
  1321. static const char* const __pyx_f[] = {
  1322. "Lib/fontTools/varLib/iup.py",
  1323. };
  1324. /* #### Code section: utility_code_proto_before_types ### */
  1325. /* Atomics.proto (used by UnpackUnboundCMethod) */
  1326. #include <pythread.h>
  1327. #ifndef CYTHON_ATOMICS
  1328. #define CYTHON_ATOMICS 1
  1329. #endif
  1330. #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
  1331. #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1332. #define __pyx_atomic_int_type int
  1333. #define __pyx_nonatomic_int_type int
  1334. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1335. (__STDC_VERSION__ >= 201112L) &&\
  1336. !defined(__STDC_NO_ATOMICS__))
  1337. #include <stdatomic.h>
  1338. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1339. (__cplusplus >= 201103L) ||\
  1340. (defined(_MSC_VER) && _MSC_VER >= 1700)))
  1341. #include <atomic>
  1342. #endif
  1343. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1344. (__STDC_VERSION__ >= 201112L) &&\
  1345. !defined(__STDC_NO_ATOMICS__) &&\
  1346. ATOMIC_INT_LOCK_FREE == 2)
  1347. #undef __pyx_atomic_int_type
  1348. #define __pyx_atomic_int_type atomic_int
  1349. #define __pyx_atomic_ptr_type atomic_uintptr_t
  1350. #define __pyx_nonatomic_ptr_type uintptr_t
  1351. #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
  1352. #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
  1353. #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
  1354. #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
  1355. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1356. #define __pyx_atomic_load(value) atomic_load(value)
  1357. #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
  1358. #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
  1359. #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
  1360. #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1361. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1362. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1363. #pragma message ("Using standard C atomics")
  1364. #elif defined(__PYX_DEBUG_ATOMICS)
  1365. #warning "Using standard C atomics"
  1366. #endif
  1367. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1368. (__cplusplus >= 201103L) ||\
  1369. \
  1370. (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
  1371. ATOMIC_INT_LOCK_FREE == 2)
  1372. #undef __pyx_atomic_int_type
  1373. #define __pyx_atomic_int_type std::atomic_int
  1374. #define __pyx_atomic_ptr_type std::atomic_uintptr_t
  1375. #define __pyx_nonatomic_ptr_type uintptr_t
  1376. #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
  1377. #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
  1378. #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
  1379. #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
  1380. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1381. #define __pyx_atomic_load(value) std::atomic_load(value)
  1382. #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
  1383. #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
  1384. #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
  1385. #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1386. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1387. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1388. #pragma message ("Using standard C++ atomics")
  1389. #elif defined(__PYX_DEBUG_ATOMICS)
  1390. #warning "Using standard C++ atomics"
  1391. #endif
  1392. #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
  1393. (__GNUC_MINOR__ > 1 ||\
  1394. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
  1395. #define __pyx_atomic_ptr_type void*
  1396. #define __pyx_nonatomic_ptr_type void*
  1397. #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
  1398. #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
  1399. #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
  1400. #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
  1401. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1402. __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1403. int result = old == *expected;
  1404. *expected = old;
  1405. return result;
  1406. }
  1407. #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
  1408. #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
  1409. #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
  1410. #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
  1411. #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
  1412. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1413. __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1414. int result = old == *expected;
  1415. *expected = old;
  1416. return result;
  1417. }
  1418. #ifdef __PYX_DEBUG_ATOMICS
  1419. #warning "Using GNU atomics"
  1420. #endif
  1421. #elif CYTHON_ATOMICS && defined(_MSC_VER)
  1422. #include <intrin.h>
  1423. #undef __pyx_atomic_int_type
  1424. #define __pyx_atomic_int_type long
  1425. #define __pyx_atomic_ptr_type void*
  1426. #undef __pyx_nonatomic_int_type
  1427. #define __pyx_nonatomic_int_type long
  1428. #define __pyx_nonatomic_ptr_type void*
  1429. #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
  1430. #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
  1431. #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
  1432. #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
  1433. #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
  1434. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1435. __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
  1436. int result = old == *expected;
  1437. *expected = old;
  1438. return result;
  1439. }
  1440. #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
  1441. #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
  1442. #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
  1443. #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
  1444. #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
  1445. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1446. __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
  1447. int result = old == *expected;
  1448. *expected = old;
  1449. return result;
  1450. }
  1451. #ifdef __PYX_DEBUG_ATOMICS
  1452. #pragma message ("Using MSVC atomics")
  1453. #endif
  1454. #else
  1455. #undef CYTHON_ATOMICS
  1456. #define CYTHON_ATOMICS 0
  1457. #ifdef __PYX_DEBUG_ATOMICS
  1458. #warning "Not using atomics"
  1459. #endif
  1460. #endif
  1461. /* CriticalSectionsDefinition.proto (used by CriticalSections) */
  1462. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1463. #define __Pyx_PyCriticalSection void*
  1464. #define __Pyx_PyCriticalSection2 void*
  1465. #define __Pyx_PyCriticalSection_End(cs)
  1466. #define __Pyx_PyCriticalSection2_End(cs)
  1467. #else
  1468. #define __Pyx_PyCriticalSection PyCriticalSection
  1469. #define __Pyx_PyCriticalSection2 PyCriticalSection2
  1470. #define __Pyx_PyCriticalSection_End PyCriticalSection_End
  1471. #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
  1472. #endif
  1473. /* CriticalSections.proto (used by ParseKeywordsImpl) */
  1474. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1475. #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
  1476. #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
  1477. #else
  1478. #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
  1479. #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
  1480. #endif
  1481. #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1482. #define __Pyx_BEGIN_CRITICAL_SECTION(o) {
  1483. #define __Pyx_END_CRITICAL_SECTION() }
  1484. #else
  1485. #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
  1486. #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
  1487. #endif
  1488. /* IncludeStructmemberH.proto (used by FixUpExtensionType) */
  1489. #include <structmember.h>
  1490. /* #### Code section: numeric_typedefs ### */
  1491. /* #### Code section: complex_type_declarations ### */
  1492. /* #### Code section: type_declarations ### */
  1493. /*--- Type declarations ---*/
  1494. struct __pyx_defaults;
  1495. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  1496. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  1497. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  1498. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  1499. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  1500. /* "fontTools/varLib/iup.py":293
  1501. *
  1502. *
  1503. * @cython.locals( # <<<<<<<<<<<<<<
  1504. * i=cython.int,
  1505. * j=cython.int,
  1506. */
  1507. struct __pyx_defaults {
  1508. PyObject_HEAD
  1509. PyObject *arg0;
  1510. };
  1511. /* "fontTools/varLib/iup.py":169
  1512. *
  1513. *
  1514. * @cython.cfunc # <<<<<<<<<<<<<<
  1515. * @cython.inline
  1516. * @cython.locals(
  1517. */
  1518. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between {
  1519. PyObject_HEAD
  1520. PyObject *__pyx_v_tolerance;
  1521. };
  1522. /* "fontTools/varLib/iup.py":197
  1523. *
  1524. * return all(
  1525. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  1526. * for (x, y), (p, q) in zip(deltas, interp)
  1527. * )
  1528. */
  1529. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr {
  1530. PyObject_HEAD
  1531. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_outer_scope;
  1532. PyObject *__pyx_genexpr_arg_0;
  1533. int __pyx_v_i;
  1534. int __pyx_v_j;
  1535. double __pyx_v_p;
  1536. double __pyx_v_q;
  1537. double __pyx_v_x;
  1538. double __pyx_v_y;
  1539. };
  1540. /* "fontTools/varLib/iup.py":363
  1541. *
  1542. *
  1543. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  1544. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  1545. * ) -> _DeltaOrNoneSegment:
  1546. */
  1547. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize {
  1548. PyObject_HEAD
  1549. PyObject *__pyx_v_d0;
  1550. PyObject *__pyx_v_tolerance;
  1551. };
  1552. /* "fontTools/varLib/iup.py":378
  1553. *
  1554. * # If all are within tolerance distance of 0, encode nothing:
  1555. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  1556. * return [None] * n
  1557. *
  1558. */
  1559. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr {
  1560. PyObject_HEAD
  1561. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1562. PyObject *__pyx_genexpr_arg_0;
  1563. PyObject *__pyx_v_p;
  1564. };
  1565. /* "fontTools/varLib/iup.py":387
  1566. * # If all deltas are exactly the same, return just one (the first one):
  1567. * d0 = deltas[0]
  1568. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  1569. * return [d0] + [None] * (n - 1)
  1570. *
  1571. */
  1572. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr {
  1573. PyObject_HEAD
  1574. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1575. PyObject *__pyx_genexpr_arg_0;
  1576. PyObject *__pyx_v_d;
  1577. };
  1578. /* #### Code section: utility_code_proto ### */
  1579. /* --- Runtime support code (head) --- */
  1580. /* Refnanny.proto */
  1581. #ifndef CYTHON_REFNANNY
  1582. #define CYTHON_REFNANNY 0
  1583. #endif
  1584. #if CYTHON_REFNANNY
  1585. typedef struct {
  1586. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1587. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1588. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1589. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1590. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1591. void (*FinishContext)(void**);
  1592. } __Pyx_RefNannyAPIStruct;
  1593. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1594. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1595. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1596. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1597. if (acquire_gil) {\
  1598. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1599. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1600. PyGILState_Release(__pyx_gilstate_save);\
  1601. } else {\
  1602. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1603. }
  1604. #define __Pyx_RefNannyFinishContextNogil() {\
  1605. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1606. __Pyx_RefNannyFinishContext();\
  1607. PyGILState_Release(__pyx_gilstate_save);\
  1608. }
  1609. #define __Pyx_RefNannyFinishContextNogil() {\
  1610. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1611. __Pyx_RefNannyFinishContext();\
  1612. PyGILState_Release(__pyx_gilstate_save);\
  1613. }
  1614. #define __Pyx_RefNannyFinishContext()\
  1615. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1616. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1617. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1618. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1619. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1620. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1621. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1622. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1623. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1624. #else
  1625. #define __Pyx_RefNannyDeclarations
  1626. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1627. #define __Pyx_RefNannyFinishContextNogil()
  1628. #define __Pyx_RefNannyFinishContext()
  1629. #define __Pyx_INCREF(r) Py_INCREF(r)
  1630. #define __Pyx_DECREF(r) Py_DECREF(r)
  1631. #define __Pyx_GOTREF(r)
  1632. #define __Pyx_GIVEREF(r)
  1633. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1634. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1635. #define __Pyx_XGOTREF(r)
  1636. #define __Pyx_XGIVEREF(r)
  1637. #endif
  1638. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1639. PyObject *tmp = (PyObject *) r;\
  1640. r = v; Py_XDECREF(tmp);\
  1641. } while (0)
  1642. #define __Pyx_XDECREF_SET(r, v) do {\
  1643. PyObject *tmp = (PyObject *) r;\
  1644. r = v; __Pyx_XDECREF(tmp);\
  1645. } while (0)
  1646. #define __Pyx_DECREF_SET(r, v) do {\
  1647. PyObject *tmp = (PyObject *) r;\
  1648. r = v; __Pyx_DECREF(tmp);\
  1649. } while (0)
  1650. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1651. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1652. /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
  1653. #if CYTHON_FAST_THREAD_STATE
  1654. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1655. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1656. #else
  1657. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1658. #endif
  1659. /* PyThreadStateGet.proto (used by PyErrFetchRestore) */
  1660. #if CYTHON_FAST_THREAD_STATE
  1661. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1662. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1663. #if PY_VERSION_HEX >= 0x030C00A6
  1664. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1665. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1666. #else
  1667. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1668. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1669. #endif
  1670. #else
  1671. #define __Pyx_PyThreadState_declare
  1672. #define __Pyx_PyThreadState_assign
  1673. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1674. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1675. #endif
  1676. /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
  1677. #if CYTHON_FAST_THREAD_STATE
  1678. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1679. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1680. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1681. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1682. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1683. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1684. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1685. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1686. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1687. #else
  1688. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1689. #endif
  1690. #else
  1691. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1692. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1693. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1694. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1695. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1696. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1697. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1698. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1699. #endif
  1700. /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
  1701. #if CYTHON_USE_TYPE_SLOTS
  1702. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1703. #else
  1704. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1705. #endif
  1706. /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
  1707. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1708. /* GetBuiltinName.proto */
  1709. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1710. /* SetItemInt.proto */
  1711. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1712. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1713. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
  1714. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  1715. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  1716. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  1717. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  1718. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  1719. /* GetItemInt.proto */
  1720. #define __Pyx_GetItemInt(o, i, 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_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
  1723. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1724. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1725. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1726. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1727. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  1728. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1729. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1730. int wraparound, int boundscheck, int unsafe_shared);
  1731. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  1732. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1733. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  1734. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1735. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1736. int wraparound, int boundscheck, int unsafe_shared);
  1737. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1738. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1739. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  1740. /* ListExtend.proto */
  1741. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1742. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2
  1743. return PyList_Extend(L, v);
  1744. #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  1745. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1746. if (unlikely(!none))
  1747. return -1;
  1748. Py_DECREF(none);
  1749. return 0;
  1750. #else
  1751. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1752. #endif
  1753. }
  1754. /* ListAppend.proto */
  1755. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1756. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1757. PyListObject* L = (PyListObject*) list;
  1758. Py_ssize_t len = Py_SIZE(list);
  1759. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1760. Py_INCREF(x);
  1761. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1762. L->ob_item[len] = x;
  1763. #else
  1764. PyList_SET_ITEM(list, len, x);
  1765. #endif
  1766. __Pyx_SET_SIZE(list, len + 1);
  1767. return 0;
  1768. }
  1769. return PyList_Append(list, x);
  1770. }
  1771. #else
  1772. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1773. #endif
  1774. /* PyObjectCall.proto */
  1775. #if CYTHON_COMPILING_IN_CPYTHON
  1776. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1777. #else
  1778. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1779. #endif
  1780. /* TupleAndListFromArray.proto (used by fastcall) */
  1781. #if CYTHON_COMPILING_IN_CPYTHON
  1782. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1783. #endif
  1784. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
  1785. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1786. #endif
  1787. /* IncludeStringH.proto (used by BytesEquals) */
  1788. #include <string.h>
  1789. /* BytesEquals.proto (used by UnicodeEquals) */
  1790. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1791. /* UnicodeEquals.proto (used by fastcall) */
  1792. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1793. /* fastcall.proto */
  1794. #if CYTHON_AVOID_BORROWED_REFS
  1795. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
  1796. #elif CYTHON_ASSUME_SAFE_MACROS
  1797. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
  1798. #else
  1799. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
  1800. #endif
  1801. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1802. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1803. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1804. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1805. #if CYTHON_METH_FASTCALL
  1806. #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
  1807. #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
  1808. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1809. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1810. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1811. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1812. #else
  1813. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1814. #endif
  1815. #else
  1816. #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
  1817. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1818. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1819. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1820. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1821. #endif
  1822. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1823. #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  1824. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
  1825. #else
  1826. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1827. #endif
  1828. /* py_dict_items.proto (used by OwnedDictNext) */
  1829. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
  1830. /* CallCFunction.proto (used by CallUnboundCMethod0) */
  1831. #define __Pyx_CallCFunction(cfunc, self, args)\
  1832. ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
  1833. #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
  1834. ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
  1835. #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
  1836. ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
  1837. #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
  1838. ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)
  1839. /* PyObjectCallMethO.proto (used by PyObjectFastCall) */
  1840. #if CYTHON_COMPILING_IN_CPYTHON
  1841. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1842. #endif
  1843. /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
  1844. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1845. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);
  1846. /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
  1847. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1848. /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
  1849. typedef struct {
  1850. PyObject *type;
  1851. PyObject **method_name;
  1852. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
  1853. __pyx_atomic_int_type initialized;
  1854. #endif
  1855. PyCFunction func;
  1856. PyObject *method;
  1857. int flag;
  1858. } __Pyx_CachedCFunction;
  1859. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1860. static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
  1861. #if !CYTHON_ATOMICS
  1862. return 1;
  1863. #else
  1864. __pyx_nonatomic_int_type expected = 0;
  1865. if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
  1866. return 0;
  1867. }
  1868. return expected;
  1869. #endif
  1870. }
  1871. static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
  1872. #if CYTHON_ATOMICS
  1873. __pyx_atomic_store(&cfunc->initialized, 2);
  1874. #endif
  1875. }
  1876. #else
  1877. #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
  1878. #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
  1879. #endif
  1880. /* CallUnboundCMethod0.proto */
  1881. CYTHON_UNUSED
  1882. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1883. #if CYTHON_COMPILING_IN_CPYTHON
  1884. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1885. #else
  1886. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  1887. #endif
  1888. /* py_dict_values.proto (used by OwnedDictNext) */
  1889. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);
  1890. /* OwnedDictNext.proto (used by ParseKeywordsImpl) */
  1891. #if CYTHON_AVOID_BORROWED_REFS
  1892. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
  1893. #else
  1894. CYTHON_INLINE
  1895. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
  1896. #endif
  1897. /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
  1898. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1899. /* ParseKeywordsImpl.export */
  1900. static int __Pyx_ParseKeywordsTuple(
  1901. PyObject *kwds,
  1902. PyObject * const *kwvalues,
  1903. PyObject ** const argnames[],
  1904. PyObject *kwds2,
  1905. PyObject *values[],
  1906. Py_ssize_t num_pos_args,
  1907. Py_ssize_t num_kwargs,
  1908. const char* function_name,
  1909. int ignore_unknown_kwargs
  1910. );
  1911. static int __Pyx_ParseKeywordDictToDict(
  1912. PyObject *kwds,
  1913. PyObject ** const argnames[],
  1914. PyObject *kwds2,
  1915. PyObject *values[],
  1916. Py_ssize_t num_pos_args,
  1917. const char* function_name
  1918. );
  1919. static int __Pyx_ParseKeywordDict(
  1920. PyObject *kwds,
  1921. PyObject ** const argnames[],
  1922. PyObject *values[],
  1923. Py_ssize_t num_pos_args,
  1924. Py_ssize_t num_kwargs,
  1925. const char* function_name,
  1926. int ignore_unknown_kwargs
  1927. );
  1928. /* CallUnboundCMethod2.proto */
  1929. CYTHON_UNUSED
  1930. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
  1931. #if CYTHON_COMPILING_IN_CPYTHON
  1932. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
  1933. #else
  1934. #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
  1935. #endif
  1936. /* ParseKeywords.proto */
  1937. static CYTHON_INLINE int __Pyx_ParseKeywords(
  1938. PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
  1939. PyObject *kwds2, PyObject *values[],
  1940. Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
  1941. const char* function_name,
  1942. int ignore_unknown_kwargs
  1943. );
  1944. /* RaiseArgTupleInvalid.proto */
  1945. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1946. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1947. /* AssertionsEnabled.proto */
  1948. #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000
  1949. static int __pyx_assertions_enabled_flag;
  1950. #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  1951. #if __clang__ || __GNUC__
  1952. __attribute__((no_sanitize("thread")))
  1953. #endif
  1954. static int __Pyx_init_assertions_enabled(void) {
  1955. PyObject *builtins, *debug, *debug_str;
  1956. int flag;
  1957. builtins = PyEval_GetBuiltins();
  1958. if (!builtins) goto bad;
  1959. debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
  1960. if (!debug_str) goto bad;
  1961. debug = PyObject_GetItem(builtins, debug_str);
  1962. Py_DECREF(debug_str);
  1963. if (!debug) goto bad;
  1964. flag = PyObject_IsTrue(debug);
  1965. Py_DECREF(debug);
  1966. if (flag == -1) goto bad;
  1967. __pyx_assertions_enabled_flag = flag;
  1968. return 0;
  1969. bad:
  1970. __pyx_assertions_enabled_flag = 1;
  1971. return -1;
  1972. }
  1973. #else
  1974. #define __Pyx_init_assertions_enabled() (0)
  1975. #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
  1976. #endif
  1977. /* PyAssertionError_Check.proto */
  1978. #define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError)
  1979. /* RaiseException.export */
  1980. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1981. /* PySequenceContains.proto */
  1982. static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
  1983. int result = PySequence_Contains(seq, item);
  1984. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  1985. }
  1986. /* PyLongBinop.proto */
  1987. #if !CYTHON_COMPILING_IN_PYPY
  1988. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1989. #else
  1990. #define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1991. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1992. #endif
  1993. /* ListCompAppend.proto */
  1994. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1995. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1996. PyListObject* L = (PyListObject*) list;
  1997. Py_ssize_t len = Py_SIZE(list);
  1998. if (likely(L->allocated > len)) {
  1999. Py_INCREF(x);
  2000. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2001. L->ob_item[len] = x;
  2002. #else
  2003. PyList_SET_ITEM(list, len, x);
  2004. #endif
  2005. __Pyx_SET_SIZE(list, len + 1);
  2006. return 0;
  2007. }
  2008. return PyList_Append(list, x);
  2009. }
  2010. #else
  2011. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  2012. #endif
  2013. /* IterNextPlain.proto (used by IterNext) */
  2014. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
  2015. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2016. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
  2017. #endif
  2018. /* IterNext.proto */
  2019. #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
  2020. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
  2021. /* PyLongCompare.proto */
  2022. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2023. /* SliceObject.proto */
  2024. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  2025. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  2026. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  2027. int has_cstart, int has_cstop, int wraparound);
  2028. /* ObjectGetItem.proto */
  2029. #if CYTHON_USE_TYPE_SLOTS
  2030. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  2031. #else
  2032. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  2033. #endif
  2034. /* PyLongBinop.proto */
  2035. #if !CYTHON_COMPILING_IN_PYPY
  2036. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2037. #else
  2038. #define __Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
  2039. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  2040. #endif
  2041. /* PyDictVersioning.proto (used by GetModuleGlobalName) */
  2042. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  2043. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  2044. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  2045. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  2046. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  2047. (cache_var) = (value);
  2048. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  2049. static PY_UINT64_T __pyx_dict_version = 0;\
  2050. static PyObject *__pyx_dict_cached_value = NULL;\
  2051. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  2052. (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
  2053. } else {\
  2054. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  2055. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  2056. }\
  2057. }
  2058. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  2059. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  2060. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  2061. #else
  2062. #define __PYX_GET_DICT_VERSION(dict) (0)
  2063. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  2064. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  2065. #endif
  2066. /* GetModuleGlobalName.proto */
  2067. #if CYTHON_USE_DICT_VERSIONS
  2068. #define __Pyx_GetModuleGlobalName(var, name) do {\
  2069. static PY_UINT64_T __pyx_dict_version = 0;\
  2070. static PyObject *__pyx_dict_cached_value = NULL;\
  2071. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
  2072. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  2073. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2074. } while(0)
  2075. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  2076. PY_UINT64_T __pyx_dict_version;\
  2077. PyObject *__pyx_dict_cached_value;\
  2078. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2079. } while(0)
  2080. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  2081. #else
  2082. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2083. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2084. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  2085. #endif
  2086. /* RaiseUnboundLocalError.proto */
  2087. static void __Pyx_RaiseUnboundLocalError(const char *varname);
  2088. /* RaiseTooManyValuesToUnpack.proto */
  2089. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  2090. /* RaiseNeedMoreValuesToUnpack.proto */
  2091. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  2092. /* IterFinish.proto */
  2093. static CYTHON_INLINE int __Pyx_IterFinish(void);
  2094. /* UnpackItemEndCheck.proto */
  2095. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  2096. /* py_abs.proto */
  2097. #if CYTHON_USE_PYLONG_INTERNALS
  2098. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  2099. #define __Pyx_PyNumber_Absolute(x)\
  2100. ((likely(PyLong_CheckExact(x))) ?\
  2101. (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
  2102. PyNumber_Absolute(x))
  2103. #else
  2104. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  2105. #endif
  2106. /* RaiseClosureNameError.proto */
  2107. static void __Pyx_RaiseClosureNameError(const char *varname);
  2108. /* GetException.proto (used by pep479) */
  2109. #if CYTHON_FAST_THREAD_STATE
  2110. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  2111. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2112. #else
  2113. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  2114. #endif
  2115. /* pep479.proto */
  2116. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  2117. /* PyRange_Check.proto */
  2118. #if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  2119. #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type)
  2120. #endif
  2121. /* IncludeStdlibH.proto */
  2122. #include <stdlib.h>
  2123. /* ArgTypeTestFunc.export */
  2124. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  2125. /* ArgTypeTest.proto */
  2126. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  2127. ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  2128. __Pyx__ArgTypeTest(obj, type, name, exact))
  2129. /* DictGetItem.proto */
  2130. #if !CYTHON_COMPILING_IN_PYPY
  2131. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  2132. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  2133. (likely(PyDict_CheckExact(obj)) ?\
  2134. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  2135. #else
  2136. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  2137. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  2138. #endif
  2139. /* PyObjectCallNoArg.proto (used by pyfrozenset_new) */
  2140. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  2141. /* pyfrozenset_new.proto (used by PySetContains) */
  2142. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2143. /* PySetContains.proto */
  2144. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2145. /* pyint_simplify.proto */
  2146. static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none);
  2147. /* SliceTupleAndList.proto */
  2148. #if CYTHON_COMPILING_IN_CPYTHON
  2149. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2150. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2151. #else
  2152. #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2153. #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2154. #endif
  2155. /* set_iter.proto */
  2156. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  2157. Py_ssize_t* p_orig_length, int* p_source_is_set);
  2158. static CYTHON_INLINE int __Pyx_set_iter_next(
  2159. PyObject* iter_obj, Py_ssize_t orig_length,
  2160. Py_ssize_t* ppos, PyObject **value,
  2161. int source_is_set);
  2162. /* PyLongCompare.proto */
  2163. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2164. /* py_set_remove.proto */
  2165. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key);
  2166. /* AllocateExtensionType.proto */
  2167. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);
  2168. /* CallTypeTraverse.proto */
  2169. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  2170. #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
  2171. #else
  2172. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
  2173. #endif
  2174. /* CheckTypeForFreelists.proto */
  2175. #if CYTHON_USE_FREELISTS
  2176. #if CYTHON_USE_TYPE_SPECS
  2177. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
  2178. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT
  2179. #else
  2180. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
  2181. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
  2182. #endif
  2183. #define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
  2184. (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
  2185. (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
  2186. #endif
  2187. /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
  2188. #if CYTHON_COMPILING_IN_LIMITED_API
  2189. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
  2190. #endif
  2191. /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
  2192. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
  2193. #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)
  2194. /* FixUpExtensionType.proto */
  2195. static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2196. /* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */
  2197. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  2198. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2199. #endif
  2200. /* PyObjectCallMethod0.proto (used by PyType_Ready) */
  2201. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2202. /* ValidateBasesTuple.proto (used by PyType_Ready) */
  2203. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2204. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2205. #endif
  2206. /* PyType_Ready.proto */
  2207. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2208. /* HasAttr.proto (used by ImportImpl) */
  2209. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2210. #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
  2211. #else
  2212. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  2213. #endif
  2214. /* ImportImpl.export */
  2215. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);
  2216. /* Import.proto */
  2217. static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);
  2218. /* ImportFrom.proto */
  2219. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2220. /* dict_setdefault.proto (used by FetchCommonType) */
  2221. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);
  2222. /* AddModuleRef.proto (used by FetchSharedCythonModule) */
  2223. #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
  2224. __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  2225. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
  2226. #else
  2227. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  2228. #endif
  2229. /* FetchSharedCythonModule.proto (used by FetchCommonType) */
  2230. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2231. /* FetchCommonType.proto (used by CommonTypesMetaclass) */
  2232. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);
  2233. /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */
  2234. static int __pyx_CommonTypesMetaclass_init(PyObject *module);
  2235. #define __Pyx_CommonTypesMetaclass_USED
  2236. /* PyMethodNew.proto (used by CythonFunctionShared) */
  2237. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);
  2238. /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
  2239. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  2240. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2241. #endif
  2242. /* CythonFunctionShared.proto (used by CythonFunction) */
  2243. #define __Pyx_CyFunction_USED
  2244. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2245. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2246. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2247. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2248. #define __Pyx_CyFunction_GetClosure(f)\
  2249. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2250. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2251. #define __Pyx_CyFunction_GetClassObj(f)\
  2252. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2253. #else
  2254. #define __Pyx_CyFunction_GetClassObj(f)\
  2255. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2256. #endif
  2257. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2258. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2259. #define __Pyx_CyFunction_Defaults(type, f)\
  2260. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2261. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2262. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2263. typedef struct {
  2264. #if CYTHON_COMPILING_IN_LIMITED_API
  2265. PyObject_HEAD
  2266. PyObject *func;
  2267. #elif PY_VERSION_HEX < 0x030900B1
  2268. PyCFunctionObject func;
  2269. #else
  2270. PyCMethodObject func;
  2271. #endif
  2272. #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
  2273. __pyx_vectorcallfunc func_vectorcall;
  2274. #endif
  2275. #if CYTHON_COMPILING_IN_LIMITED_API
  2276. PyObject *func_weakreflist;
  2277. #endif
  2278. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2279. PyObject *func_dict;
  2280. #endif
  2281. PyObject *func_name;
  2282. PyObject *func_qualname;
  2283. PyObject *func_doc;
  2284. PyObject *func_globals;
  2285. PyObject *func_code;
  2286. PyObject *func_closure;
  2287. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2288. PyObject *func_classobj;
  2289. #endif
  2290. PyObject *defaults;
  2291. int flags;
  2292. PyObject *defaults_tuple;
  2293. PyObject *defaults_kwdict;
  2294. PyObject *(*defaults_getter)(PyObject *);
  2295. PyObject *func_annotations;
  2296. PyObject *func_is_coroutine;
  2297. } __pyx_CyFunctionObject;
  2298. #undef __Pyx_CyOrPyCFunction_Check
  2299. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2300. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
  2301. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2302. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
  2303. #undef __Pyx_IsSameCFunction
  2304. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2305. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2306. int flags, PyObject* qualname,
  2307. PyObject *closure,
  2308. PyObject *module, PyObject *globals,
  2309. PyObject* code);
  2310. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2311. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
  2312. PyTypeObject *defaults_type);
  2313. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2314. PyObject *tuple);
  2315. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2316. PyObject *dict);
  2317. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2318. PyObject *dict);
  2319. static int __pyx_CyFunction_init(PyObject *module);
  2320. #if CYTHON_METH_FASTCALL
  2321. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2322. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2323. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2324. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2325. #if CYTHON_COMPILING_IN_LIMITED_API
  2326. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2327. #else
  2328. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2329. #endif
  2330. #endif
  2331. /* CythonFunction.proto */
  2332. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2333. int flags, PyObject* qualname,
  2334. PyObject *closure,
  2335. PyObject *module, PyObject *globals,
  2336. PyObject* code);
  2337. /* CLineInTraceback.proto (used by AddTraceback) */
  2338. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  2339. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2340. #else
  2341. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2342. #endif
  2343. /* CodeObjectCache.proto (used by AddTraceback) */
  2344. #if CYTHON_COMPILING_IN_LIMITED_API
  2345. typedef PyObject __Pyx_CachedCodeObjectType;
  2346. #else
  2347. typedef PyCodeObject __Pyx_CachedCodeObjectType;
  2348. #endif
  2349. typedef struct {
  2350. __Pyx_CachedCodeObjectType* code_object;
  2351. int code_line;
  2352. } __Pyx_CodeObjectCacheEntry;
  2353. struct __Pyx_CodeObjectCache {
  2354. int count;
  2355. int max_count;
  2356. __Pyx_CodeObjectCacheEntry* entries;
  2357. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  2358. __pyx_atomic_int_type accessor_count;
  2359. #endif
  2360. };
  2361. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2362. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
  2363. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
  2364. /* AddTraceback.proto */
  2365. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2366. int py_line, const char *filename);
  2367. /* GCCDiagnostics.proto */
  2368. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2369. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2370. #endif
  2371. /* CIntFromPy.proto */
  2372. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);
  2373. /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */
  2374. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2375. #if CYTHON_VECTORCALL
  2376. #if PY_VERSION_HEX >= 0x03090000
  2377. #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
  2378. #else
  2379. #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
  2380. #endif
  2381. #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
  2382. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2383. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2384. #else
  2385. #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
  2386. #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
  2387. #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
  2388. #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
  2389. #endif
  2390. /* CIntToPy.proto */
  2391. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value);
  2392. /* CIntToPy.proto */
  2393. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);
  2394. /* CIntFromPy.proto */
  2395. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);
  2396. /* FormatTypeName.proto */
  2397. #if CYTHON_COMPILING_IN_LIMITED_API
  2398. typedef PyObject *__Pyx_TypeName;
  2399. #define __Pyx_FMT_TYPENAME "%U"
  2400. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2401. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2402. #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
  2403. #else
  2404. static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
  2405. #endif
  2406. #else // !LIMITED_API
  2407. typedef const char *__Pyx_TypeName;
  2408. #define __Pyx_FMT_TYPENAME "%.200s"
  2409. #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
  2410. #define __Pyx_DECREF_TypeName(obj)
  2411. #endif
  2412. /* FastTypeChecks.proto */
  2413. #if CYTHON_COMPILING_IN_CPYTHON
  2414. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2415. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2416. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2417. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2418. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2419. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2420. #else
  2421. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2422. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2423. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2424. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
  2425. return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
  2426. }
  2427. #endif
  2428. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2429. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2430. #ifdef PyExceptionInstance_Check
  2431. #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
  2432. #else
  2433. #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
  2434. #endif
  2435. /* GetRuntimeVersion.proto */
  2436. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  2437. static unsigned long __Pyx_cached_runtime_version = 0;
  2438. static void __Pyx_init_runtime_version(void);
  2439. #else
  2440. #define __Pyx_init_runtime_version()
  2441. #endif
  2442. static unsigned long __Pyx_get_runtime_version(void);
  2443. /* GetTopmostException.proto (used by SaveResetException) */
  2444. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2445. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2446. #endif
  2447. /* SaveResetException.proto (used by CoroutineBase) */
  2448. #if CYTHON_FAST_THREAD_STATE
  2449. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2450. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2451. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2452. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2453. #else
  2454. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2455. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2456. #endif
  2457. /* SwapException.proto (used by CoroutineBase) */
  2458. #if CYTHON_FAST_THREAD_STATE
  2459. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2460. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2461. #else
  2462. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2463. #endif
  2464. /* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
  2465. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2466. /* PyObjectCallMethod1.proto (used by CoroutineBase) */
  2467. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2468. /* ReturnWithStopIteration.proto (used by CoroutineBase) */
  2469. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);
  2470. /* CoroutineBase.proto (used by Generator) */
  2471. struct __pyx_CoroutineObject;
  2472. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2473. #if CYTHON_USE_EXC_INFO_STACK
  2474. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2475. #else
  2476. typedef struct {
  2477. PyObject *exc_type;
  2478. PyObject *exc_value;
  2479. PyObject *exc_traceback;
  2480. } __Pyx_ExcInfoStruct;
  2481. #endif
  2482. typedef struct __pyx_CoroutineObject {
  2483. PyObject_HEAD
  2484. __pyx_coroutine_body_t body;
  2485. PyObject *closure;
  2486. __Pyx_ExcInfoStruct gi_exc_state;
  2487. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2488. PyObject *gi_weakreflist;
  2489. #endif
  2490. PyObject *classobj;
  2491. PyObject *yieldfrom;
  2492. __Pyx_pyiter_sendfunc yieldfrom_am_send;
  2493. PyObject *gi_name;
  2494. PyObject *gi_qualname;
  2495. PyObject *gi_modulename;
  2496. PyObject *gi_code;
  2497. PyObject *gi_frame;
  2498. #if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
  2499. PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
  2500. uint64_t __pyx_pymonitoring_version;
  2501. #endif
  2502. int resume_label;
  2503. char is_running;
  2504. } __pyx_CoroutineObject;
  2505. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2506. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2507. PyObject *name, PyObject *qualname, PyObject *module_name);
  2508. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2509. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2510. PyObject *name, PyObject *qualname, PyObject *module_name);
  2511. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2512. static int __Pyx_Coroutine_clear(PyObject *self);
  2513. static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
  2514. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2515. static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
  2516. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2517. #if CYTHON_USE_EXC_INFO_STACK
  2518. #define __Pyx_Coroutine_SwapException(self)
  2519. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2520. #else
  2521. #define __Pyx_Coroutine_SwapException(self) {\
  2522. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2523. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2524. }
  2525. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2526. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2527. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2528. }
  2529. #endif
  2530. #if CYTHON_FAST_THREAD_STATE
  2531. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2532. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2533. #else
  2534. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2535. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2536. #endif
  2537. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2538. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2539. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
  2540. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
  2541. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
  2542. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
  2543. #if __PYX_HAS_PY_AM_SEND == 2
  2544. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
  2545. #endif
  2546. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);
  2547. /* Generator.proto */
  2548. #define __Pyx_Generator_USED
  2549. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
  2550. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2551. __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2552. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2553. static int __pyx_Generator_init(PyObject *module);
  2554. static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);
  2555. /* CheckBinaryVersion.proto */
  2556. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2557. /* DecompressString.proto */
  2558. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);
  2559. /* MultiPhaseInitModuleState.proto */
  2560. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  2561. static PyObject *__Pyx_State_FindModule(void*);
  2562. static int __Pyx_State_AddModule(PyObject* module, void*);
  2563. static int __Pyx_State_RemoveModule(void*);
  2564. #elif CYTHON_USE_MODULE_STATE
  2565. #define __Pyx_State_FindModule PyState_FindModule
  2566. #define __Pyx_State_AddModule PyState_AddModule
  2567. #define __Pyx_State_RemoveModule PyState_RemoveModule
  2568. #endif
  2569. /* #### Code section: module_declarations ### */
  2570. /* CythonABIVersion.proto */
  2571. #if CYTHON_COMPILING_IN_LIMITED_API
  2572. #if CYTHON_METH_FASTCALL
  2573. #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall"
  2574. #else
  2575. #define __PYX_FASTCALL_ABI_SUFFIX
  2576. #endif
  2577. #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2578. #else
  2579. #define __PYX_LIMITED_ABI_SUFFIX
  2580. #endif
  2581. #if __PYX_HAS_PY_AM_SEND == 1
  2582. #define __PYX_AM_SEND_ABI_SUFFIX
  2583. #elif __PYX_HAS_PY_AM_SEND == 2
  2584. #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
  2585. #else
  2586. #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
  2587. #endif
  2588. #ifndef __PYX_MONITORING_ABI_SUFFIX
  2589. #define __PYX_MONITORING_ABI_SUFFIX
  2590. #endif
  2591. #if CYTHON_USE_TP_FINALIZE
  2592. #define __PYX_TP_FINALIZE_ABI_SUFFIX
  2593. #else
  2594. #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
  2595. #endif
  2596. #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
  2597. #define __PYX_FREELISTS_ABI_SUFFIX
  2598. #else
  2599. #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
  2600. #endif
  2601. #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
  2602. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  2603. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  2604. /* Module declarations from "cython" */
  2605. /* Module declarations from "fontTools.varLib.iup" */
  2606. static PyObject *__pyx_f_9fontTools_6varLib_3iup_iup_segment(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
  2607. static CYTHON_INLINE int __pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *, PyObject *, int, int, PyObject *); /*proto*/
  2608. /* #### Code section: typeinfo ### */
  2609. /* #### Code section: before_global_var ### */
  2610. #define __Pyx_MODULE_NAME "fontTools.varLib.iup"
  2611. extern int __pyx_module_is_main_fontTools__varLib__iup;
  2612. int __pyx_module_is_main_fontTools__varLib__iup = 0;
  2613. /* Implementation of "fontTools.varLib.iup" */
  2614. /* #### Code section: global_var ### */
  2615. static PyObject *__pyx_builtin_zip;
  2616. static PyObject *__pyx_builtin_enumerate;
  2617. static PyObject *__pyx_builtin_max;
  2618. /* #### Code section: string_decls ### */
  2619. /* #### Code section: decls ### */
  2620. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords); /* proto */
  2621. 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 */
  2622. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2623. 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 */
  2624. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2625. 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 */
  2626. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k); /* proto */
  2627. 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 */
  2628. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2629. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2630. 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 */
  2631. 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 */
  2632. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2633. 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*/
  2634. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2635. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2636. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2637. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2638. /* #### Code section: late_includes ### */
  2639. /* #### Code section: module_state ### */
  2640. /* SmallCodeConfig */
  2641. #ifndef CYTHON_SMALL_CODE
  2642. #if defined(__clang__)
  2643. #define CYTHON_SMALL_CODE
  2644. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  2645. #define CYTHON_SMALL_CODE __attribute__((cold))
  2646. #else
  2647. #define CYTHON_SMALL_CODE
  2648. #endif
  2649. #endif
  2650. typedef struct {
  2651. PyObject *__pyx_d;
  2652. PyObject *__pyx_b;
  2653. PyObject *__pyx_cython_runtime;
  2654. PyObject *__pyx_empty_tuple;
  2655. PyObject *__pyx_empty_bytes;
  2656. PyObject *__pyx_empty_unicode;
  2657. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_defaults;
  2658. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2659. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2660. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2661. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2662. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2663. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults;
  2664. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2665. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2666. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2667. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2668. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2669. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  2670. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  2671. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  2672. PyObject *__pyx_tuple[4];
  2673. PyObject *__pyx_codeobj_tab[11];
  2674. PyObject *__pyx_string_tab[128];
  2675. PyObject *__pyx_number_tab[8];
  2676. /* #### Code section: module_state_contents ### */
  2677. /* IterNextPlain.module_state_decls */
  2678. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2679. PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
  2680. #endif
  2681. #if CYTHON_USE_FREELISTS
  2682. 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];
  2683. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2684. #endif
  2685. #if CYTHON_USE_FREELISTS
  2686. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[8];
  2687. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2688. #endif
  2689. #if CYTHON_USE_FREELISTS
  2690. 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];
  2691. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2692. #endif
  2693. #if CYTHON_USE_FREELISTS
  2694. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[8];
  2695. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2696. #endif
  2697. #if CYTHON_USE_FREELISTS
  2698. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[8];
  2699. int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2700. #endif
  2701. /* CommonTypesMetaclass.module_state_decls */
  2702. PyTypeObject *__pyx_CommonTypesMetaclassType;
  2703. /* CachedMethodType.module_state_decls */
  2704. #if CYTHON_COMPILING_IN_LIMITED_API
  2705. PyObject *__Pyx_CachedMethodType;
  2706. #endif
  2707. /* CythonFunctionShared.module_state_decls */
  2708. PyTypeObject *__pyx_CyFunctionType;
  2709. /* CodeObjectCache.module_state_decls */
  2710. struct __Pyx_CodeObjectCache __pyx_code_cache;
  2711. /* Generator.module_state_decls */
  2712. PyTypeObject *__pyx_GeneratorType;
  2713. /* #### Code section: module_state_end ### */
  2714. } __pyx_mstatetype;
  2715. #if CYTHON_USE_MODULE_STATE
  2716. #ifdef __cplusplus
  2717. namespace {
  2718. extern struct PyModuleDef __pyx_moduledef;
  2719. } /* anonymous namespace */
  2720. #else
  2721. static struct PyModuleDef __pyx_moduledef;
  2722. #endif
  2723. #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))
  2724. #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
  2725. #else
  2726. static __pyx_mstatetype __pyx_mstate_global_static =
  2727. #ifdef __cplusplus
  2728. {};
  2729. #else
  2730. {0};
  2731. #endif
  2732. static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
  2733. #endif
  2734. /* #### Code section: constant_name_defines ### */
  2735. #define __pyx_kp_u_ __pyx_string_tab[0]
  2736. #define __pyx_kp_u_Lib_fontTools_varLib_iup_py __pyx_string_tab[1]
  2737. #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[2]
  2738. #define __pyx_kp_u__2 __pyx_string_tab[3]
  2739. #define __pyx_kp_u_add_note __pyx_string_tab[4]
  2740. #define __pyx_kp_u_disable __pyx_string_tab[5]
  2741. #define __pyx_kp_u_enable __pyx_string_tab[6]
  2742. #define __pyx_kp_u_gc __pyx_string_tab[7]
  2743. #define __pyx_kp_u_isenabled __pyx_string_tab[8]
  2744. #define __pyx_n_u_COMPILED __pyx_string_tab[9]
  2745. #define __pyx_n_u_Delta __pyx_string_tab[10]
  2746. #define __pyx_n_u_DeltaOrNone __pyx_string_tab[11]
  2747. #define __pyx_n_u_DeltaOrNoneSegment __pyx_string_tab[12]
  2748. #define __pyx_n_u_DeltaSegment __pyx_string_tab[13]
  2749. #define __pyx_n_u_Endpoints __pyx_string_tab[14]
  2750. #define __pyx_n_u_Integral __pyx_string_tab[15]
  2751. #define __pyx_n_u_MAX_LOOKBACK __pyx_string_tab[16]
  2752. #define __pyx_n_u_Point __pyx_string_tab[17]
  2753. #define __pyx_n_u_PointSegment __pyx_string_tab[18]
  2754. #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[19]
  2755. #define __pyx_n_u_Real __pyx_string_tab[20]
  2756. #define __pyx_n_u_Sequence __pyx_string_tab[21]
  2757. #define __pyx_n_u_Tuple __pyx_string_tab[22]
  2758. #define __pyx_n_u_Union __pyx_string_tab[23]
  2759. #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[24]
  2760. #define __pyx_n_u_best_cost __pyx_string_tab[25]
  2761. #define __pyx_n_u_best_j __pyx_string_tab[26]
  2762. #define __pyx_n_u_best_sol __pyx_string_tab[27]
  2763. #define __pyx_n_u_c __pyx_string_tab[28]
  2764. #define __pyx_n_u_c1 __pyx_string_tab[29]
  2765. #define __pyx_n_u_c2 __pyx_string_tab[30]
  2766. #define __pyx_n_u_can_iup_in_between_locals_genexp __pyx_string_tab[31]
  2767. #define __pyx_n_u_chain __pyx_string_tab[32]
  2768. #define __pyx_n_u_cj __pyx_string_tab[33]
  2769. #define __pyx_n_u_class_getitem __pyx_string_tab[34]
  2770. #define __pyx_n_u_cline_in_traceback __pyx_string_tab[35]
  2771. #define __pyx_n_u_close __pyx_string_tab[36]
  2772. #define __pyx_n_u_contour __pyx_string_tab[37]
  2773. #define __pyx_n_u_coords __pyx_string_tab[38]
  2774. #define __pyx_n_u_cost __pyx_string_tab[39]
  2775. #define __pyx_n_u_costs __pyx_string_tab[40]
  2776. #define __pyx_n_u_d __pyx_string_tab[41]
  2777. #define __pyx_n_u_d0 __pyx_string_tab[42]
  2778. #define __pyx_n_u_d1 __pyx_string_tab[43]
  2779. #define __pyx_n_u_d2 __pyx_string_tab[44]
  2780. #define __pyx_n_u_deltas __pyx_string_tab[45]
  2781. #define __pyx_n_u_dj __pyx_string_tab[46]
  2782. #define __pyx_n_u_end __pyx_string_tab[47]
  2783. #define __pyx_n_u_ends __pyx_string_tab[48]
  2784. #define __pyx_n_u_enumerate __pyx_string_tab[49]
  2785. #define __pyx_n_u_fontTools_varLib_iup __pyx_string_tab[50]
  2786. #define __pyx_n_u_force __pyx_string_tab[51]
  2787. #define __pyx_n_u_forced __pyx_string_tab[52]
  2788. #define __pyx_n_u_func __pyx_string_tab[53]
  2789. #define __pyx_n_u_genexpr __pyx_string_tab[54]
  2790. #define __pyx_n_u_i __pyx_string_tab[55]
  2791. #define __pyx_n_u_i1 __pyx_string_tab[56]
  2792. #define __pyx_n_u_i2 __pyx_string_tab[57]
  2793. #define __pyx_n_u_indices __pyx_string_tab[58]
  2794. #define __pyx_n_u_int __pyx_string_tab[59]
  2795. #define __pyx_n_u_is_coroutine __pyx_string_tab[60]
  2796. #define __pyx_n_u_it __pyx_string_tab[61]
  2797. #define __pyx_n_u_items __pyx_string_tab[62]
  2798. #define __pyx_n_u_iup_contour __pyx_string_tab[63]
  2799. #define __pyx_n_u_iup_contour_bound_forced_set __pyx_string_tab[64]
  2800. #define __pyx_n_u_iup_contour_optimize __pyx_string_tab[65]
  2801. #define __pyx_n_u_iup_contour_optimize_dp __pyx_string_tab[66]
  2802. #define __pyx_n_u_iup_contour_optimize_locals_gene __pyx_string_tab[67]
  2803. #define __pyx_n_u_iup_delta __pyx_string_tab[68]
  2804. #define __pyx_n_u_iup_delta_optimize __pyx_string_tab[69]
  2805. #define __pyx_n_u_j __pyx_string_tab[70]
  2806. #define __pyx_n_u_k __pyx_string_tab[71]
  2807. #define __pyx_n_u_l __pyx_string_tab[72]
  2808. #define __pyx_n_u_lc __pyx_string_tab[73]
  2809. #define __pyx_n_u_lcj __pyx_string_tab[74]
  2810. #define __pyx_n_u_ld __pyx_string_tab[75]
  2811. #define __pyx_n_u_ldj __pyx_string_tab[76]
  2812. #define __pyx_n_u_list __pyx_string_tab[77]
  2813. #define __pyx_n_u_lookback __pyx_string_tab[78]
  2814. #define __pyx_n_u_main __pyx_string_tab[79]
  2815. #define __pyx_n_u_max __pyx_string_tab[80]
  2816. #define __pyx_n_u_module __pyx_string_tab[81]
  2817. #define __pyx_n_u_n __pyx_string_tab[82]
  2818. #define __pyx_n_u_name __pyx_string_tab[83]
  2819. #define __pyx_n_u_nc __pyx_string_tab[84]
  2820. #define __pyx_n_u_ncj __pyx_string_tab[85]
  2821. #define __pyx_n_u_nd __pyx_string_tab[86]
  2822. #define __pyx_n_u_ndj __pyx_string_tab[87]
  2823. #define __pyx_n_u_next __pyx_string_tab[88]
  2824. #define __pyx_n_u_numbers __pyx_string_tab[89]
  2825. #define __pyx_n_u_out __pyx_string_tab[90]
  2826. #define __pyx_n_u_p __pyx_string_tab[91]
  2827. #define __pyx_n_u_pop __pyx_string_tab[92]
  2828. #define __pyx_n_u_q __pyx_string_tab[93]
  2829. #define __pyx_n_u_qualname __pyx_string_tab[94]
  2830. #define __pyx_n_u_return __pyx_string_tab[95]
  2831. #define __pyx_n_u_ri1 __pyx_string_tab[96]
  2832. #define __pyx_n_u_ri2 __pyx_string_tab[97]
  2833. #define __pyx_n_u_rot_list __pyx_string_tab[98]
  2834. #define __pyx_n_u_rot_set __pyx_string_tab[99]
  2835. #define __pyx_n_u_s __pyx_string_tab[100]
  2836. #define __pyx_n_u_send __pyx_string_tab[101]
  2837. #define __pyx_n_u_set __pyx_string_tab[102]
  2838. #define __pyx_n_u_set_name __pyx_string_tab[103]
  2839. #define __pyx_n_u_setdefault __pyx_string_tab[104]
  2840. #define __pyx_n_u_solution __pyx_string_tab[105]
  2841. #define __pyx_n_u_start __pyx_string_tab[106]
  2842. #define __pyx_n_u_test __pyx_string_tab[107]
  2843. #define __pyx_n_u_throw __pyx_string_tab[108]
  2844. #define __pyx_n_u_tolerance __pyx_string_tab[109]
  2845. #define __pyx_n_u_typing __pyx_string_tab[110]
  2846. #define __pyx_n_u_v __pyx_string_tab[111]
  2847. #define __pyx_n_u_value __pyx_string_tab[112]
  2848. #define __pyx_n_u_values __pyx_string_tab[113]
  2849. #define __pyx_n_u_x __pyx_string_tab[114]
  2850. #define __pyx_n_u_y __pyx_string_tab[115]
  2851. #define __pyx_n_u_zip __pyx_string_tab[116]
  2852. #define __pyx_kp_b_iso88591_1 __pyx_string_tab[117]
  2853. #define __pyx_kp_b_iso88591_1A_t1_q_1ARr_b_Bb __pyx_string_tab[118]
  2854. #define __pyx_kp_b_iso88591_55Gq_3axs_Qa_uG1_q_1A_ar_S_Yaxs __pyx_string_tab[119]
  2855. #define __pyx_kp_b_iso88591_A __pyx_string_tab[120]
  2856. #define __pyx_kp_b_iso88591_Q_1A_A_q_r_A_q_q_a_q_Bay_A_881 __pyx_string_tab[121]
  2857. #define __pyx_kp_b_iso88591_Q_3axs_Qa_1A_U_3axr_T_E_q_D_ar __pyx_string_tab[122]
  2858. #define __pyx_kp_b_iso88591_a __pyx_string_tab[123]
  2859. #define __pyx_kp_b_iso88591_a_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2 __pyx_string_tab[124]
  2860. #define __pyx_kp_b_iso88591_q_5_Cq_D_RuJcQSST_1A_5_2Rs_Bc_2 __pyx_string_tab[125]
  2861. #define __pyx_kp_b_iso88591_q_a_1A_y_1_1_Q_c_c_U_3a_E_Bc_1 __pyx_string_tab[126]
  2862. #define __pyx_kp_b_iso88591_t1_q_2Rr_Bb_E __pyx_string_tab[127]
  2863. #define __pyx_float_0_0 __pyx_number_tab[0]
  2864. #define __pyx_int_0 __pyx_number_tab[1]
  2865. #define __pyx_int_neg_1 __pyx_number_tab[2]
  2866. #define __pyx_int_1 __pyx_number_tab[3]
  2867. #define __pyx_int_2 __pyx_number_tab[4]
  2868. #define __pyx_int_3 __pyx_number_tab[5]
  2869. #define __pyx_int_4 __pyx_number_tab[6]
  2870. #define __pyx_int_8 __pyx_number_tab[7]
  2871. /* #### Code section: module_state_clear ### */
  2872. #if CYTHON_USE_MODULE_STATE
  2873. static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  2874. __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  2875. if (!clear_module_state) return 0;
  2876. Py_CLEAR(clear_module_state->__pyx_d);
  2877. Py_CLEAR(clear_module_state->__pyx_b);
  2878. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  2879. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  2880. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  2881. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  2882. #if CYTHON_PEP489_MULTI_PHASE_INIT
  2883. __Pyx_State_RemoveModule(NULL);
  2884. #endif
  2885. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  2886. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_defaults);
  2887. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2888. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2889. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2890. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2891. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2892. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2893. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2894. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2895. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2896. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2897. for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  2898. for (int i=0; i<11; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  2899. for (int i=0; i<128; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  2900. for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
  2901. /* #### Code section: module_state_clear_contents ### */
  2902. /* CommonTypesMetaclass.module_state_clear */
  2903. Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);
  2904. /* CythonFunctionShared.module_state_clear */
  2905. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  2906. /* Generator.module_state_clear */
  2907. Py_CLEAR(clear_module_state->__pyx_GeneratorType);
  2908. /* #### Code section: module_state_clear_end ### */
  2909. return 0;
  2910. }
  2911. #endif
  2912. /* #### Code section: module_state_traverse ### */
  2913. #if CYTHON_USE_MODULE_STATE
  2914. static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  2915. __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  2916. if (!traverse_module_state) return 0;
  2917. Py_VISIT(traverse_module_state->__pyx_d);
  2918. Py_VISIT(traverse_module_state->__pyx_b);
  2919. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  2920. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  2921. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  2922. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  2923. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  2924. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_defaults);
  2925. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2926. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2927. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2928. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2929. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2930. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2931. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2932. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2933. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2934. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2935. for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  2936. for (int i=0; i<11; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  2937. for (int i=0; i<128; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  2938. for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
  2939. /* #### Code section: module_state_traverse_contents ### */
  2940. /* CommonTypesMetaclass.module_state_traverse */
  2941. Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);
  2942. /* CythonFunctionShared.module_state_traverse */
  2943. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  2944. /* Generator.module_state_traverse */
  2945. Py_VISIT(traverse_module_state->__pyx_GeneratorType);
  2946. /* #### Code section: module_state_traverse_end ### */
  2947. return 0;
  2948. }
  2949. #endif
  2950. /* #### Code section: module_code ### */
  2951. /* "fontTools/varLib/iup.py":28
  2952. *
  2953. *
  2954. * @cython.cfunc # <<<<<<<<<<<<<<
  2955. * @cython.locals(
  2956. * j=cython.int,
  2957. */
  2958. 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) {
  2959. int __pyx_v_j;
  2960. int __pyx_v_n;
  2961. double __pyx_v_x1;
  2962. double __pyx_v_x2;
  2963. double __pyx_v_d1;
  2964. double __pyx_v_d2;
  2965. double __pyx_v_scale;
  2966. double __pyx_v_x;
  2967. double __pyx_v_d;
  2968. PyObject *__pyx_v_out_arrays = NULL;
  2969. PyObject *__pyx_v_out = NULL;
  2970. PyObject *__pyx_v_pair = NULL;
  2971. double __pyx_v_nudge;
  2972. PyObject *__pyx_r = NULL;
  2973. __Pyx_RefNannyDeclarations
  2974. PyObject *__pyx_t_1 = NULL;
  2975. Py_ssize_t __pyx_t_2;
  2976. PyObject *__pyx_t_3 = NULL;
  2977. int __pyx_t_4;
  2978. double __pyx_t_5;
  2979. double __pyx_t_6;
  2980. double __pyx_t_7;
  2981. double __pyx_t_8;
  2982. int __pyx_t_9;
  2983. Py_ssize_t __pyx_t_10;
  2984. PyObject *__pyx_t_11 = NULL;
  2985. int __pyx_t_12;
  2986. PyObject *(*__pyx_t_13)(PyObject *);
  2987. int __pyx_lineno = 0;
  2988. const char *__pyx_filename = NULL;
  2989. int __pyx_clineno = 0;
  2990. __Pyx_RefNannySetupContext("iup_segment", 0);
  2991. /* "fontTools/varLib/iup.py":49
  2992. * # rc1 = reference coord 1
  2993. * # rd1 = reference delta 1
  2994. * out_arrays = [None, None] # <<<<<<<<<<<<<<
  2995. * for j in 0, 1:
  2996. * out_arrays[j] = out = []
  2997. */
  2998. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
  2999. __Pyx_GOTREF(__pyx_t_1);
  3000. __Pyx_INCREF(Py_None);
  3001. __Pyx_GIVEREF(Py_None);
  3002. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_None) != (0)) __PYX_ERR(0, 49, __pyx_L1_error);
  3003. __Pyx_INCREF(Py_None);
  3004. __Pyx_GIVEREF(Py_None);
  3005. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 49, __pyx_L1_error);
  3006. __pyx_v_out_arrays = ((PyObject*)__pyx_t_1);
  3007. __pyx_t_1 = 0;
  3008. /* "fontTools/varLib/iup.py":50
  3009. * # rd1 = reference delta 1
  3010. * out_arrays = [None, None]
  3011. * for j in 0, 1: # <<<<<<<<<<<<<<
  3012. * out_arrays[j] = out = []
  3013. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3014. */
  3015. __pyx_t_1 = __pyx_mstate_global->__pyx_tuple[0]; __Pyx_INCREF(__pyx_t_1);
  3016. __pyx_t_2 = 0;
  3017. for (;;) {
  3018. if (__pyx_t_2 >= 2) break;
  3019. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3020. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  3021. #else
  3022. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  3023. #endif
  3024. ++__pyx_t_2;
  3025. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
  3026. __Pyx_GOTREF(__pyx_t_3);
  3027. __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)
  3028. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3029. __pyx_v_j = __pyx_t_4;
  3030. /* "fontTools/varLib/iup.py":51
  3031. * out_arrays = [None, None]
  3032. * for j in 0, 1:
  3033. * out_arrays[j] = out = [] # <<<<<<<<<<<<<<
  3034. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3035. *
  3036. */
  3037. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  3038. __Pyx_GOTREF(__pyx_t_3);
  3039. 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)
  3040. __Pyx_INCREF(__pyx_t_3);
  3041. __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_3);
  3042. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3043. /* "fontTools/varLib/iup.py":52
  3044. * for j in 0, 1:
  3045. * out_arrays[j] = out = []
  3046. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j] # <<<<<<<<<<<<<<
  3047. *
  3048. * if x1 == x2:
  3049. */
  3050. __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)
  3051. __Pyx_GOTREF(__pyx_t_3);
  3052. __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)
  3053. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3054. __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)
  3055. __Pyx_GOTREF(__pyx_t_3);
  3056. __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)
  3057. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3058. __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)
  3059. __Pyx_GOTREF(__pyx_t_3);
  3060. __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)
  3061. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3062. __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)
  3063. __Pyx_GOTREF(__pyx_t_3);
  3064. __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)
  3065. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3066. __pyx_v_x1 = __pyx_t_5;
  3067. __pyx_v_x2 = __pyx_t_6;
  3068. __pyx_v_d1 = __pyx_t_7;
  3069. __pyx_v_d2 = __pyx_t_8;
  3070. /* "fontTools/varLib/iup.py":54
  3071. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3072. *
  3073. * if x1 == x2: # <<<<<<<<<<<<<<
  3074. * n = len(coords)
  3075. * if d1 == d2:
  3076. */
  3077. __pyx_t_9 = (__pyx_v_x1 == __pyx_v_x2);
  3078. if (__pyx_t_9) {
  3079. /* "fontTools/varLib/iup.py":55
  3080. *
  3081. * if x1 == x2:
  3082. * n = len(coords) # <<<<<<<<<<<<<<
  3083. * if d1 == d2:
  3084. * out.extend([d1] * n)
  3085. */
  3086. __pyx_t_10 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 55, __pyx_L1_error)
  3087. __pyx_v_n = __pyx_t_10;
  3088. /* "fontTools/varLib/iup.py":56
  3089. * if x1 == x2:
  3090. * n = len(coords)
  3091. * if d1 == d2: # <<<<<<<<<<<<<<
  3092. * out.extend([d1] * n)
  3093. * else:
  3094. */
  3095. __pyx_t_9 = (__pyx_v_d1 == __pyx_v_d2);
  3096. if (__pyx_t_9) {
  3097. /* "fontTools/varLib/iup.py":57
  3098. * n = len(coords)
  3099. * if d1 == d2:
  3100. * out.extend([d1] * n) # <<<<<<<<<<<<<<
  3101. * else:
  3102. * out.extend([0] * n)
  3103. */
  3104. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
  3105. __Pyx_GOTREF(__pyx_t_3);
  3106. __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)
  3107. __Pyx_GOTREF(__pyx_t_11);
  3108. { Py_ssize_t __pyx_temp;
  3109. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3110. __Pyx_INCREF(__pyx_t_3);
  3111. __Pyx_GIVEREF(__pyx_t_3);
  3112. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_t_3) != (0)) __PYX_ERR(0, 57, __pyx_L1_error);
  3113. }
  3114. }
  3115. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3116. __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)
  3117. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3118. /* "fontTools/varLib/iup.py":56
  3119. * if x1 == x2:
  3120. * n = len(coords)
  3121. * if d1 == d2: # <<<<<<<<<<<<<<
  3122. * out.extend([d1] * n)
  3123. * else:
  3124. */
  3125. goto __pyx_L6;
  3126. }
  3127. /* "fontTools/varLib/iup.py":59
  3128. * out.extend([d1] * n)
  3129. * else:
  3130. * out.extend([0] * n) # <<<<<<<<<<<<<<
  3131. * continue
  3132. *
  3133. */
  3134. /*else*/ {
  3135. __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)
  3136. __Pyx_GOTREF(__pyx_t_11);
  3137. { Py_ssize_t __pyx_temp;
  3138. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3139. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  3140. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0);
  3141. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(0, 59, __pyx_L1_error);
  3142. }
  3143. }
  3144. __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)
  3145. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3146. }
  3147. __pyx_L6:;
  3148. /* "fontTools/varLib/iup.py":60
  3149. * else:
  3150. * out.extend([0] * n)
  3151. * continue # <<<<<<<<<<<<<<
  3152. *
  3153. * if x1 > x2:
  3154. */
  3155. goto __pyx_L3_continue;
  3156. /* "fontTools/varLib/iup.py":54
  3157. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3158. *
  3159. * if x1 == x2: # <<<<<<<<<<<<<<
  3160. * n = len(coords)
  3161. * if d1 == d2:
  3162. */
  3163. }
  3164. /* "fontTools/varLib/iup.py":62
  3165. * continue
  3166. *
  3167. * if x1 > x2: # <<<<<<<<<<<<<<
  3168. * x1, x2 = x2, x1
  3169. * d1, d2 = d2, d1
  3170. */
  3171. __pyx_t_9 = (__pyx_v_x1 > __pyx_v_x2);
  3172. if (__pyx_t_9) {
  3173. /* "fontTools/varLib/iup.py":63
  3174. *
  3175. * if x1 > x2:
  3176. * x1, x2 = x2, x1 # <<<<<<<<<<<<<<
  3177. * d1, d2 = d2, d1
  3178. *
  3179. */
  3180. __pyx_t_8 = __pyx_v_x2;
  3181. __pyx_t_7 = __pyx_v_x1;
  3182. __pyx_v_x1 = __pyx_t_8;
  3183. __pyx_v_x2 = __pyx_t_7;
  3184. /* "fontTools/varLib/iup.py":64
  3185. * if x1 > x2:
  3186. * x1, x2 = x2, x1
  3187. * d1, d2 = d2, d1 # <<<<<<<<<<<<<<
  3188. *
  3189. * # x1 < x2
  3190. */
  3191. __pyx_t_7 = __pyx_v_d2;
  3192. __pyx_t_8 = __pyx_v_d1;
  3193. __pyx_v_d1 = __pyx_t_7;
  3194. __pyx_v_d2 = __pyx_t_8;
  3195. /* "fontTools/varLib/iup.py":62
  3196. * continue
  3197. *
  3198. * if x1 > x2: # <<<<<<<<<<<<<<
  3199. * x1, x2 = x2, x1
  3200. * d1, d2 = d2, d1
  3201. */
  3202. }
  3203. /* "fontTools/varLib/iup.py":67
  3204. *
  3205. * # x1 < x2
  3206. * scale = (d2 - d1) / (x2 - x1) # <<<<<<<<<<<<<<
  3207. * for pair in coords:
  3208. * x = pair[j]
  3209. */
  3210. __pyx_t_8 = (__pyx_v_d2 - __pyx_v_d1);
  3211. __pyx_t_7 = (__pyx_v_x2 - __pyx_v_x1);
  3212. if (unlikely(__pyx_t_7 == 0)) {
  3213. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  3214. __PYX_ERR(0, 67, __pyx_L1_error)
  3215. }
  3216. __pyx_v_scale = (__pyx_t_8 / __pyx_t_7);
  3217. /* "fontTools/varLib/iup.py":68
  3218. * # x1 < x2
  3219. * scale = (d2 - d1) / (x2 - x1)
  3220. * for pair in coords: # <<<<<<<<<<<<<<
  3221. * x = pair[j]
  3222. *
  3223. */
  3224. if (likely(PyList_CheckExact(__pyx_v_coords)) || PyTuple_CheckExact(__pyx_v_coords)) {
  3225. __pyx_t_11 = __pyx_v_coords; __Pyx_INCREF(__pyx_t_11);
  3226. __pyx_t_10 = 0;
  3227. __pyx_t_13 = NULL;
  3228. } else {
  3229. __pyx_t_10 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_coords); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 68, __pyx_L1_error)
  3230. __Pyx_GOTREF(__pyx_t_11);
  3231. __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)
  3232. }
  3233. for (;;) {
  3234. if (likely(!__pyx_t_13)) {
  3235. if (likely(PyList_CheckExact(__pyx_t_11))) {
  3236. {
  3237. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  3238. #if !CYTHON_ASSUME_SAFE_SIZE
  3239. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
  3240. #endif
  3241. if (__pyx_t_10 >= __pyx_temp) break;
  3242. }
  3243. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
  3244. ++__pyx_t_10;
  3245. } else {
  3246. {
  3247. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  3248. #if !CYTHON_ASSUME_SAFE_SIZE
  3249. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
  3250. #endif
  3251. if (__pyx_t_10 >= __pyx_temp) break;
  3252. }
  3253. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3254. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_10));
  3255. #else
  3256. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_10);
  3257. #endif
  3258. ++__pyx_t_10;
  3259. }
  3260. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  3261. } else {
  3262. __pyx_t_3 = __pyx_t_13(__pyx_t_11);
  3263. if (unlikely(!__pyx_t_3)) {
  3264. PyObject* exc_type = PyErr_Occurred();
  3265. if (exc_type) {
  3266. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 68, __pyx_L1_error)
  3267. PyErr_Clear();
  3268. }
  3269. break;
  3270. }
  3271. }
  3272. __Pyx_GOTREF(__pyx_t_3);
  3273. __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3);
  3274. __pyx_t_3 = 0;
  3275. /* "fontTools/varLib/iup.py":69
  3276. * scale = (d2 - d1) / (x2 - x1)
  3277. * for pair in coords:
  3278. * x = pair[j] # <<<<<<<<<<<<<<
  3279. *
  3280. * if x <= x1:
  3281. */
  3282. __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)
  3283. __Pyx_GOTREF(__pyx_t_3);
  3284. __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)
  3285. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3286. __pyx_v_x = __pyx_t_7;
  3287. /* "fontTools/varLib/iup.py":71
  3288. * x = pair[j]
  3289. *
  3290. * if x <= x1: # <<<<<<<<<<<<<<
  3291. * d = d1
  3292. * elif x >= x2:
  3293. */
  3294. __pyx_t_9 = (__pyx_v_x <= __pyx_v_x1);
  3295. if (__pyx_t_9) {
  3296. /* "fontTools/varLib/iup.py":72
  3297. *
  3298. * if x <= x1:
  3299. * d = d1 # <<<<<<<<<<<<<<
  3300. * elif x >= x2:
  3301. * d = d2
  3302. */
  3303. __pyx_v_d = __pyx_v_d1;
  3304. /* "fontTools/varLib/iup.py":71
  3305. * x = pair[j]
  3306. *
  3307. * if x <= x1: # <<<<<<<<<<<<<<
  3308. * d = d1
  3309. * elif x >= x2:
  3310. */
  3311. goto __pyx_L10;
  3312. }
  3313. /* "fontTools/varLib/iup.py":73
  3314. * if x <= x1:
  3315. * d = d1
  3316. * elif x >= x2: # <<<<<<<<<<<<<<
  3317. * d = d2
  3318. * else:
  3319. */
  3320. __pyx_t_9 = (__pyx_v_x >= __pyx_v_x2);
  3321. if (__pyx_t_9) {
  3322. /* "fontTools/varLib/iup.py":74
  3323. * d = d1
  3324. * elif x >= x2:
  3325. * d = d2 # <<<<<<<<<<<<<<
  3326. * else:
  3327. * # Interpolate
  3328. */
  3329. __pyx_v_d = __pyx_v_d2;
  3330. /* "fontTools/varLib/iup.py":73
  3331. * if x <= x1:
  3332. * d = d1
  3333. * elif x >= x2: # <<<<<<<<<<<<<<
  3334. * d = d2
  3335. * else:
  3336. */
  3337. goto __pyx_L10;
  3338. }
  3339. /* "fontTools/varLib/iup.py":83
  3340. * # - https://godbolt.org/z/YsP4T3TqK,
  3341. * # - https://github.com/fonttools/fonttools/issues/3703
  3342. * nudge = (x - x1) * scale # <<<<<<<<<<<<<<
  3343. * d = d1 + nudge
  3344. *
  3345. */
  3346. /*else*/ {
  3347. __pyx_v_nudge = ((__pyx_v_x - __pyx_v_x1) * __pyx_v_scale);
  3348. /* "fontTools/varLib/iup.py":84
  3349. * # - https://github.com/fonttools/fonttools/issues/3703
  3350. * nudge = (x - x1) * scale
  3351. * d = d1 + nudge # <<<<<<<<<<<<<<
  3352. *
  3353. * out.append(d)
  3354. */
  3355. __pyx_v_d = (__pyx_v_d1 + __pyx_v_nudge);
  3356. }
  3357. __pyx_L10:;
  3358. /* "fontTools/varLib/iup.py":86
  3359. * d = d1 + nudge
  3360. *
  3361. * out.append(d) # <<<<<<<<<<<<<<
  3362. *
  3363. * return zip(*out_arrays)
  3364. */
  3365. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  3366. __Pyx_GOTREF(__pyx_t_3);
  3367. __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)
  3368. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3369. /* "fontTools/varLib/iup.py":68
  3370. * # x1 < x2
  3371. * scale = (d2 - d1) / (x2 - x1)
  3372. * for pair in coords: # <<<<<<<<<<<<<<
  3373. * x = pair[j]
  3374. *
  3375. */
  3376. }
  3377. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3378. /* "fontTools/varLib/iup.py":50
  3379. * # rd1 = reference delta 1
  3380. * out_arrays = [None, None]
  3381. * for j in 0, 1: # <<<<<<<<<<<<<<
  3382. * out_arrays[j] = out = []
  3383. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3384. */
  3385. __pyx_L3_continue:;
  3386. }
  3387. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3388. /* "fontTools/varLib/iup.py":88
  3389. * out.append(d)
  3390. *
  3391. * return zip(*out_arrays) # <<<<<<<<<<<<<<
  3392. *
  3393. *
  3394. */
  3395. __Pyx_XDECREF(__pyx_r);
  3396. __pyx_t_1 = PySequence_Tuple(__pyx_v_out_arrays); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  3397. __Pyx_GOTREF(__pyx_t_1);
  3398. __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)
  3399. __Pyx_GOTREF(__pyx_t_11);
  3400. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3401. __pyx_r = __pyx_t_11;
  3402. __pyx_t_11 = 0;
  3403. goto __pyx_L0;
  3404. /* "fontTools/varLib/iup.py":28
  3405. *
  3406. *
  3407. * @cython.cfunc # <<<<<<<<<<<<<<
  3408. * @cython.locals(
  3409. * j=cython.int,
  3410. */
  3411. /* function exit code */
  3412. __pyx_L1_error:;
  3413. __Pyx_XDECREF(__pyx_t_1);
  3414. __Pyx_XDECREF(__pyx_t_3);
  3415. __Pyx_XDECREF(__pyx_t_11);
  3416. __Pyx_AddTraceback("fontTools.varLib.iup.iup_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3417. __pyx_r = 0;
  3418. __pyx_L0:;
  3419. __Pyx_XDECREF(__pyx_v_out_arrays);
  3420. __Pyx_XDECREF(__pyx_v_out);
  3421. __Pyx_XDECREF(__pyx_v_pair);
  3422. __Pyx_XGIVEREF(__pyx_r);
  3423. __Pyx_RefNannyFinishContext();
  3424. return __pyx_r;
  3425. }
  3426. /* "fontTools/varLib/iup.py":91
  3427. *
  3428. *
  3429. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  3430. * """For the contour given in `coords`, interpolate any missing
  3431. * delta values in delta vector `deltas`.
  3432. */
  3433. /* Python wrapper */
  3434. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_1iup_contour(PyObject *__pyx_self,
  3435. #if CYTHON_METH_FASTCALL
  3436. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3437. #else
  3438. PyObject *__pyx_args, PyObject *__pyx_kwds
  3439. #endif
  3440. ); /*proto*/
  3441. 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.");
  3442. 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};
  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. ) {
  3450. PyObject *__pyx_v_deltas = 0;
  3451. PyObject *__pyx_v_coords = 0;
  3452. #if !CYTHON_METH_FASTCALL
  3453. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3454. #endif
  3455. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3456. PyObject* values[2] = {0,0};
  3457. int __pyx_lineno = 0;
  3458. const char *__pyx_filename = NULL;
  3459. int __pyx_clineno = 0;
  3460. PyObject *__pyx_r = 0;
  3461. __Pyx_RefNannyDeclarations
  3462. __Pyx_RefNannySetupContext("iup_contour (wrapper)", 0);
  3463. #if !CYTHON_METH_FASTCALL
  3464. #if CYTHON_ASSUME_SAFE_SIZE
  3465. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3466. #else
  3467. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3468. #endif
  3469. #endif
  3470. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3471. {
  3472. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_deltas,&__pyx_mstate_global->__pyx_n_u_coords,0};
  3473. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3474. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 91, __pyx_L3_error)
  3475. if (__pyx_kwds_len > 0) {
  3476. switch (__pyx_nargs) {
  3477. case 2:
  3478. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3479. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 91, __pyx_L3_error)
  3480. CYTHON_FALLTHROUGH;
  3481. case 1:
  3482. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3483. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error)
  3484. CYTHON_FALLTHROUGH;
  3485. case 0: break;
  3486. default: goto __pyx_L5_argtuple_error;
  3487. }
  3488. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3489. 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)
  3490. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  3491. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, i); __PYX_ERR(0, 91, __pyx_L3_error) }
  3492. }
  3493. } else if (unlikely(__pyx_nargs != 2)) {
  3494. goto __pyx_L5_argtuple_error;
  3495. } else {
  3496. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3497. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error)
  3498. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3499. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 91, __pyx_L3_error)
  3500. }
  3501. __pyx_v_deltas = values[0];
  3502. __pyx_v_coords = values[1];
  3503. }
  3504. goto __pyx_L6_skip;
  3505. __pyx_L5_argtuple_error:;
  3506. __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error)
  3507. __pyx_L6_skip:;
  3508. goto __pyx_L4_argument_unpacking_done;
  3509. __pyx_L3_error:;
  3510. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3511. Py_XDECREF(values[__pyx_temp]);
  3512. }
  3513. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3514. __Pyx_RefNannyFinishContext();
  3515. return NULL;
  3516. __pyx_L4_argument_unpacking_done:;
  3517. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_iup_contour(__pyx_self, __pyx_v_deltas, __pyx_v_coords);
  3518. /* function exit code */
  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_RefNannyFinishContext();
  3523. return __pyx_r;
  3524. }
  3525. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords) {
  3526. PyObject *__pyx_v_n = NULL;
  3527. PyObject *__pyx_v_indices = NULL;
  3528. PyObject *__pyx_v_out = NULL;
  3529. PyObject *__pyx_v_it = NULL;
  3530. PyObject *__pyx_v_start = NULL;
  3531. PyObject *__pyx_v_i1 = NULL;
  3532. PyObject *__pyx_v_i2 = NULL;
  3533. PyObject *__pyx_v_ri1 = NULL;
  3534. PyObject *__pyx_v_ri2 = NULL;
  3535. PyObject *__pyx_v_end = NULL;
  3536. PyObject *__pyx_7genexpr__pyx_v_i = NULL;
  3537. PyObject *__pyx_7genexpr__pyx_v_v = NULL;
  3538. PyObject *__pyx_r = NULL;
  3539. __Pyx_RefNannyDeclarations
  3540. Py_ssize_t __pyx_t_1;
  3541. Py_ssize_t __pyx_t_2;
  3542. int __pyx_t_3;
  3543. PyObject *__pyx_t_4 = NULL;
  3544. PyObject *__pyx_t_5 = NULL;
  3545. PyObject *__pyx_t_6 = NULL;
  3546. PyObject *(*__pyx_t_7)(PyObject *);
  3547. PyObject *__pyx_t_8 = NULL;
  3548. int __pyx_t_9;
  3549. PyObject *__pyx_t_10 = NULL;
  3550. PyObject *__pyx_t_11 = NULL;
  3551. int __pyx_t_12;
  3552. PyObject *__pyx_t_13 = NULL;
  3553. int __pyx_lineno = 0;
  3554. const char *__pyx_filename = NULL;
  3555. int __pyx_clineno = 0;
  3556. __Pyx_RefNannySetupContext("iup_contour", 0);
  3557. /* "fontTools/varLib/iup.py":97
  3558. * Returns fully filled-out delta vector."""
  3559. *
  3560. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  3561. * if None not in deltas:
  3562. * return deltas
  3563. */
  3564. #ifndef CYTHON_WITHOUT_ASSERTIONS
  3565. if (unlikely(__pyx_assertions_enabled())) {
  3566. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  3567. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  3568. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  3569. if (unlikely(!__pyx_t_3)) {
  3570. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  3571. __PYX_ERR(0, 97, __pyx_L1_error)
  3572. }
  3573. }
  3574. #else
  3575. if ((1)); else __PYX_ERR(0, 97, __pyx_L1_error)
  3576. #endif
  3577. /* "fontTools/varLib/iup.py":98
  3578. *
  3579. * assert len(deltas) == len(coords)
  3580. * if None not in deltas: # <<<<<<<<<<<<<<
  3581. * return deltas
  3582. *
  3583. */
  3584. __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)
  3585. if (__pyx_t_3) {
  3586. /* "fontTools/varLib/iup.py":99
  3587. * assert len(deltas) == len(coords)
  3588. * if None not in deltas:
  3589. * return deltas # <<<<<<<<<<<<<<
  3590. *
  3591. * n = len(deltas)
  3592. */
  3593. __Pyx_XDECREF(__pyx_r);
  3594. __Pyx_INCREF(__pyx_v_deltas);
  3595. __pyx_r = __pyx_v_deltas;
  3596. goto __pyx_L0;
  3597. /* "fontTools/varLib/iup.py":98
  3598. *
  3599. * assert len(deltas) == len(coords)
  3600. * if None not in deltas: # <<<<<<<<<<<<<<
  3601. * return deltas
  3602. *
  3603. */
  3604. }
  3605. /* "fontTools/varLib/iup.py":101
  3606. * return deltas
  3607. *
  3608. * n = len(deltas) # <<<<<<<<<<<<<<
  3609. * # indices of points with explicit deltas
  3610. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3611. */
  3612. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error)
  3613. __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
  3614. __Pyx_GOTREF(__pyx_t_4);
  3615. __pyx_v_n = __pyx_t_4;
  3616. __pyx_t_4 = 0;
  3617. /* "fontTools/varLib/iup.py":103
  3618. * n = len(deltas)
  3619. * # indices of points with explicit deltas
  3620. * indices = [i for i, v in enumerate(deltas) if v is not None] # <<<<<<<<<<<<<<
  3621. * if not indices:
  3622. * # All deltas are None. Return 0,0 for all.
  3623. */
  3624. { /* enter inner scope */
  3625. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L6_error)
  3626. __Pyx_GOTREF(__pyx_t_4);
  3627. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  3628. __pyx_t_5 = __pyx_mstate_global->__pyx_int_0;
  3629. if (likely(PyList_CheckExact(__pyx_v_deltas)) || PyTuple_CheckExact(__pyx_v_deltas)) {
  3630. __pyx_t_6 = __pyx_v_deltas; __Pyx_INCREF(__pyx_t_6);
  3631. __pyx_t_2 = 0;
  3632. __pyx_t_7 = NULL;
  3633. } else {
  3634. __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_deltas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L6_error)
  3635. __Pyx_GOTREF(__pyx_t_6);
  3636. __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)
  3637. }
  3638. for (;;) {
  3639. if (likely(!__pyx_t_7)) {
  3640. if (likely(PyList_CheckExact(__pyx_t_6))) {
  3641. {
  3642. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  3643. #if !CYTHON_ASSUME_SAFE_SIZE
  3644. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L6_error)
  3645. #endif
  3646. if (__pyx_t_2 >= __pyx_temp) break;
  3647. }
  3648. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  3649. ++__pyx_t_2;
  3650. } else {
  3651. {
  3652. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  3653. #if !CYTHON_ASSUME_SAFE_SIZE
  3654. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L6_error)
  3655. #endif
  3656. if (__pyx_t_2 >= __pyx_temp) break;
  3657. }
  3658. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3659. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2));
  3660. #else
  3661. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_2);
  3662. #endif
  3663. ++__pyx_t_2;
  3664. }
  3665. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L6_error)
  3666. } else {
  3667. __pyx_t_8 = __pyx_t_7(__pyx_t_6);
  3668. if (unlikely(!__pyx_t_8)) {
  3669. PyObject* exc_type = PyErr_Occurred();
  3670. if (exc_type) {
  3671. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 103, __pyx_L6_error)
  3672. PyErr_Clear();
  3673. }
  3674. break;
  3675. }
  3676. }
  3677. __Pyx_GOTREF(__pyx_t_8);
  3678. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_8);
  3679. __pyx_t_8 = 0;
  3680. __Pyx_INCREF(__pyx_t_5);
  3681. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_5);
  3682. __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)
  3683. __Pyx_GOTREF(__pyx_t_8);
  3684. __Pyx_DECREF(__pyx_t_5);
  3685. __pyx_t_5 = __pyx_t_8;
  3686. __pyx_t_8 = 0;
  3687. __pyx_t_3 = (__pyx_7genexpr__pyx_v_v != Py_None);
  3688. if (__pyx_t_3) {
  3689. if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_7genexpr__pyx_v_i))) __PYX_ERR(0, 103, __pyx_L6_error)
  3690. }
  3691. }
  3692. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3693. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3694. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3695. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3696. goto __pyx_L11_exit_scope;
  3697. __pyx_L6_error:;
  3698. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3699. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3700. goto __pyx_L1_error;
  3701. __pyx_L11_exit_scope:;
  3702. } /* exit inner scope */
  3703. __pyx_v_indices = ((PyObject*)__pyx_t_4);
  3704. __pyx_t_4 = 0;
  3705. /* "fontTools/varLib/iup.py":104
  3706. * # indices of points with explicit deltas
  3707. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3708. * if not indices: # <<<<<<<<<<<<<<
  3709. * # All deltas are None. Return 0,0 for all.
  3710. * return [(0, 0)] * n
  3711. */
  3712. {
  3713. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_v_indices);
  3714. if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error)
  3715. __pyx_t_3 = (__pyx_temp != 0);
  3716. }
  3717. __pyx_t_9 = (!__pyx_t_3);
  3718. if (__pyx_t_9) {
  3719. /* "fontTools/varLib/iup.py":106
  3720. * if not indices:
  3721. * # All deltas are None. Return 0,0 for all.
  3722. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  3723. *
  3724. * out = []
  3725. */
  3726. __Pyx_XDECREF(__pyx_r);
  3727. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
  3728. __Pyx_GOTREF(__pyx_t_4);
  3729. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  3730. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  3731. if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_tuple[1]) != (0)) __PYX_ERR(0, 106, __pyx_L1_error);
  3732. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 106, __pyx_L1_error)
  3733. __Pyx_GOTREF(__pyx_temp);
  3734. __Pyx_DECREF(__pyx_t_4);
  3735. __pyx_t_4 = __pyx_temp;
  3736. }
  3737. __pyx_r = __pyx_t_4;
  3738. __pyx_t_4 = 0;
  3739. goto __pyx_L0;
  3740. /* "fontTools/varLib/iup.py":104
  3741. * # indices of points with explicit deltas
  3742. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3743. * if not indices: # <<<<<<<<<<<<<<
  3744. * # All deltas are None. Return 0,0 for all.
  3745. * return [(0, 0)] * n
  3746. */
  3747. }
  3748. /* "fontTools/varLib/iup.py":108
  3749. * return [(0, 0)] * n
  3750. *
  3751. * out = [] # <<<<<<<<<<<<<<
  3752. * it = iter(indices)
  3753. * start = next(it)
  3754. */
  3755. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
  3756. __Pyx_GOTREF(__pyx_t_4);
  3757. __pyx_v_out = ((PyObject*)__pyx_t_4);
  3758. __pyx_t_4 = 0;
  3759. /* "fontTools/varLib/iup.py":109
  3760. *
  3761. * out = []
  3762. * it = iter(indices) # <<<<<<<<<<<<<<
  3763. * start = next(it)
  3764. * if start != 0:
  3765. */
  3766. __pyx_t_4 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
  3767. __Pyx_GOTREF(__pyx_t_4);
  3768. __pyx_v_it = __pyx_t_4;
  3769. __pyx_t_4 = 0;
  3770. /* "fontTools/varLib/iup.py":110
  3771. * out = []
  3772. * it = iter(indices)
  3773. * start = next(it) # <<<<<<<<<<<<<<
  3774. * if start != 0:
  3775. * # Initial segment that wraps around
  3776. */
  3777. __pyx_t_4 = __Pyx_PyIter_Next(__pyx_v_it); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
  3778. __Pyx_GOTREF(__pyx_t_4);
  3779. __pyx_v_start = __pyx_t_4;
  3780. __pyx_t_4 = 0;
  3781. /* "fontTools/varLib/iup.py":111
  3782. * it = iter(indices)
  3783. * start = next(it)
  3784. * if start != 0: # <<<<<<<<<<<<<<
  3785. * # Initial segment that wraps around
  3786. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3787. */
  3788. __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)
  3789. if (__pyx_t_9) {
  3790. /* "fontTools/varLib/iup.py":113
  3791. * if start != 0:
  3792. * # Initial segment that wraps around
  3793. * i1, i2, ri1, ri2 = 0, start, start, indices[-1] # <<<<<<<<<<<<<<
  3794. * out.extend(
  3795. * iup_segment(
  3796. */
  3797. __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
  3798. __Pyx_INCREF(__pyx_t_4);
  3799. __pyx_t_5 = __pyx_v_start;
  3800. __Pyx_INCREF(__pyx_t_5);
  3801. __pyx_t_6 = __pyx_v_start;
  3802. __Pyx_INCREF(__pyx_t_6);
  3803. __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)
  3804. __Pyx_GOTREF(__pyx_t_8);
  3805. __pyx_v_i1 = __pyx_t_4;
  3806. __pyx_t_4 = 0;
  3807. __pyx_v_i2 = __pyx_t_5;
  3808. __pyx_t_5 = 0;
  3809. __pyx_v_ri1 = __pyx_t_6;
  3810. __pyx_t_6 = 0;
  3811. __pyx_v_ri2 = __pyx_t_8;
  3812. __pyx_t_8 = 0;
  3813. /* "fontTools/varLib/iup.py":116
  3814. * out.extend(
  3815. * iup_segment(
  3816. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  3817. * )
  3818. * )
  3819. */
  3820. __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)
  3821. __Pyx_GOTREF(__pyx_t_8);
  3822. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error)
  3823. __Pyx_GOTREF(__pyx_t_6);
  3824. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error)
  3825. __Pyx_GOTREF(__pyx_t_5);
  3826. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  3827. __Pyx_GOTREF(__pyx_t_4);
  3828. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 116, __pyx_L1_error)
  3829. __Pyx_GOTREF(__pyx_t_10);
  3830. /* "fontTools/varLib/iup.py":115
  3831. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3832. * out.extend(
  3833. * iup_segment( # <<<<<<<<<<<<<<
  3834. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3835. * )
  3836. */
  3837. __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)
  3838. __Pyx_GOTREF(__pyx_t_11);
  3839. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3840. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3841. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3842. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3843. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3844. /* "fontTools/varLib/iup.py":114
  3845. * # Initial segment that wraps around
  3846. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3847. * out.extend( # <<<<<<<<<<<<<<
  3848. * iup_segment(
  3849. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3850. */
  3851. __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)
  3852. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3853. /* "fontTools/varLib/iup.py":111
  3854. * it = iter(indices)
  3855. * start = next(it)
  3856. * if start != 0: # <<<<<<<<<<<<<<
  3857. * # Initial segment that wraps around
  3858. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  3859. */
  3860. }
  3861. /* "fontTools/varLib/iup.py":119
  3862. * )
  3863. * )
  3864. * out.append(deltas[start]) # <<<<<<<<<<<<<<
  3865. * for end in it:
  3866. * if end - start > 1:
  3867. */
  3868. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L1_error)
  3869. __Pyx_GOTREF(__pyx_t_11);
  3870. __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)
  3871. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3872. /* "fontTools/varLib/iup.py":120
  3873. * )
  3874. * out.append(deltas[start])
  3875. * for end in it: # <<<<<<<<<<<<<<
  3876. * if end - start > 1:
  3877. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3878. */
  3879. if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) {
  3880. __pyx_t_11 = __pyx_v_it; __Pyx_INCREF(__pyx_t_11);
  3881. __pyx_t_2 = 0;
  3882. __pyx_t_7 = NULL;
  3883. } else {
  3884. __pyx_t_2 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 120, __pyx_L1_error)
  3885. __Pyx_GOTREF(__pyx_t_11);
  3886. __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)
  3887. }
  3888. for (;;) {
  3889. if (likely(!__pyx_t_7)) {
  3890. if (likely(PyList_CheckExact(__pyx_t_11))) {
  3891. {
  3892. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  3893. #if !CYTHON_ASSUME_SAFE_SIZE
  3894. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 120, __pyx_L1_error)
  3895. #endif
  3896. if (__pyx_t_2 >= __pyx_temp) break;
  3897. }
  3898. __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  3899. ++__pyx_t_2;
  3900. } else {
  3901. {
  3902. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  3903. #if !CYTHON_ASSUME_SAFE_SIZE
  3904. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 120, __pyx_L1_error)
  3905. #endif
  3906. if (__pyx_t_2 >= __pyx_temp) break;
  3907. }
  3908. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3909. __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_2));
  3910. #else
  3911. __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2);
  3912. #endif
  3913. ++__pyx_t_2;
  3914. }
  3915. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error)
  3916. } else {
  3917. __pyx_t_10 = __pyx_t_7(__pyx_t_11);
  3918. if (unlikely(!__pyx_t_10)) {
  3919. PyObject* exc_type = PyErr_Occurred();
  3920. if (exc_type) {
  3921. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 120, __pyx_L1_error)
  3922. PyErr_Clear();
  3923. }
  3924. break;
  3925. }
  3926. }
  3927. __Pyx_GOTREF(__pyx_t_10);
  3928. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_10);
  3929. __pyx_t_10 = 0;
  3930. /* "fontTools/varLib/iup.py":121
  3931. * out.append(deltas[start])
  3932. * for end in it:
  3933. * if end - start > 1: # <<<<<<<<<<<<<<
  3934. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3935. * out.extend(
  3936. */
  3937. __pyx_t_10 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error)
  3938. __Pyx_GOTREF(__pyx_t_10);
  3939. __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)
  3940. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3941. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  3942. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3943. if (__pyx_t_9) {
  3944. /* "fontTools/varLib/iup.py":122
  3945. * for end in it:
  3946. * if end - start > 1:
  3947. * i1, i2, ri1, ri2 = start + 1, end, start, end # <<<<<<<<<<<<<<
  3948. * out.extend(
  3949. * iup_segment(
  3950. */
  3951. __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)
  3952. __Pyx_GOTREF(__pyx_t_4);
  3953. __pyx_t_10 = __pyx_v_end;
  3954. __Pyx_INCREF(__pyx_t_10);
  3955. __pyx_t_5 = __pyx_v_start;
  3956. __Pyx_INCREF(__pyx_t_5);
  3957. __pyx_t_6 = __pyx_v_end;
  3958. __Pyx_INCREF(__pyx_t_6);
  3959. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_4);
  3960. __pyx_t_4 = 0;
  3961. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_10);
  3962. __pyx_t_10 = 0;
  3963. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_5);
  3964. __pyx_t_5 = 0;
  3965. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_6);
  3966. __pyx_t_6 = 0;
  3967. /* "fontTools/varLib/iup.py":125
  3968. * out.extend(
  3969. * iup_segment(
  3970. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  3971. * )
  3972. * )
  3973. */
  3974. __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)
  3975. __Pyx_GOTREF(__pyx_t_6);
  3976. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
  3977. __Pyx_GOTREF(__pyx_t_5);
  3978. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 125, __pyx_L1_error)
  3979. __Pyx_GOTREF(__pyx_t_10);
  3980. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error)
  3981. __Pyx_GOTREF(__pyx_t_4);
  3982. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 125, __pyx_L1_error)
  3983. __Pyx_GOTREF(__pyx_t_8);
  3984. /* "fontTools/varLib/iup.py":124
  3985. * i1, i2, ri1, ri2 = start + 1, end, start, end
  3986. * out.extend(
  3987. * iup_segment( # <<<<<<<<<<<<<<
  3988. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  3989. * )
  3990. */
  3991. __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)
  3992. __Pyx_GOTREF(__pyx_t_13);
  3993. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3994. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3995. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3996. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3997. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3998. /* "fontTools/varLib/iup.py":123
  3999. * if end - start > 1:
  4000. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4001. * out.extend( # <<<<<<<<<<<<<<
  4002. * iup_segment(
  4003. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4004. */
  4005. __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)
  4006. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4007. /* "fontTools/varLib/iup.py":121
  4008. * out.append(deltas[start])
  4009. * for end in it:
  4010. * if end - start > 1: # <<<<<<<<<<<<<<
  4011. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4012. * out.extend(
  4013. */
  4014. }
  4015. /* "fontTools/varLib/iup.py":128
  4016. * )
  4017. * )
  4018. * out.append(deltas[end]) # <<<<<<<<<<<<<<
  4019. * start = end
  4020. * if start != n - 1:
  4021. */
  4022. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_end); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 128, __pyx_L1_error)
  4023. __Pyx_GOTREF(__pyx_t_13);
  4024. __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)
  4025. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4026. /* "fontTools/varLib/iup.py":129
  4027. * )
  4028. * out.append(deltas[end])
  4029. * start = end # <<<<<<<<<<<<<<
  4030. * if start != n - 1:
  4031. * # Final segment that wraps around
  4032. */
  4033. __Pyx_INCREF(__pyx_v_end);
  4034. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4035. /* "fontTools/varLib/iup.py":120
  4036. * )
  4037. * out.append(deltas[start])
  4038. * for end in it: # <<<<<<<<<<<<<<
  4039. * if end - start > 1:
  4040. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4041. */
  4042. }
  4043. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4044. /* "fontTools/varLib/iup.py":130
  4045. * out.append(deltas[end])
  4046. * start = end
  4047. * if start != n - 1: # <<<<<<<<<<<<<<
  4048. * # Final segment that wraps around
  4049. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4050. */
  4051. __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)
  4052. __Pyx_GOTREF(__pyx_t_11);
  4053. __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)
  4054. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4055. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 130, __pyx_L1_error)
  4056. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4057. if (__pyx_t_9) {
  4058. /* "fontTools/varLib/iup.py":132
  4059. * if start != n - 1:
  4060. * # Final segment that wraps around
  4061. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0] # <<<<<<<<<<<<<<
  4062. * out.extend(
  4063. * iup_segment(
  4064. */
  4065. __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)
  4066. __Pyx_GOTREF(__pyx_t_13);
  4067. __pyx_t_11 = __pyx_v_n;
  4068. __Pyx_INCREF(__pyx_t_11);
  4069. __pyx_t_8 = __pyx_v_start;
  4070. __Pyx_INCREF(__pyx_t_8);
  4071. __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)
  4072. __Pyx_GOTREF(__pyx_t_4);
  4073. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_13);
  4074. __pyx_t_13 = 0;
  4075. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_11);
  4076. __pyx_t_11 = 0;
  4077. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_8);
  4078. __pyx_t_8 = 0;
  4079. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_4);
  4080. __pyx_t_4 = 0;
  4081. /* "fontTools/varLib/iup.py":135
  4082. * out.extend(
  4083. * iup_segment(
  4084. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  4085. * )
  4086. * )
  4087. */
  4088. __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)
  4089. __Pyx_GOTREF(__pyx_t_4);
  4090. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 135, __pyx_L1_error)
  4091. __Pyx_GOTREF(__pyx_t_8);
  4092. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
  4093. __Pyx_GOTREF(__pyx_t_11);
  4094. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 135, __pyx_L1_error)
  4095. __Pyx_GOTREF(__pyx_t_13);
  4096. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
  4097. __Pyx_GOTREF(__pyx_t_10);
  4098. /* "fontTools/varLib/iup.py":134
  4099. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4100. * out.extend(
  4101. * iup_segment( # <<<<<<<<<<<<<<
  4102. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4103. * )
  4104. */
  4105. __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)
  4106. __Pyx_GOTREF(__pyx_t_5);
  4107. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4108. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4109. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4110. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4111. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4112. /* "fontTools/varLib/iup.py":133
  4113. * # Final segment that wraps around
  4114. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4115. * out.extend( # <<<<<<<<<<<<<<
  4116. * iup_segment(
  4117. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4118. */
  4119. __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)
  4120. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4121. /* "fontTools/varLib/iup.py":130
  4122. * out.append(deltas[end])
  4123. * start = end
  4124. * if start != n - 1: # <<<<<<<<<<<<<<
  4125. * # Final segment that wraps around
  4126. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4127. */
  4128. }
  4129. /* "fontTools/varLib/iup.py":139
  4130. * )
  4131. *
  4132. * assert len(deltas) == len(out), (len(deltas), len(out)) # <<<<<<<<<<<<<<
  4133. * return out
  4134. *
  4135. */
  4136. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4137. if (unlikely(__pyx_assertions_enabled())) {
  4138. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4139. __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)
  4140. __pyx_t_9 = (__pyx_t_2 == __pyx_t_1);
  4141. if (unlikely(!__pyx_t_9)) {
  4142. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 139, __pyx_L1_error)
  4143. __pyx_t_5 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
  4144. __Pyx_GOTREF(__pyx_t_5);
  4145. __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)
  4146. __pyx_t_10 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error)
  4147. __Pyx_GOTREF(__pyx_t_10);
  4148. __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error)
  4149. __Pyx_GOTREF(__pyx_t_13);
  4150. __Pyx_GIVEREF(__pyx_t_5);
  4151. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 139, __pyx_L1_error);
  4152. __Pyx_GIVEREF(__pyx_t_10);
  4153. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 139, __pyx_L1_error);
  4154. __pyx_t_5 = 0;
  4155. __pyx_t_10 = 0;
  4156. __pyx_t_10 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error)
  4157. __Pyx_GOTREF(__pyx_t_10);
  4158. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4159. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_10, 0, 0);
  4160. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4161. __PYX_ERR(0, 139, __pyx_L1_error)
  4162. }
  4163. }
  4164. #else
  4165. if ((1)); else __PYX_ERR(0, 139, __pyx_L1_error)
  4166. #endif
  4167. /* "fontTools/varLib/iup.py":140
  4168. *
  4169. * assert len(deltas) == len(out), (len(deltas), len(out))
  4170. * return out # <<<<<<<<<<<<<<
  4171. *
  4172. *
  4173. */
  4174. __Pyx_XDECREF(__pyx_r);
  4175. __Pyx_INCREF(__pyx_v_out);
  4176. __pyx_r = __pyx_v_out;
  4177. goto __pyx_L0;
  4178. /* "fontTools/varLib/iup.py":91
  4179. *
  4180. *
  4181. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  4182. * """For the contour given in `coords`, interpolate any missing
  4183. * delta values in delta vector `deltas`.
  4184. */
  4185. /* function exit code */
  4186. __pyx_L1_error:;
  4187. __Pyx_XDECREF(__pyx_t_4);
  4188. __Pyx_XDECREF(__pyx_t_5);
  4189. __Pyx_XDECREF(__pyx_t_6);
  4190. __Pyx_XDECREF(__pyx_t_8);
  4191. __Pyx_XDECREF(__pyx_t_10);
  4192. __Pyx_XDECREF(__pyx_t_11);
  4193. __Pyx_XDECREF(__pyx_t_13);
  4194. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4195. __pyx_r = NULL;
  4196. __pyx_L0:;
  4197. __Pyx_XDECREF(__pyx_v_n);
  4198. __Pyx_XDECREF(__pyx_v_indices);
  4199. __Pyx_XDECREF(__pyx_v_out);
  4200. __Pyx_XDECREF(__pyx_v_it);
  4201. __Pyx_XDECREF(__pyx_v_start);
  4202. __Pyx_XDECREF(__pyx_v_i1);
  4203. __Pyx_XDECREF(__pyx_v_i2);
  4204. __Pyx_XDECREF(__pyx_v_ri1);
  4205. __Pyx_XDECREF(__pyx_v_ri2);
  4206. __Pyx_XDECREF(__pyx_v_end);
  4207. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
  4208. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v);
  4209. __Pyx_XGIVEREF(__pyx_r);
  4210. __Pyx_RefNannyFinishContext();
  4211. return __pyx_r;
  4212. }
  4213. /* "fontTools/varLib/iup.py":143
  4214. *
  4215. *
  4216. * def iup_delta( # <<<<<<<<<<<<<<
  4217. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4218. * ) -> _DeltaSegment:
  4219. */
  4220. /* Python wrapper */
  4221. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_3iup_delta(PyObject *__pyx_self,
  4222. #if CYTHON_METH_FASTCALL
  4223. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4224. #else
  4225. PyObject *__pyx_args, PyObject *__pyx_kwds
  4226. #endif
  4227. ); /*proto*/
  4228. 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.");
  4229. 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};
  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. ) {
  4237. PyObject *__pyx_v_deltas = 0;
  4238. PyObject *__pyx_v_coords = 0;
  4239. PyObject *__pyx_v_ends = 0;
  4240. #if !CYTHON_METH_FASTCALL
  4241. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4242. #endif
  4243. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4244. PyObject* values[3] = {0,0,0};
  4245. int __pyx_lineno = 0;
  4246. const char *__pyx_filename = NULL;
  4247. int __pyx_clineno = 0;
  4248. PyObject *__pyx_r = 0;
  4249. __Pyx_RefNannyDeclarations
  4250. __Pyx_RefNannySetupContext("iup_delta (wrapper)", 0);
  4251. #if !CYTHON_METH_FASTCALL
  4252. #if CYTHON_ASSUME_SAFE_SIZE
  4253. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4254. #else
  4255. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4256. #endif
  4257. #endif
  4258. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4259. {
  4260. 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};
  4261. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4262. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 143, __pyx_L3_error)
  4263. if (__pyx_kwds_len > 0) {
  4264. switch (__pyx_nargs) {
  4265. case 3:
  4266. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4267. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 143, __pyx_L3_error)
  4268. CYTHON_FALLTHROUGH;
  4269. case 2:
  4270. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4271. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 143, __pyx_L3_error)
  4272. CYTHON_FALLTHROUGH;
  4273. case 1:
  4274. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4275. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 143, __pyx_L3_error)
  4276. CYTHON_FALLTHROUGH;
  4277. case 0: break;
  4278. default: goto __pyx_L5_argtuple_error;
  4279. }
  4280. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4281. 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)
  4282. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  4283. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, i); __PYX_ERR(0, 143, __pyx_L3_error) }
  4284. }
  4285. } else if (unlikely(__pyx_nargs != 3)) {
  4286. goto __pyx_L5_argtuple_error;
  4287. } else {
  4288. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4289. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 143, __pyx_L3_error)
  4290. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4291. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 143, __pyx_L3_error)
  4292. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4293. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 143, __pyx_L3_error)
  4294. }
  4295. __pyx_v_deltas = values[0];
  4296. __pyx_v_coords = values[1];
  4297. __pyx_v_ends = values[2];
  4298. }
  4299. goto __pyx_L6_skip;
  4300. __pyx_L5_argtuple_error:;
  4301. __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 143, __pyx_L3_error)
  4302. __pyx_L6_skip:;
  4303. goto __pyx_L4_argument_unpacking_done;
  4304. __pyx_L3_error:;
  4305. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4306. Py_XDECREF(values[__pyx_temp]);
  4307. }
  4308. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4309. __Pyx_RefNannyFinishContext();
  4310. return NULL;
  4311. __pyx_L4_argument_unpacking_done:;
  4312. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_2iup_delta(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends);
  4313. /* function exit code */
  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_RefNannyFinishContext();
  4318. return __pyx_r;
  4319. }
  4320. 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) {
  4321. PyObject *__pyx_v_n = NULL;
  4322. PyObject *__pyx_v_out = NULL;
  4323. PyObject *__pyx_v_start = NULL;
  4324. PyObject *__pyx_v_end = NULL;
  4325. PyObject *__pyx_v_contour = NULL;
  4326. PyObject *__pyx_r = NULL;
  4327. __Pyx_RefNannyDeclarations
  4328. int __pyx_t_1;
  4329. PyObject *__pyx_t_2 = NULL;
  4330. PyObject *__pyx_t_3 = NULL;
  4331. int __pyx_t_4;
  4332. Py_ssize_t __pyx_t_5;
  4333. PyObject *__pyx_t_6 = NULL;
  4334. PyObject *__pyx_t_7 = NULL;
  4335. PyObject *__pyx_t_8 = NULL;
  4336. PyObject *(*__pyx_t_9)(PyObject *);
  4337. PyObject *__pyx_t_10 = NULL;
  4338. size_t __pyx_t_11;
  4339. int __pyx_t_12;
  4340. int __pyx_lineno = 0;
  4341. const char *__pyx_filename = NULL;
  4342. int __pyx_clineno = 0;
  4343. __Pyx_RefNannySetupContext("iup_delta", 0);
  4344. __Pyx_INCREF(__pyx_v_ends);
  4345. /* "fontTools/varLib/iup.py":152
  4346. * Returns fully filled-out delta vector."""
  4347. *
  4348. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  4349. * n = len(coords)
  4350. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4351. */
  4352. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4353. if (unlikely(__pyx_assertions_enabled())) {
  4354. __pyx_t_2 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
  4355. __Pyx_GOTREF(__pyx_t_2);
  4356. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4357. __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)
  4358. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4359. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4360. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4361. if (__pyx_t_4) {
  4362. } else {
  4363. __pyx_t_1 = __pyx_t_4;
  4364. goto __pyx_L3_bool_binop_done;
  4365. }
  4366. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 152, __pyx_L1_error)
  4367. __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
  4368. __Pyx_GOTREF(__pyx_t_3);
  4369. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4370. if (__pyx_t_4) {
  4371. __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)
  4372. __Pyx_GOTREF(__pyx_t_6);
  4373. __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)
  4374. __Pyx_GOTREF(__pyx_t_7);
  4375. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4376. __pyx_t_2 = __pyx_t_7;
  4377. __pyx_t_7 = 0;
  4378. } else {
  4379. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  4380. __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  4381. }
  4382. __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)
  4383. __Pyx_GOTREF(__pyx_t_7);
  4384. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4385. __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)
  4386. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4387. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4388. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  4389. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4390. __pyx_t_1 = __pyx_t_4;
  4391. __pyx_L3_bool_binop_done:;
  4392. if (unlikely(!__pyx_t_1)) {
  4393. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  4394. __PYX_ERR(0, 152, __pyx_L1_error)
  4395. }
  4396. }
  4397. #else
  4398. if ((1)); else __PYX_ERR(0, 152, __pyx_L1_error)
  4399. #endif
  4400. /* "fontTools/varLib/iup.py":153
  4401. *
  4402. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4403. * n = len(coords) # <<<<<<<<<<<<<<
  4404. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4405. * out = []
  4406. */
  4407. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 153, __pyx_L1_error)
  4408. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  4409. __Pyx_GOTREF(__pyx_t_2);
  4410. __pyx_v_n = __pyx_t_2;
  4411. __pyx_t_2 = 0;
  4412. /* "fontTools/varLib/iup.py":154
  4413. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4414. * n = len(coords)
  4415. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  4416. * out = []
  4417. * start = 0
  4418. */
  4419. __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)
  4420. __Pyx_GOTREF(__pyx_t_2);
  4421. __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)
  4422. __Pyx_GOTREF(__pyx_t_7);
  4423. __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)
  4424. __Pyx_GOTREF(__pyx_t_3);
  4425. __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)
  4426. __Pyx_GOTREF(__pyx_t_6);
  4427. __pyx_t_8 = PyList_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 154, __pyx_L1_error)
  4428. __Pyx_GOTREF(__pyx_t_8);
  4429. __Pyx_GIVEREF(__pyx_t_2);
  4430. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4431. __Pyx_GIVEREF(__pyx_t_7);
  4432. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4433. __Pyx_GIVEREF(__pyx_t_3);
  4434. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4435. __Pyx_GIVEREF(__pyx_t_6);
  4436. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 154, __pyx_L1_error);
  4437. __pyx_t_2 = 0;
  4438. __pyx_t_7 = 0;
  4439. __pyx_t_3 = 0;
  4440. __pyx_t_6 = 0;
  4441. __pyx_t_6 = PyNumber_Add(__pyx_v_ends, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
  4442. __Pyx_GOTREF(__pyx_t_6);
  4443. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4444. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_6);
  4445. __pyx_t_6 = 0;
  4446. /* "fontTools/varLib/iup.py":155
  4447. * n = len(coords)
  4448. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4449. * out = [] # <<<<<<<<<<<<<<
  4450. * start = 0
  4451. * for end in ends:
  4452. */
  4453. __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error)
  4454. __Pyx_GOTREF(__pyx_t_6);
  4455. __pyx_v_out = ((PyObject*)__pyx_t_6);
  4456. __pyx_t_6 = 0;
  4457. /* "fontTools/varLib/iup.py":156
  4458. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4459. * out = []
  4460. * start = 0 # <<<<<<<<<<<<<<
  4461. * for end in ends:
  4462. * end += 1
  4463. */
  4464. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  4465. __pyx_v_start = __pyx_mstate_global->__pyx_int_0;
  4466. /* "fontTools/varLib/iup.py":157
  4467. * out = []
  4468. * start = 0
  4469. * for end in ends: # <<<<<<<<<<<<<<
  4470. * end += 1
  4471. * contour = iup_contour(deltas[start:end], coords[start:end])
  4472. */
  4473. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  4474. __pyx_t_6 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_6);
  4475. __pyx_t_5 = 0;
  4476. __pyx_t_9 = NULL;
  4477. } else {
  4478. __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
  4479. __Pyx_GOTREF(__pyx_t_6);
  4480. __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)
  4481. }
  4482. for (;;) {
  4483. if (likely(!__pyx_t_9)) {
  4484. if (likely(PyList_CheckExact(__pyx_t_6))) {
  4485. {
  4486. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  4487. #if !CYTHON_ASSUME_SAFE_SIZE
  4488. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 157, __pyx_L1_error)
  4489. #endif
  4490. if (__pyx_t_5 >= __pyx_temp) break;
  4491. }
  4492. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
  4493. ++__pyx_t_5;
  4494. } else {
  4495. {
  4496. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  4497. #if !CYTHON_ASSUME_SAFE_SIZE
  4498. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 157, __pyx_L1_error)
  4499. #endif
  4500. if (__pyx_t_5 >= __pyx_temp) break;
  4501. }
  4502. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4503. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5));
  4504. #else
  4505. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_5);
  4506. #endif
  4507. ++__pyx_t_5;
  4508. }
  4509. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error)
  4510. } else {
  4511. __pyx_t_8 = __pyx_t_9(__pyx_t_6);
  4512. if (unlikely(!__pyx_t_8)) {
  4513. PyObject* exc_type = PyErr_Occurred();
  4514. if (exc_type) {
  4515. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 157, __pyx_L1_error)
  4516. PyErr_Clear();
  4517. }
  4518. break;
  4519. }
  4520. }
  4521. __Pyx_GOTREF(__pyx_t_8);
  4522. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_8);
  4523. __pyx_t_8 = 0;
  4524. /* "fontTools/varLib/iup.py":158
  4525. * start = 0
  4526. * for end in ends:
  4527. * end += 1 # <<<<<<<<<<<<<<
  4528. * contour = iup_contour(deltas[start:end], coords[start:end])
  4529. * out.extend(contour)
  4530. */
  4531. __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)
  4532. __Pyx_GOTREF(__pyx_t_8);
  4533. __Pyx_DECREF_SET(__pyx_v_end, __pyx_t_8);
  4534. __pyx_t_8 = 0;
  4535. /* "fontTools/varLib/iup.py":159
  4536. * for end in ends:
  4537. * end += 1
  4538. * contour = iup_contour(deltas[start:end], coords[start:end]) # <<<<<<<<<<<<<<
  4539. * out.extend(contour)
  4540. * start = end
  4541. */
  4542. __pyx_t_3 = NULL;
  4543. __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)
  4544. __Pyx_GOTREF(__pyx_t_7);
  4545. __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)
  4546. __Pyx_GOTREF(__pyx_t_2);
  4547. __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)
  4548. __Pyx_GOTREF(__pyx_t_10);
  4549. __pyx_t_11 = 1;
  4550. #if CYTHON_UNPACK_METHODS
  4551. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  4552. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
  4553. assert(__pyx_t_3);
  4554. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  4555. __Pyx_INCREF(__pyx_t_3);
  4556. __Pyx_INCREF(__pyx__function);
  4557. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  4558. __pyx_t_11 = 0;
  4559. }
  4560. #endif
  4561. {
  4562. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_2, __pyx_t_10};
  4563. __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));
  4564. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4565. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4566. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4567. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4568. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 159, __pyx_L1_error)
  4569. __Pyx_GOTREF(__pyx_t_8);
  4570. }
  4571. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_8);
  4572. __pyx_t_8 = 0;
  4573. /* "fontTools/varLib/iup.py":160
  4574. * end += 1
  4575. * contour = iup_contour(deltas[start:end], coords[start:end])
  4576. * out.extend(contour) # <<<<<<<<<<<<<<
  4577. * start = end
  4578. *
  4579. */
  4580. __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)
  4581. /* "fontTools/varLib/iup.py":161
  4582. * contour = iup_contour(deltas[start:end], coords[start:end])
  4583. * out.extend(contour)
  4584. * start = end # <<<<<<<<<<<<<<
  4585. *
  4586. * return out
  4587. */
  4588. __Pyx_INCREF(__pyx_v_end);
  4589. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4590. /* "fontTools/varLib/iup.py":157
  4591. * out = []
  4592. * start = 0
  4593. * for end in ends: # <<<<<<<<<<<<<<
  4594. * end += 1
  4595. * contour = iup_contour(deltas[start:end], coords[start:end])
  4596. */
  4597. }
  4598. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4599. /* "fontTools/varLib/iup.py":163
  4600. * start = end
  4601. *
  4602. * return out # <<<<<<<<<<<<<<
  4603. *
  4604. *
  4605. */
  4606. __Pyx_XDECREF(__pyx_r);
  4607. __Pyx_INCREF(__pyx_v_out);
  4608. __pyx_r = __pyx_v_out;
  4609. goto __pyx_L0;
  4610. /* "fontTools/varLib/iup.py":143
  4611. *
  4612. *
  4613. * def iup_delta( # <<<<<<<<<<<<<<
  4614. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4615. * ) -> _DeltaSegment:
  4616. */
  4617. /* function exit code */
  4618. __pyx_L1_error:;
  4619. __Pyx_XDECREF(__pyx_t_2);
  4620. __Pyx_XDECREF(__pyx_t_3);
  4621. __Pyx_XDECREF(__pyx_t_6);
  4622. __Pyx_XDECREF(__pyx_t_7);
  4623. __Pyx_XDECREF(__pyx_t_8);
  4624. __Pyx_XDECREF(__pyx_t_10);
  4625. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4626. __pyx_r = NULL;
  4627. __pyx_L0:;
  4628. __Pyx_XDECREF(__pyx_v_n);
  4629. __Pyx_XDECREF(__pyx_v_out);
  4630. __Pyx_XDECREF(__pyx_v_start);
  4631. __Pyx_XDECREF(__pyx_v_end);
  4632. __Pyx_XDECREF(__pyx_v_contour);
  4633. __Pyx_XDECREF(__pyx_v_ends);
  4634. __Pyx_XGIVEREF(__pyx_r);
  4635. __Pyx_RefNannyFinishContext();
  4636. return __pyx_r;
  4637. }
  4638. 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 */
  4639. /* "fontTools/varLib/iup.py":197
  4640. *
  4641. * return all(
  4642. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4643. * for (x, y), (p, q) in zip(deltas, interp)
  4644. * )
  4645. */
  4646. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  4647. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  4648. PyObject *__pyx_r = NULL;
  4649. __Pyx_RefNannyDeclarations
  4650. int __pyx_lineno = 0;
  4651. const char *__pyx_filename = NULL;
  4652. int __pyx_clineno = 0;
  4653. __Pyx_RefNannySetupContext("genexpr", 0);
  4654. __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);
  4655. if (unlikely(!__pyx_cur_scope)) {
  4656. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)Py_None);
  4657. __Pyx_INCREF(Py_None);
  4658. __PYX_ERR(0, 197, __pyx_L1_error)
  4659. } else {
  4660. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  4661. }
  4662. __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;
  4663. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4664. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4665. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  4666. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4667. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4668. {
  4669. __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)
  4670. __Pyx_DECREF(__pyx_cur_scope);
  4671. __Pyx_RefNannyFinishContext();
  4672. return (PyObject *) gen;
  4673. }
  4674. /* function exit code */
  4675. __pyx_L1_error:;
  4676. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4677. __pyx_r = NULL;
  4678. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  4679. __Pyx_XGIVEREF(__pyx_r);
  4680. __Pyx_RefNannyFinishContext();
  4681. return __pyx_r;
  4682. }
  4683. 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 */
  4684. {
  4685. 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);
  4686. PyObject *__pyx_r = NULL;
  4687. PyObject *__pyx_t_1 = NULL;
  4688. Py_ssize_t __pyx_t_2;
  4689. PyObject *(*__pyx_t_3)(PyObject *);
  4690. PyObject *__pyx_t_4 = NULL;
  4691. PyObject *__pyx_t_5 = NULL;
  4692. PyObject *__pyx_t_6 = NULL;
  4693. PyObject *__pyx_t_7 = NULL;
  4694. PyObject *(*__pyx_t_8)(PyObject *);
  4695. PyObject *__pyx_t_9 = NULL;
  4696. PyObject *__pyx_t_10 = NULL;
  4697. double __pyx_t_11;
  4698. double __pyx_t_12;
  4699. size_t __pyx_t_13;
  4700. int __pyx_t_14;
  4701. int __pyx_t_15;
  4702. int __pyx_lineno = 0;
  4703. const char *__pyx_filename = NULL;
  4704. int __pyx_clineno = 0;
  4705. __Pyx_RefNannyDeclarations
  4706. __Pyx_RefNannySetupContext("genexpr", 0);
  4707. switch (__pyx_generator->resume_label) {
  4708. case 0: goto __pyx_L3_first_run;
  4709. default: /* CPython raises the right error here */
  4710. __Pyx_RefNannyFinishContext();
  4711. return NULL;
  4712. }
  4713. __pyx_L3_first_run:;
  4714. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 197, __pyx_L1_error)
  4715. /* "fontTools/varLib/iup.py":198
  4716. * return all(
  4717. * abs(complex(x - p, y - q)) <= tolerance
  4718. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  4719. * )
  4720. *
  4721. */
  4722. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 198, __pyx_L1_error) }
  4723. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  4724. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  4725. __pyx_t_2 = 0;
  4726. __pyx_t_3 = NULL;
  4727. } else {
  4728. __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)
  4729. __Pyx_GOTREF(__pyx_t_1);
  4730. __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)
  4731. }
  4732. for (;;) {
  4733. if (likely(!__pyx_t_3)) {
  4734. if (likely(PyList_CheckExact(__pyx_t_1))) {
  4735. {
  4736. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  4737. #if !CYTHON_ASSUME_SAFE_SIZE
  4738. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error)
  4739. #endif
  4740. if (__pyx_t_2 >= __pyx_temp) break;
  4741. }
  4742. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  4743. ++__pyx_t_2;
  4744. } else {
  4745. {
  4746. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  4747. #if !CYTHON_ASSUME_SAFE_SIZE
  4748. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 198, __pyx_L1_error)
  4749. #endif
  4750. if (__pyx_t_2 >= __pyx_temp) break;
  4751. }
  4752. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4753. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  4754. #else
  4755. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  4756. #endif
  4757. ++__pyx_t_2;
  4758. }
  4759. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error)
  4760. } else {
  4761. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  4762. if (unlikely(!__pyx_t_4)) {
  4763. PyObject* exc_type = PyErr_Occurred();
  4764. if (exc_type) {
  4765. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 198, __pyx_L1_error)
  4766. PyErr_Clear();
  4767. }
  4768. break;
  4769. }
  4770. }
  4771. __Pyx_GOTREF(__pyx_t_4);
  4772. if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
  4773. PyObject* sequence = __pyx_t_4;
  4774. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4775. if (unlikely(size != 2)) {
  4776. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4777. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4778. __PYX_ERR(0, 198, __pyx_L1_error)
  4779. }
  4780. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4781. if (likely(PyTuple_CheckExact(sequence))) {
  4782. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  4783. __Pyx_INCREF(__pyx_t_5);
  4784. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  4785. __Pyx_INCREF(__pyx_t_6);
  4786. } else {
  4787. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4788. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  4789. __Pyx_XGOTREF(__pyx_t_5);
  4790. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4791. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
  4792. __Pyx_XGOTREF(__pyx_t_6);
  4793. }
  4794. #else
  4795. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  4796. __Pyx_GOTREF(__pyx_t_5);
  4797. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
  4798. __Pyx_GOTREF(__pyx_t_6);
  4799. #endif
  4800. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4801. } else {
  4802. Py_ssize_t index = -1;
  4803. __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4804. __Pyx_GOTREF(__pyx_t_7);
  4805. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4806. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  4807. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
  4808. __Pyx_GOTREF(__pyx_t_5);
  4809. index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
  4810. __Pyx_GOTREF(__pyx_t_6);
  4811. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4812. __pyx_t_8 = NULL;
  4813. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4814. goto __pyx_L7_unpacking_done;
  4815. __pyx_L6_unpacking_failed:;
  4816. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4817. __pyx_t_8 = NULL;
  4818. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4819. __PYX_ERR(0, 198, __pyx_L1_error)
  4820. __pyx_L7_unpacking_done:;
  4821. }
  4822. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  4823. PyObject* sequence = __pyx_t_5;
  4824. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4825. if (unlikely(size != 2)) {
  4826. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4827. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4828. __PYX_ERR(0, 198, __pyx_L1_error)
  4829. }
  4830. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4831. if (likely(PyTuple_CheckExact(sequence))) {
  4832. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  4833. __Pyx_INCREF(__pyx_t_7);
  4834. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  4835. __Pyx_INCREF(__pyx_t_9);
  4836. } else {
  4837. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4838. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4839. __Pyx_XGOTREF(__pyx_t_7);
  4840. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4841. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4842. __Pyx_XGOTREF(__pyx_t_9);
  4843. }
  4844. #else
  4845. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4846. __Pyx_GOTREF(__pyx_t_7);
  4847. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4848. __Pyx_GOTREF(__pyx_t_9);
  4849. #endif
  4850. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4851. } else {
  4852. Py_ssize_t index = -1;
  4853. __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 198, __pyx_L1_error)
  4854. __Pyx_GOTREF(__pyx_t_10);
  4855. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4856. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  4857. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
  4858. __Pyx_GOTREF(__pyx_t_7);
  4859. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
  4860. __Pyx_GOTREF(__pyx_t_9);
  4861. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4862. __pyx_t_8 = NULL;
  4863. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4864. goto __pyx_L9_unpacking_done;
  4865. __pyx_L8_unpacking_failed:;
  4866. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4867. __pyx_t_8 = NULL;
  4868. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4869. __PYX_ERR(0, 198, __pyx_L1_error)
  4870. __pyx_L9_unpacking_done:;
  4871. }
  4872. __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)
  4873. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4874. __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)
  4875. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4876. __pyx_cur_scope->__pyx_v_x = __pyx_t_11;
  4877. __pyx_cur_scope->__pyx_v_y = __pyx_t_12;
  4878. if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
  4879. PyObject* sequence = __pyx_t_6;
  4880. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4881. if (unlikely(size != 2)) {
  4882. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4883. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4884. __PYX_ERR(0, 198, __pyx_L1_error)
  4885. }
  4886. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4887. if (likely(PyTuple_CheckExact(sequence))) {
  4888. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  4889. __Pyx_INCREF(__pyx_t_9);
  4890. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  4891. __Pyx_INCREF(__pyx_t_7);
  4892. } else {
  4893. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4894. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4895. __Pyx_XGOTREF(__pyx_t_9);
  4896. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4897. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4898. __Pyx_XGOTREF(__pyx_t_7);
  4899. }
  4900. #else
  4901. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
  4902. __Pyx_GOTREF(__pyx_t_9);
  4903. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  4904. __Pyx_GOTREF(__pyx_t_7);
  4905. #endif
  4906. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4907. } else {
  4908. Py_ssize_t index = -1;
  4909. __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 198, __pyx_L1_error)
  4910. __Pyx_GOTREF(__pyx_t_10);
  4911. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4912. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  4913. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
  4914. __Pyx_GOTREF(__pyx_t_9);
  4915. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
  4916. __Pyx_GOTREF(__pyx_t_7);
  4917. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 198, __pyx_L1_error)
  4918. __pyx_t_8 = NULL;
  4919. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4920. goto __pyx_L11_unpacking_done;
  4921. __pyx_L10_unpacking_failed:;
  4922. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4923. __pyx_t_8 = NULL;
  4924. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4925. __PYX_ERR(0, 198, __pyx_L1_error)
  4926. __pyx_L11_unpacking_done:;
  4927. }
  4928. __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)
  4929. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4930. __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)
  4931. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4932. __pyx_cur_scope->__pyx_v_p = __pyx_t_12;
  4933. __pyx_cur_scope->__pyx_v_q = __pyx_t_11;
  4934. /* "fontTools/varLib/iup.py":197
  4935. *
  4936. * return all(
  4937. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4938. * for (x, y), (p, q) in zip(deltas, interp)
  4939. * )
  4940. */
  4941. __pyx_t_6 = NULL;
  4942. __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)
  4943. __Pyx_GOTREF(__pyx_t_5);
  4944. __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)
  4945. __Pyx_GOTREF(__pyx_t_7);
  4946. __pyx_t_13 = 1;
  4947. {
  4948. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_7};
  4949. __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));
  4950. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4951. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4952. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4953. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
  4954. __Pyx_GOTREF(__pyx_t_4);
  4955. }
  4956. __pyx_t_7 = __Pyx_PyNumber_Absolute(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
  4957. __Pyx_GOTREF(__pyx_t_7);
  4958. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4959. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 197, __pyx_L1_error) }
  4960. __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)
  4961. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4962. __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 197, __pyx_L1_error)
  4963. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4964. __pyx_t_15 = (!__pyx_t_14);
  4965. if (__pyx_t_15) {
  4966. /* "fontTools/varLib/iup.py":196
  4967. * deltas = deltas[i + 1 : j]
  4968. *
  4969. * return all( # <<<<<<<<<<<<<<
  4970. * abs(complex(x - p, y - q)) <= tolerance
  4971. * for (x, y), (p, q) in zip(deltas, interp)
  4972. */
  4973. __Pyx_XDECREF(__pyx_r);
  4974. /* "fontTools/varLib/iup.py":197
  4975. *
  4976. * return all(
  4977. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4978. * for (x, y), (p, q) in zip(deltas, interp)
  4979. * )
  4980. */
  4981. __Pyx_INCREF(Py_False);
  4982. __pyx_r = Py_False;
  4983. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4984. goto __pyx_L0;
  4985. }
  4986. /* "fontTools/varLib/iup.py":198
  4987. * return all(
  4988. * abs(complex(x - p, y - q)) <= tolerance
  4989. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  4990. * )
  4991. *
  4992. */
  4993. }
  4994. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4995. /*else*/ {
  4996. /* "fontTools/varLib/iup.py":196
  4997. * deltas = deltas[i + 1 : j]
  4998. *
  4999. * return all( # <<<<<<<<<<<<<<
  5000. * abs(complex(x - p, y - q)) <= tolerance
  5001. * for (x, y), (p, q) in zip(deltas, interp)
  5002. */
  5003. __Pyx_XDECREF(__pyx_r);
  5004. /* "fontTools/varLib/iup.py":197
  5005. *
  5006. * return all(
  5007. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5008. * for (x, y), (p, q) in zip(deltas, interp)
  5009. * )
  5010. */
  5011. __Pyx_INCREF(Py_True);
  5012. __pyx_r = Py_True;
  5013. goto __pyx_L0;
  5014. }
  5015. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  5016. /* function exit code */
  5017. goto __pyx_L0;
  5018. __pyx_L1_error:;
  5019. __Pyx_XDECREF(__pyx_t_1);
  5020. __Pyx_XDECREF(__pyx_t_4);
  5021. __Pyx_XDECREF(__pyx_t_5);
  5022. __Pyx_XDECREF(__pyx_t_6);
  5023. __Pyx_XDECREF(__pyx_t_7);
  5024. __Pyx_XDECREF(__pyx_t_9);
  5025. __Pyx_XDECREF(__pyx_t_10);
  5026. if (__Pyx_PyErr_Occurred()) {
  5027. __Pyx_Generator_Replace_StopIteration(0);
  5028. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5029. }
  5030. __pyx_L0:;
  5031. __Pyx_XGIVEREF(__pyx_r);
  5032. #if !CYTHON_USE_EXC_INFO_STACK
  5033. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  5034. #endif
  5035. __pyx_generator->resume_label = -1;
  5036. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  5037. __Pyx_RefNannyFinishContext();
  5038. return __pyx_r;
  5039. }
  5040. /* "fontTools/varLib/iup.py":169
  5041. *
  5042. *
  5043. * @cython.cfunc # <<<<<<<<<<<<<<
  5044. * @cython.inline
  5045. * @cython.locals(
  5046. */
  5047. 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) {
  5048. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_cur_scope;
  5049. PyObject *__pyx_v_interp = NULL;
  5050. PyObject *__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator = 0;
  5051. int __pyx_r;
  5052. __Pyx_RefNannyDeclarations
  5053. int __pyx_t_1;
  5054. PyObject *__pyx_t_2 = NULL;
  5055. PyObject *__pyx_t_3 = NULL;
  5056. PyObject *__pyx_t_4 = NULL;
  5057. PyObject *__pyx_t_5 = NULL;
  5058. PyObject *__pyx_t_6 = NULL;
  5059. PyObject *__pyx_t_7 = NULL;
  5060. size_t __pyx_t_8;
  5061. int __pyx_t_9;
  5062. int __pyx_lineno = 0;
  5063. const char *__pyx_filename = NULL;
  5064. int __pyx_clineno = 0;
  5065. __Pyx_RefNannySetupContext("can_iup_in_between", 0);
  5066. __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);
  5067. if (unlikely(!__pyx_cur_scope)) {
  5068. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)Py_None);
  5069. __Pyx_INCREF(Py_None);
  5070. __PYX_ERR(0, 169, __pyx_L1_error)
  5071. } else {
  5072. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  5073. }
  5074. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  5075. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  5076. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  5077. __Pyx_INCREF(__pyx_v_deltas);
  5078. /* "fontTools/varLib/iup.py":192
  5079. * provided error tolerance."""
  5080. *
  5081. * assert j - i >= 2 # <<<<<<<<<<<<<<
  5082. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5083. * deltas = deltas[i + 1 : j]
  5084. */
  5085. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5086. if (unlikely(__pyx_assertions_enabled())) {
  5087. __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) >= 2);
  5088. if (unlikely(!__pyx_t_1)) {
  5089. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  5090. __PYX_ERR(0, 192, __pyx_L1_error)
  5091. }
  5092. }
  5093. #else
  5094. if ((1)); else __PYX_ERR(0, 192, __pyx_L1_error)
  5095. #endif
  5096. /* "fontTools/varLib/iup.py":193
  5097. *
  5098. * assert j - i >= 2
  5099. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j]) # <<<<<<<<<<<<<<
  5100. * deltas = deltas[i + 1 : j]
  5101. *
  5102. */
  5103. __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)
  5104. __Pyx_GOTREF(__pyx_t_2);
  5105. __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)
  5106. __Pyx_GOTREF(__pyx_t_3);
  5107. __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)
  5108. __Pyx_GOTREF(__pyx_t_4);
  5109. __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)
  5110. __Pyx_GOTREF(__pyx_t_5);
  5111. __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)
  5112. __Pyx_GOTREF(__pyx_t_6);
  5113. __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)
  5114. __Pyx_GOTREF(__pyx_t_7);
  5115. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5116. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5117. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5118. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5119. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5120. __pyx_v_interp = __pyx_t_7;
  5121. __pyx_t_7 = 0;
  5122. /* "fontTools/varLib/iup.py":194
  5123. * assert j - i >= 2
  5124. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5125. * deltas = deltas[i + 1 : j] # <<<<<<<<<<<<<<
  5126. *
  5127. * return all(
  5128. */
  5129. __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)
  5130. __Pyx_GOTREF(__pyx_t_7);
  5131. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_7);
  5132. __pyx_t_7 = 0;
  5133. /* "fontTools/varLib/iup.py":198
  5134. * return all(
  5135. * abs(complex(x - p, y - q)) <= tolerance
  5136. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  5137. * )
  5138. *
  5139. */
  5140. __pyx_t_6 = NULL;
  5141. __pyx_t_8 = 1;
  5142. {
  5143. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_deltas, __pyx_v_interp};
  5144. __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));
  5145. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  5146. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
  5147. __Pyx_GOTREF(__pyx_t_7);
  5148. }
  5149. /* "fontTools/varLib/iup.py":197
  5150. *
  5151. * return all(
  5152. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5153. * for (x, y), (p, q) in zip(deltas, interp)
  5154. * )
  5155. */
  5156. __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)
  5157. __Pyx_GOTREF(__pyx_t_6);
  5158. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5159. __pyx_t_7 = __Pyx_Generator_GetInlinedResult(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
  5160. __Pyx_GOTREF(__pyx_t_7);
  5161. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5162. __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)
  5163. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5164. __pyx_r = __pyx_t_9;
  5165. goto __pyx_L0;
  5166. /* "fontTools/varLib/iup.py":169
  5167. *
  5168. *
  5169. * @cython.cfunc # <<<<<<<<<<<<<<
  5170. * @cython.inline
  5171. * @cython.locals(
  5172. */
  5173. /* function exit code */
  5174. __pyx_L1_error:;
  5175. __Pyx_XDECREF(__pyx_t_2);
  5176. __Pyx_XDECREF(__pyx_t_3);
  5177. __Pyx_XDECREF(__pyx_t_4);
  5178. __Pyx_XDECREF(__pyx_t_5);
  5179. __Pyx_XDECREF(__pyx_t_6);
  5180. __Pyx_XDECREF(__pyx_t_7);
  5181. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5182. __pyx_r = -1;
  5183. __pyx_L0:;
  5184. __Pyx_XDECREF(__pyx_v_interp);
  5185. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator);
  5186. __Pyx_XDECREF(__pyx_v_deltas);
  5187. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  5188. __Pyx_RefNannyFinishContext();
  5189. return __pyx_r;
  5190. }
  5191. /* "fontTools/varLib/iup.py":202
  5192. *
  5193. *
  5194. * @cython.locals( # <<<<<<<<<<<<<<
  5195. * cj=cython.double,
  5196. * dj=cython.double,
  5197. */
  5198. /* Python wrapper */
  5199. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set(PyObject *__pyx_self,
  5200. #if CYTHON_METH_FASTCALL
  5201. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5202. #else
  5203. PyObject *__pyx_args, PyObject *__pyx_kwds
  5204. #endif
  5205. ); /*proto*/
  5206. 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`.");
  5207. 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};
  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. ) {
  5215. PyObject *__pyx_v_deltas = 0;
  5216. PyObject *__pyx_v_coords = 0;
  5217. PyObject *__pyx_v_tolerance = 0;
  5218. #if !CYTHON_METH_FASTCALL
  5219. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5220. #endif
  5221. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5222. PyObject* values[3] = {0,0,0};
  5223. int __pyx_lineno = 0;
  5224. const char *__pyx_filename = NULL;
  5225. int __pyx_clineno = 0;
  5226. PyObject *__pyx_r = 0;
  5227. __Pyx_RefNannyDeclarations
  5228. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set (wrapper)", 0);
  5229. #if !CYTHON_METH_FASTCALL
  5230. #if CYTHON_ASSUME_SAFE_SIZE
  5231. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5232. #else
  5233. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5234. #endif
  5235. #endif
  5236. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5237. {
  5238. 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};
  5239. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5240. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 202, __pyx_L3_error)
  5241. if (__pyx_kwds_len > 0) {
  5242. switch (__pyx_nargs) {
  5243. case 3:
  5244. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5245. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 202, __pyx_L3_error)
  5246. CYTHON_FALLTHROUGH;
  5247. case 2:
  5248. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5249. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error)
  5250. CYTHON_FALLTHROUGH;
  5251. case 1:
  5252. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5253. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error)
  5254. CYTHON_FALLTHROUGH;
  5255. case 0: break;
  5256. default: goto __pyx_L5_argtuple_error;
  5257. }
  5258. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5259. 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)
  5260. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
  5261. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  5262. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, i); __PYX_ERR(0, 202, __pyx_L3_error) }
  5263. }
  5264. } else {
  5265. switch (__pyx_nargs) {
  5266. case 3:
  5267. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5268. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 202, __pyx_L3_error)
  5269. CYTHON_FALLTHROUGH;
  5270. case 2:
  5271. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5272. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error)
  5273. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5274. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error)
  5275. break;
  5276. default: goto __pyx_L5_argtuple_error;
  5277. }
  5278. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_int_0)));
  5279. }
  5280. __pyx_v_deltas = values[0];
  5281. __pyx_v_coords = values[1];
  5282. __pyx_v_tolerance = values[2];
  5283. }
  5284. goto __pyx_L6_skip;
  5285. __pyx_L5_argtuple_error:;
  5286. __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 202, __pyx_L3_error)
  5287. __pyx_L6_skip:;
  5288. goto __pyx_L4_argument_unpacking_done;
  5289. __pyx_L3_error:;
  5290. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5291. Py_XDECREF(values[__pyx_temp]);
  5292. }
  5293. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5294. __Pyx_RefNannyFinishContext();
  5295. return NULL;
  5296. __pyx_L4_argument_unpacking_done:;
  5297. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  5298. /* function exit code */
  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_RefNannyFinishContext();
  5303. return __pyx_r;
  5304. }
  5305. 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) {
  5306. double __pyx_v_cj;
  5307. double __pyx_v_dj;
  5308. double __pyx_v_lcj;
  5309. double __pyx_v_ldj;
  5310. double __pyx_v_ncj;
  5311. double __pyx_v_ndj;
  5312. int __pyx_v_force;
  5313. PyObject *__pyx_v_forced = 0;
  5314. PyObject *__pyx_v_n = NULL;
  5315. PyObject *__pyx_v_i = NULL;
  5316. PyObject *__pyx_v_ld = NULL;
  5317. PyObject *__pyx_v_lc = NULL;
  5318. PyObject *__pyx_v_d = NULL;
  5319. PyObject *__pyx_v_c = NULL;
  5320. PyObject *__pyx_v_nd = NULL;
  5321. PyObject *__pyx_v_nc = NULL;
  5322. long __pyx_v_j;
  5323. double __pyx_v_c1;
  5324. double __pyx_v_c2;
  5325. double __pyx_v_d1;
  5326. double __pyx_v_d2;
  5327. PyObject *__pyx_r = NULL;
  5328. __Pyx_RefNannyDeclarations
  5329. Py_ssize_t __pyx_t_1;
  5330. Py_ssize_t __pyx_t_2;
  5331. int __pyx_t_3;
  5332. PyObject *__pyx_t_4 = NULL;
  5333. PyObject *__pyx_t_5 = NULL;
  5334. PyObject *__pyx_t_6 = NULL;
  5335. size_t __pyx_t_7;
  5336. PyObject *(*__pyx_t_8)(PyObject *);
  5337. PyObject *__pyx_t_9 = NULL;
  5338. long __pyx_t_10;
  5339. double __pyx_t_11;
  5340. double __pyx_t_12;
  5341. int __pyx_t_13;
  5342. double __pyx_t_14;
  5343. PyObject *__pyx_t_15 = NULL;
  5344. PyObject *__pyx_t_16 = NULL;
  5345. PyObject *__pyx_t_17 = NULL;
  5346. int __pyx_t_18;
  5347. int __pyx_lineno = 0;
  5348. const char *__pyx_filename = NULL;
  5349. int __pyx_clineno = 0;
  5350. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set", 0);
  5351. /* "fontTools/varLib/iup.py":222
  5352. * that IUP can generate delta for that point, given `coords` and `deltas`.
  5353. * """
  5354. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  5355. *
  5356. * n = len(deltas)
  5357. */
  5358. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5359. if (unlikely(__pyx_assertions_enabled())) {
  5360. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error)
  5361. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 222, __pyx_L1_error)
  5362. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  5363. if (unlikely(!__pyx_t_3)) {
  5364. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  5365. __PYX_ERR(0, 222, __pyx_L1_error)
  5366. }
  5367. }
  5368. #else
  5369. if ((1)); else __PYX_ERR(0, 222, __pyx_L1_error)
  5370. #endif
  5371. /* "fontTools/varLib/iup.py":224
  5372. * assert len(deltas) == len(coords)
  5373. *
  5374. * n = len(deltas) # <<<<<<<<<<<<<<
  5375. * forced = set()
  5376. * # Track "last" and "next" points on the contour as we sweep.
  5377. */
  5378. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
  5379. __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
  5380. __Pyx_GOTREF(__pyx_t_4);
  5381. __pyx_v_n = __pyx_t_4;
  5382. __pyx_t_4 = 0;
  5383. /* "fontTools/varLib/iup.py":225
  5384. *
  5385. * n = len(deltas)
  5386. * forced = set() # <<<<<<<<<<<<<<
  5387. * # Track "last" and "next" points on the contour as we sweep.
  5388. * for i in range(len(deltas) - 1, -1, -1):
  5389. */
  5390. __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
  5391. __Pyx_GOTREF(__pyx_t_4);
  5392. __pyx_v_forced = ((PyObject*)__pyx_t_4);
  5393. __pyx_t_4 = 0;
  5394. /* "fontTools/varLib/iup.py":227
  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. * ld, lc = deltas[i - 1], coords[i - 1]
  5399. * d, c = deltas[i], coords[i]
  5400. */
  5401. __pyx_t_5 = NULL;
  5402. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 227, __pyx_L1_error)
  5403. __pyx_t_6 = PyLong_FromSsize_t((__pyx_t_2 - 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
  5404. __Pyx_GOTREF(__pyx_t_6);
  5405. __pyx_t_7 = 1;
  5406. {
  5407. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_6, __pyx_mstate_global->__pyx_int_neg_1, __pyx_mstate_global->__pyx_int_neg_1};
  5408. __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));
  5409. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  5410. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5411. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
  5412. __Pyx_GOTREF(__pyx_t_4);
  5413. }
  5414. __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
  5415. __Pyx_GOTREF(__pyx_t_6);
  5416. __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)
  5417. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5418. for (;;) {
  5419. {
  5420. __pyx_t_4 = __pyx_t_8(__pyx_t_6);
  5421. if (unlikely(!__pyx_t_4)) {
  5422. PyObject* exc_type = PyErr_Occurred();
  5423. if (exc_type) {
  5424. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 227, __pyx_L1_error)
  5425. PyErr_Clear();
  5426. }
  5427. break;
  5428. }
  5429. }
  5430. __Pyx_GOTREF(__pyx_t_4);
  5431. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
  5432. __pyx_t_4 = 0;
  5433. /* "fontTools/varLib/iup.py":228
  5434. * # Track "last" and "next" points on the contour as we sweep.
  5435. * for i in range(len(deltas) - 1, -1, -1):
  5436. * ld, lc = deltas[i - 1], coords[i - 1] # <<<<<<<<<<<<<<
  5437. * d, c = deltas[i], coords[i]
  5438. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5439. */
  5440. __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)
  5441. __Pyx_GOTREF(__pyx_t_4);
  5442. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error)
  5443. __Pyx_GOTREF(__pyx_t_5);
  5444. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5445. __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)
  5446. __Pyx_GOTREF(__pyx_t_4);
  5447. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 228, __pyx_L1_error)
  5448. __Pyx_GOTREF(__pyx_t_9);
  5449. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5450. __Pyx_XDECREF_SET(__pyx_v_ld, __pyx_t_5);
  5451. __pyx_t_5 = 0;
  5452. __Pyx_XDECREF_SET(__pyx_v_lc, __pyx_t_9);
  5453. __pyx_t_9 = 0;
  5454. /* "fontTools/varLib/iup.py":229
  5455. * for i in range(len(deltas) - 1, -1, -1):
  5456. * ld, lc = deltas[i - 1], coords[i - 1]
  5457. * d, c = deltas[i], coords[i] # <<<<<<<<<<<<<<
  5458. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5459. *
  5460. */
  5461. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 229, __pyx_L1_error)
  5462. __Pyx_GOTREF(__pyx_t_9);
  5463. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  5464. __Pyx_GOTREF(__pyx_t_5);
  5465. __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_9);
  5466. __pyx_t_9 = 0;
  5467. __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5);
  5468. __pyx_t_5 = 0;
  5469. /* "fontTools/varLib/iup.py":230
  5470. * ld, lc = deltas[i - 1], coords[i - 1]
  5471. * d, c = deltas[i], coords[i]
  5472. * nd, nc = deltas[i - n + 1], coords[i - n + 1] # <<<<<<<<<<<<<<
  5473. *
  5474. * for j in (0, 1): # For X and for Y
  5475. */
  5476. __pyx_t_5 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5477. __Pyx_GOTREF(__pyx_t_5);
  5478. __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)
  5479. __Pyx_GOTREF(__pyx_t_9);
  5480. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5481. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5482. __Pyx_GOTREF(__pyx_t_5);
  5483. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5484. __pyx_t_9 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 230, __pyx_L1_error)
  5485. __Pyx_GOTREF(__pyx_t_9);
  5486. __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)
  5487. __Pyx_GOTREF(__pyx_t_4);
  5488. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5489. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 230, __pyx_L1_error)
  5490. __Pyx_GOTREF(__pyx_t_9);
  5491. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5492. __Pyx_XDECREF_SET(__pyx_v_nd, __pyx_t_5);
  5493. __pyx_t_5 = 0;
  5494. __Pyx_XDECREF_SET(__pyx_v_nc, __pyx_t_9);
  5495. __pyx_t_9 = 0;
  5496. /* "fontTools/varLib/iup.py":232
  5497. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5498. *
  5499. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  5500. * cj = c[j]
  5501. * dj = d[j]
  5502. */
  5503. __pyx_t_9 = __pyx_mstate_global->__pyx_tuple[0]; __Pyx_INCREF(__pyx_t_9);
  5504. __pyx_t_2 = 0;
  5505. for (;;) {
  5506. if (__pyx_t_2 >= 2) break;
  5507. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5508. __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2));
  5509. #else
  5510. __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_2);
  5511. #endif
  5512. ++__pyx_t_2;
  5513. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
  5514. __Pyx_GOTREF(__pyx_t_5);
  5515. __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)
  5516. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5517. __pyx_v_j = __pyx_t_10;
  5518. /* "fontTools/varLib/iup.py":233
  5519. *
  5520. * for j in (0, 1): # For X and for Y
  5521. * cj = c[j] # <<<<<<<<<<<<<<
  5522. * dj = d[j]
  5523. * lcj = lc[j]
  5524. */
  5525. __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)
  5526. __Pyx_GOTREF(__pyx_t_5);
  5527. __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)
  5528. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5529. __pyx_v_cj = __pyx_t_11;
  5530. /* "fontTools/varLib/iup.py":234
  5531. * for j in (0, 1): # For X and for Y
  5532. * cj = c[j]
  5533. * dj = d[j] # <<<<<<<<<<<<<<
  5534. * lcj = lc[j]
  5535. * ldj = ld[j]
  5536. */
  5537. __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)
  5538. __Pyx_GOTREF(__pyx_t_5);
  5539. __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)
  5540. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5541. __pyx_v_dj = __pyx_t_11;
  5542. /* "fontTools/varLib/iup.py":235
  5543. * cj = c[j]
  5544. * dj = d[j]
  5545. * lcj = lc[j] # <<<<<<<<<<<<<<
  5546. * ldj = ld[j]
  5547. * ncj = nc[j]
  5548. */
  5549. __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)
  5550. __Pyx_GOTREF(__pyx_t_5);
  5551. __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)
  5552. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5553. __pyx_v_lcj = __pyx_t_11;
  5554. /* "fontTools/varLib/iup.py":236
  5555. * dj = d[j]
  5556. * lcj = lc[j]
  5557. * ldj = ld[j] # <<<<<<<<<<<<<<
  5558. * ncj = nc[j]
  5559. * ndj = nd[j]
  5560. */
  5561. __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)
  5562. __Pyx_GOTREF(__pyx_t_5);
  5563. __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)
  5564. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5565. __pyx_v_ldj = __pyx_t_11;
  5566. /* "fontTools/varLib/iup.py":237
  5567. * lcj = lc[j]
  5568. * ldj = ld[j]
  5569. * ncj = nc[j] # <<<<<<<<<<<<<<
  5570. * ndj = nd[j]
  5571. *
  5572. */
  5573. __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)
  5574. __Pyx_GOTREF(__pyx_t_5);
  5575. __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)
  5576. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5577. __pyx_v_ncj = __pyx_t_11;
  5578. /* "fontTools/varLib/iup.py":238
  5579. * ldj = ld[j]
  5580. * ncj = nc[j]
  5581. * ndj = nd[j] # <<<<<<<<<<<<<<
  5582. *
  5583. * if lcj <= ncj:
  5584. */
  5585. __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)
  5586. __Pyx_GOTREF(__pyx_t_5);
  5587. __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)
  5588. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5589. __pyx_v_ndj = __pyx_t_11;
  5590. /* "fontTools/varLib/iup.py":240
  5591. * ndj = nd[j]
  5592. *
  5593. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5594. * c1, c2 = lcj, ncj
  5595. * d1, d2 = ldj, ndj
  5596. */
  5597. __pyx_t_3 = (__pyx_v_lcj <= __pyx_v_ncj);
  5598. if (__pyx_t_3) {
  5599. /* "fontTools/varLib/iup.py":241
  5600. *
  5601. * if lcj <= ncj:
  5602. * c1, c2 = lcj, ncj # <<<<<<<<<<<<<<
  5603. * d1, d2 = ldj, ndj
  5604. * else:
  5605. */
  5606. __pyx_t_11 = __pyx_v_lcj;
  5607. __pyx_t_12 = __pyx_v_ncj;
  5608. __pyx_v_c1 = __pyx_t_11;
  5609. __pyx_v_c2 = __pyx_t_12;
  5610. /* "fontTools/varLib/iup.py":242
  5611. * if lcj <= ncj:
  5612. * c1, c2 = lcj, ncj
  5613. * d1, d2 = ldj, ndj # <<<<<<<<<<<<<<
  5614. * else:
  5615. * c1, c2 = ncj, lcj
  5616. */
  5617. __pyx_t_12 = __pyx_v_ldj;
  5618. __pyx_t_11 = __pyx_v_ndj;
  5619. __pyx_v_d1 = __pyx_t_12;
  5620. __pyx_v_d2 = __pyx_t_11;
  5621. /* "fontTools/varLib/iup.py":240
  5622. * ndj = nd[j]
  5623. *
  5624. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5625. * c1, c2 = lcj, ncj
  5626. * d1, d2 = ldj, ndj
  5627. */
  5628. goto __pyx_L7;
  5629. }
  5630. /* "fontTools/varLib/iup.py":244
  5631. * d1, d2 = ldj, ndj
  5632. * else:
  5633. * c1, c2 = ncj, lcj # <<<<<<<<<<<<<<
  5634. * d1, d2 = ndj, ldj
  5635. *
  5636. */
  5637. /*else*/ {
  5638. __pyx_t_11 = __pyx_v_ncj;
  5639. __pyx_t_12 = __pyx_v_lcj;
  5640. __pyx_v_c1 = __pyx_t_11;
  5641. __pyx_v_c2 = __pyx_t_12;
  5642. /* "fontTools/varLib/iup.py":245
  5643. * else:
  5644. * c1, c2 = ncj, lcj
  5645. * d1, d2 = ndj, ldj # <<<<<<<<<<<<<<
  5646. *
  5647. * force = False
  5648. */
  5649. __pyx_t_12 = __pyx_v_ndj;
  5650. __pyx_t_11 = __pyx_v_ldj;
  5651. __pyx_v_d1 = __pyx_t_12;
  5652. __pyx_v_d2 = __pyx_t_11;
  5653. }
  5654. __pyx_L7:;
  5655. /* "fontTools/varLib/iup.py":247
  5656. * d1, d2 = ndj, ldj
  5657. *
  5658. * force = False # <<<<<<<<<<<<<<
  5659. *
  5660. * # If the two coordinates are the same, then the interpolation
  5661. */
  5662. __pyx_v_force = 0;
  5663. /* "fontTools/varLib/iup.py":254
  5664. * #
  5665. * # This test has to be before the next one.
  5666. * if c1 == c2: # <<<<<<<<<<<<<<
  5667. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  5668. * force = True
  5669. */
  5670. __pyx_t_3 = (__pyx_v_c1 == __pyx_v_c2);
  5671. if (__pyx_t_3) {
  5672. /* "fontTools/varLib/iup.py":255
  5673. * # This test has to be before the next one.
  5674. * if c1 == c2:
  5675. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  5676. * force = True
  5677. *
  5678. */
  5679. __pyx_t_11 = fabs((__pyx_v_d1 - __pyx_v_d2));
  5680. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
  5681. __Pyx_GOTREF(__pyx_t_5);
  5682. __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)
  5683. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5684. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 255, __pyx_L1_error)
  5685. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5686. if (__pyx_t_13) {
  5687. } else {
  5688. __pyx_t_3 = __pyx_t_13;
  5689. goto __pyx_L10_bool_binop_done;
  5690. }
  5691. __pyx_t_11 = fabs(__pyx_v_dj);
  5692. __pyx_t_4 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
  5693. __Pyx_GOTREF(__pyx_t_4);
  5694. __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)
  5695. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5696. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 255, __pyx_L1_error)
  5697. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5698. __pyx_t_3 = __pyx_t_13;
  5699. __pyx_L10_bool_binop_done:;
  5700. if (__pyx_t_3) {
  5701. /* "fontTools/varLib/iup.py":256
  5702. * if c1 == c2:
  5703. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  5704. * force = True # <<<<<<<<<<<<<<
  5705. *
  5706. * # If coordinate for current point is between coordinate of adjacent
  5707. */
  5708. __pyx_v_force = 1;
  5709. /* "fontTools/varLib/iup.py":255
  5710. * # This test has to be before the next one.
  5711. * if c1 == c2:
  5712. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  5713. * force = True
  5714. *
  5715. */
  5716. }
  5717. /* "fontTools/varLib/iup.py":254
  5718. * #
  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. goto __pyx_L8;
  5725. }
  5726. /* "fontTools/varLib/iup.py":263
  5727. * # allowance), then there is no way that current point can be IUP-ed.
  5728. * # Mark it forced.
  5729. * elif c1 <= cj <= c2: # and c1 != c2 # <<<<<<<<<<<<<<
  5730. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  5731. * force = True
  5732. */
  5733. __pyx_t_3 = (__pyx_v_c1 <= __pyx_v_cj);
  5734. if (__pyx_t_3) {
  5735. __pyx_t_3 = (__pyx_v_cj <= __pyx_v_c2);
  5736. }
  5737. if (__pyx_t_3) {
  5738. /* "fontTools/varLib/iup.py":264
  5739. * # Mark it forced.
  5740. * elif c1 <= cj <= c2: # and c1 != c2
  5741. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance): # <<<<<<<<<<<<<<
  5742. * force = True
  5743. *
  5744. */
  5745. __pyx_t_11 = __pyx_v_d2;
  5746. __pyx_t_12 = __pyx_v_d1;
  5747. __pyx_t_3 = (__pyx_t_11 < __pyx_t_12);
  5748. if (__pyx_t_3) {
  5749. __pyx_t_14 = __pyx_t_11;
  5750. } else {
  5751. __pyx_t_14 = __pyx_t_12;
  5752. }
  5753. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
  5754. __Pyx_GOTREF(__pyx_t_5);
  5755. __pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
  5756. __Pyx_GOTREF(__pyx_t_4);
  5757. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5758. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
  5759. __Pyx_GOTREF(__pyx_t_5);
  5760. __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)
  5761. if (__Pyx_PyObject_IsTrue(__pyx_t_15)) {
  5762. __Pyx_DECREF(__pyx_t_15);
  5763. __pyx_t_14 = __pyx_v_d2;
  5764. __pyx_t_11 = __pyx_v_d1;
  5765. __pyx_t_3 = (__pyx_t_14 > __pyx_t_11);
  5766. if (__pyx_t_3) {
  5767. __pyx_t_12 = __pyx_t_14;
  5768. } else {
  5769. __pyx_t_12 = __pyx_t_11;
  5770. }
  5771. __pyx_t_16 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 264, __pyx_L1_error)
  5772. __Pyx_GOTREF(__pyx_t_16);
  5773. __pyx_t_17 = PyNumber_Add(__pyx_t_16, __pyx_v_tolerance); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 264, __pyx_L1_error)
  5774. __Pyx_GOTREF(__pyx_t_17);
  5775. __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  5776. __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)
  5777. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  5778. }
  5779. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5780. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5781. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 264, __pyx_L1_error)
  5782. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5783. __pyx_t_13 = (!__pyx_t_3);
  5784. if (__pyx_t_13) {
  5785. /* "fontTools/varLib/iup.py":265
  5786. * elif c1 <= cj <= c2: # and c1 != c2
  5787. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  5788. * force = True # <<<<<<<<<<<<<<
  5789. *
  5790. * # Otherwise, the delta should either match the closest, or have the
  5791. */
  5792. __pyx_v_force = 1;
  5793. /* "fontTools/varLib/iup.py":264
  5794. * # Mark it forced.
  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. */
  5800. }
  5801. /* "fontTools/varLib/iup.py":263
  5802. * # allowance), then there is no way that current point can be IUP-ed.
  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. goto __pyx_L8;
  5809. }
  5810. /* "fontTools/varLib/iup.py":270
  5811. * # same sign as the interpolation of the two deltas.
  5812. * else: # cj < c1 or c2 < cj
  5813. * if d1 != d2: # <<<<<<<<<<<<<<
  5814. * if cj < c1:
  5815. * if (
  5816. */
  5817. /*else*/ {
  5818. __pyx_t_13 = (__pyx_v_d1 != __pyx_v_d2);
  5819. if (__pyx_t_13) {
  5820. /* "fontTools/varLib/iup.py":271
  5821. * else: # cj < c1 or c2 < cj
  5822. * if d1 != d2:
  5823. * if cj < c1: # <<<<<<<<<<<<<<
  5824. * if (
  5825. * abs(dj) > tolerance
  5826. */
  5827. __pyx_t_13 = (__pyx_v_cj < __pyx_v_c1);
  5828. if (__pyx_t_13) {
  5829. /* "fontTools/varLib/iup.py":273
  5830. * if cj < c1:
  5831. * if (
  5832. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  5833. * and abs(dj - d1) > tolerance
  5834. * and ((dj - tolerance < d1) != (d1 < d2))
  5835. */
  5836. __pyx_t_12 = fabs(__pyx_v_dj);
  5837. __pyx_t_15 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 273, __pyx_L1_error)
  5838. __Pyx_GOTREF(__pyx_t_15);
  5839. __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)
  5840. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5841. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 273, __pyx_L1_error)
  5842. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5843. if (__pyx_t_3) {
  5844. } else {
  5845. __pyx_t_13 = __pyx_t_3;
  5846. goto __pyx_L16_bool_binop_done;
  5847. }
  5848. /* "fontTools/varLib/iup.py":274
  5849. * if (
  5850. * abs(dj) > tolerance
  5851. * and abs(dj - d1) > tolerance # <<<<<<<<<<<<<<
  5852. * and ((dj - tolerance < d1) != (d1 < d2))
  5853. * ):
  5854. */
  5855. __pyx_t_12 = fabs((__pyx_v_dj - __pyx_v_d1));
  5856. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error)
  5857. __Pyx_GOTREF(__pyx_t_5);
  5858. __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)
  5859. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5860. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 274, __pyx_L1_error)
  5861. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5862. if (__pyx_t_3) {
  5863. } else {
  5864. __pyx_t_13 = __pyx_t_3;
  5865. goto __pyx_L16_bool_binop_done;
  5866. }
  5867. /* "fontTools/varLib/iup.py":275
  5868. * abs(dj) > tolerance
  5869. * and abs(dj - d1) > tolerance
  5870. * and ((dj - tolerance < d1) != (d1 < d2)) # <<<<<<<<<<<<<<
  5871. * ):
  5872. * force = True
  5873. */
  5874. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5875. __Pyx_GOTREF(__pyx_t_15);
  5876. __pyx_t_5 = PyNumber_Subtract(__pyx_t_15, __pyx_v_tolerance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  5877. __Pyx_GOTREF(__pyx_t_5);
  5878. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5879. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5880. __Pyx_GOTREF(__pyx_t_15);
  5881. __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)
  5882. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5883. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5884. __pyx_t_15 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 275, __pyx_L1_error)
  5885. __Pyx_GOTREF(__pyx_t_15);
  5886. __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)
  5887. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5888. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5889. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 275, __pyx_L1_error)
  5890. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5891. __pyx_t_13 = __pyx_t_3;
  5892. __pyx_L16_bool_binop_done:;
  5893. /* "fontTools/varLib/iup.py":272
  5894. * if d1 != d2:
  5895. * if cj < c1:
  5896. * if ( # <<<<<<<<<<<<<<
  5897. * abs(dj) > tolerance
  5898. * and abs(dj - d1) > tolerance
  5899. */
  5900. if (__pyx_t_13) {
  5901. /* "fontTools/varLib/iup.py":277
  5902. * and ((dj - tolerance < d1) != (d1 < d2))
  5903. * ):
  5904. * force = True # <<<<<<<<<<<<<<
  5905. * else: # c2 < cj
  5906. * if (
  5907. */
  5908. __pyx_v_force = 1;
  5909. /* "fontTools/varLib/iup.py":272
  5910. * if d1 != d2:
  5911. * if cj < c1:
  5912. * if ( # <<<<<<<<<<<<<<
  5913. * abs(dj) > tolerance
  5914. * and abs(dj - d1) > tolerance
  5915. */
  5916. }
  5917. /* "fontTools/varLib/iup.py":271
  5918. * else: # cj < c1 or c2 < cj
  5919. * if d1 != d2:
  5920. * if cj < c1: # <<<<<<<<<<<<<<
  5921. * if (
  5922. * abs(dj) > tolerance
  5923. */
  5924. goto __pyx_L14;
  5925. }
  5926. /* "fontTools/varLib/iup.py":279
  5927. * force = True
  5928. * else: # c2 < cj
  5929. * if ( # <<<<<<<<<<<<<<
  5930. * abs(dj) > tolerance
  5931. * and abs(dj - d2) > tolerance
  5932. */
  5933. /*else*/ {
  5934. /* "fontTools/varLib/iup.py":280
  5935. * else: # c2 < cj
  5936. * if (
  5937. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  5938. * and abs(dj - d2) > tolerance
  5939. * and ((d2 < dj + tolerance) != (d1 < d2))
  5940. */
  5941. __pyx_t_12 = fabs(__pyx_v_dj);
  5942. __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error)
  5943. __Pyx_GOTREF(__pyx_t_5);
  5944. __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)
  5945. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5946. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 280, __pyx_L1_error)
  5947. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5948. if (__pyx_t_3) {
  5949. } else {
  5950. __pyx_t_13 = __pyx_t_3;
  5951. goto __pyx_L20_bool_binop_done;
  5952. }
  5953. /* "fontTools/varLib/iup.py":281
  5954. * if (
  5955. * abs(dj) > tolerance
  5956. * and abs(dj - d2) > tolerance # <<<<<<<<<<<<<<
  5957. * and ((d2 < dj + tolerance) != (d1 < d2))
  5958. * ):
  5959. */
  5960. __pyx_t_12 = fabs((__pyx_v_dj - __pyx_v_d2));
  5961. __pyx_t_15 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 281, __pyx_L1_error)
  5962. __Pyx_GOTREF(__pyx_t_15);
  5963. __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)
  5964. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5965. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 281, __pyx_L1_error)
  5966. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5967. if (__pyx_t_3) {
  5968. } else {
  5969. __pyx_t_13 = __pyx_t_3;
  5970. goto __pyx_L20_bool_binop_done;
  5971. }
  5972. /* "fontTools/varLib/iup.py":282
  5973. * abs(dj) > tolerance
  5974. * and abs(dj - d2) > tolerance
  5975. * and ((d2 < dj + tolerance) != (d1 < d2)) # <<<<<<<<<<<<<<
  5976. * ):
  5977. * force = True
  5978. */
  5979. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_d2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
  5980. __Pyx_GOTREF(__pyx_t_5);
  5981. __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
  5982. __Pyx_GOTREF(__pyx_t_15);
  5983. __pyx_t_4 = PyNumber_Add(__pyx_t_15, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  5984. __Pyx_GOTREF(__pyx_t_4);
  5985. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5986. __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)
  5987. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5988. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5989. __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  5990. __Pyx_GOTREF(__pyx_t_4);
  5991. __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)
  5992. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5993. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5994. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 282, __pyx_L1_error)
  5995. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5996. __pyx_t_13 = __pyx_t_3;
  5997. __pyx_L20_bool_binop_done:;
  5998. /* "fontTools/varLib/iup.py":279
  5999. * force = True
  6000. * else: # c2 < cj
  6001. * if ( # <<<<<<<<<<<<<<
  6002. * abs(dj) > tolerance
  6003. * and abs(dj - d2) > tolerance
  6004. */
  6005. if (__pyx_t_13) {
  6006. /* "fontTools/varLib/iup.py":284
  6007. * and ((d2 < dj + tolerance) != (d1 < d2))
  6008. * ):
  6009. * force = True # <<<<<<<<<<<<<<
  6010. *
  6011. * if force:
  6012. */
  6013. __pyx_v_force = 1;
  6014. /* "fontTools/varLib/iup.py":279
  6015. * force = True
  6016. * else: # c2 < cj
  6017. * if ( # <<<<<<<<<<<<<<
  6018. * abs(dj) > tolerance
  6019. * and abs(dj - d2) > tolerance
  6020. */
  6021. }
  6022. }
  6023. __pyx_L14:;
  6024. /* "fontTools/varLib/iup.py":270
  6025. * # same sign as the interpolation of the two deltas.
  6026. * else: # cj < c1 or c2 < cj
  6027. * if d1 != d2: # <<<<<<<<<<<<<<
  6028. * if cj < c1:
  6029. * if (
  6030. */
  6031. }
  6032. }
  6033. __pyx_L8:;
  6034. /* "fontTools/varLib/iup.py":286
  6035. * force = True
  6036. *
  6037. * if force: # <<<<<<<<<<<<<<
  6038. * forced.add(i)
  6039. * break
  6040. */
  6041. __pyx_t_13 = (__pyx_v_force != 0);
  6042. if (__pyx_t_13) {
  6043. /* "fontTools/varLib/iup.py":287
  6044. *
  6045. * if force:
  6046. * forced.add(i) # <<<<<<<<<<<<<<
  6047. * break
  6048. *
  6049. */
  6050. __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)
  6051. /* "fontTools/varLib/iup.py":288
  6052. * if force:
  6053. * forced.add(i)
  6054. * break # <<<<<<<<<<<<<<
  6055. *
  6056. * return forced
  6057. */
  6058. goto __pyx_L6_break;
  6059. /* "fontTools/varLib/iup.py":286
  6060. * force = True
  6061. *
  6062. * if force: # <<<<<<<<<<<<<<
  6063. * forced.add(i)
  6064. * break
  6065. */
  6066. }
  6067. /* "fontTools/varLib/iup.py":232
  6068. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  6069. *
  6070. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  6071. * cj = c[j]
  6072. * dj = d[j]
  6073. */
  6074. }
  6075. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6076. goto __pyx_L24_for_end;
  6077. __pyx_L6_break:;
  6078. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6079. goto __pyx_L24_for_end;
  6080. __pyx_L24_for_end:;
  6081. /* "fontTools/varLib/iup.py":227
  6082. * forced = set()
  6083. * # Track "last" and "next" points on the contour as we sweep.
  6084. * for i in range(len(deltas) - 1, -1, -1): # <<<<<<<<<<<<<<
  6085. * ld, lc = deltas[i - 1], coords[i - 1]
  6086. * d, c = deltas[i], coords[i]
  6087. */
  6088. }
  6089. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6090. /* "fontTools/varLib/iup.py":290
  6091. * break
  6092. *
  6093. * return forced # <<<<<<<<<<<<<<
  6094. *
  6095. *
  6096. */
  6097. __Pyx_XDECREF(__pyx_r);
  6098. __Pyx_INCREF(__pyx_v_forced);
  6099. __pyx_r = __pyx_v_forced;
  6100. goto __pyx_L0;
  6101. /* "fontTools/varLib/iup.py":202
  6102. *
  6103. *
  6104. * @cython.locals( # <<<<<<<<<<<<<<
  6105. * cj=cython.double,
  6106. * dj=cython.double,
  6107. */
  6108. /* function exit code */
  6109. __pyx_L1_error:;
  6110. __Pyx_XDECREF(__pyx_t_4);
  6111. __Pyx_XDECREF(__pyx_t_5);
  6112. __Pyx_XDECREF(__pyx_t_6);
  6113. __Pyx_XDECREF(__pyx_t_9);
  6114. __Pyx_XDECREF(__pyx_t_15);
  6115. __Pyx_XDECREF(__pyx_t_16);
  6116. __Pyx_XDECREF(__pyx_t_17);
  6117. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6118. __pyx_r = NULL;
  6119. __pyx_L0:;
  6120. __Pyx_XDECREF(__pyx_v_forced);
  6121. __Pyx_XDECREF(__pyx_v_n);
  6122. __Pyx_XDECREF(__pyx_v_i);
  6123. __Pyx_XDECREF(__pyx_v_ld);
  6124. __Pyx_XDECREF(__pyx_v_lc);
  6125. __Pyx_XDECREF(__pyx_v_d);
  6126. __Pyx_XDECREF(__pyx_v_c);
  6127. __Pyx_XDECREF(__pyx_v_nd);
  6128. __Pyx_XDECREF(__pyx_v_nc);
  6129. __Pyx_XGIVEREF(__pyx_r);
  6130. __Pyx_RefNannyFinishContext();
  6131. return __pyx_r;
  6132. }
  6133. /* "fontTools/varLib/iup.py":293
  6134. *
  6135. *
  6136. * @cython.locals( # <<<<<<<<<<<<<<
  6137. * i=cython.int,
  6138. * j=cython.int,
  6139. */
  6140. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  6141. PyObject *__pyx_r = NULL;
  6142. __Pyx_RefNannyDeclarations
  6143. PyObject *__pyx_t_1 = NULL;
  6144. PyObject *__pyx_t_2 = NULL;
  6145. int __pyx_lineno = 0;
  6146. const char *__pyx_filename = NULL;
  6147. int __pyx_clineno = 0;
  6148. __Pyx_RefNannySetupContext("__defaults__", 0);
  6149. __Pyx_XDECREF(__pyx_r);
  6150. /* "fontTools/varLib/iup.py":306
  6151. * coords: _PointSegment,
  6152. * forced=set(),
  6153. * tolerance: Real = 0, # <<<<<<<<<<<<<<
  6154. * lookback: Integral = None,
  6155. * ):
  6156. */
  6157. __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
  6158. __Pyx_GOTREF(__pyx_t_1);
  6159. /* "fontTools/varLib/iup.py":293
  6160. *
  6161. *
  6162. * @cython.locals( # <<<<<<<<<<<<<<
  6163. * i=cython.int,
  6164. * j=cython.int,
  6165. */
  6166. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
  6167. __Pyx_GOTREF(__pyx_t_2);
  6168. __Pyx_INCREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  6169. __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  6170. 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);
  6171. __Pyx_GIVEREF(__pyx_t_1);
  6172. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6173. __Pyx_INCREF(Py_None);
  6174. __Pyx_GIVEREF(Py_None);
  6175. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6176. __pyx_t_1 = 0;
  6177. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  6178. __Pyx_GOTREF(__pyx_t_1);
  6179. __Pyx_GIVEREF(__pyx_t_2);
  6180. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6181. __Pyx_INCREF(Py_None);
  6182. __Pyx_GIVEREF(Py_None);
  6183. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None) != (0)) __PYX_ERR(0, 293, __pyx_L1_error);
  6184. __pyx_t_2 = 0;
  6185. __pyx_r = __pyx_t_1;
  6186. __pyx_t_1 = 0;
  6187. goto __pyx_L0;
  6188. /* function exit code */
  6189. __pyx_L1_error:;
  6190. __Pyx_XDECREF(__pyx_t_1);
  6191. __Pyx_XDECREF(__pyx_t_2);
  6192. __Pyx_AddTraceback("fontTools.varLib.iup.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6193. __pyx_r = NULL;
  6194. __pyx_L0:;
  6195. __Pyx_XGIVEREF(__pyx_r);
  6196. __Pyx_RefNannyFinishContext();
  6197. return __pyx_r;
  6198. }
  6199. /* Python wrapper */
  6200. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp(PyObject *__pyx_self,
  6201. #if CYTHON_METH_FASTCALL
  6202. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6203. #else
  6204. PyObject *__pyx_args, PyObject *__pyx_kwds
  6205. #endif
  6206. ); /*proto*/
  6207. 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.");
  6208. 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};
  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. ) {
  6216. PyObject *__pyx_v_deltas = 0;
  6217. PyObject *__pyx_v_coords = 0;
  6218. PyObject *__pyx_v_forced = 0;
  6219. double __pyx_v_tolerance;
  6220. PyObject *__pyx_v_lookback = 0;
  6221. #if !CYTHON_METH_FASTCALL
  6222. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6223. #endif
  6224. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6225. PyObject* values[5] = {0,0,0,0,0};
  6226. int __pyx_lineno = 0;
  6227. const char *__pyx_filename = NULL;
  6228. int __pyx_clineno = 0;
  6229. PyObject *__pyx_r = 0;
  6230. __Pyx_RefNannyDeclarations
  6231. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp (wrapper)", 0);
  6232. #if !CYTHON_METH_FASTCALL
  6233. #if CYTHON_ASSUME_SAFE_SIZE
  6234. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6235. #else
  6236. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6237. #endif
  6238. #endif
  6239. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6240. {
  6241. 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};
  6242. struct __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self);
  6243. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6244. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 293, __pyx_L3_error)
  6245. if (__pyx_kwds_len > 0) {
  6246. switch (__pyx_nargs) {
  6247. case 5:
  6248. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  6249. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 293, __pyx_L3_error)
  6250. CYTHON_FALLTHROUGH;
  6251. case 4:
  6252. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6253. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 293, __pyx_L3_error)
  6254. CYTHON_FALLTHROUGH;
  6255. case 3:
  6256. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6257. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 293, __pyx_L3_error)
  6258. CYTHON_FALLTHROUGH;
  6259. case 2:
  6260. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6261. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 293, __pyx_L3_error)
  6262. CYTHON_FALLTHROUGH;
  6263. case 1:
  6264. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6265. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 293, __pyx_L3_error)
  6266. CYTHON_FALLTHROUGH;
  6267. case 0: break;
  6268. default: goto __pyx_L5_argtuple_error;
  6269. }
  6270. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6271. 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)
  6272. if (!values[2]) values[2] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  6273. /* "fontTools/varLib/iup.py":307
  6274. * forced=set(),
  6275. * tolerance: Real = 0,
  6276. * lookback: Integral = None, # <<<<<<<<<<<<<<
  6277. * ):
  6278. * """Straightforward Dynamic-Programming. For each index i, find least-costly encoding of
  6279. */
  6280. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  6281. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  6282. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, i); __PYX_ERR(0, 293, __pyx_L3_error) }
  6283. }
  6284. } else {
  6285. switch (__pyx_nargs) {
  6286. case 5:
  6287. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  6288. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 293, __pyx_L3_error)
  6289. CYTHON_FALLTHROUGH;
  6290. case 4:
  6291. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6292. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 293, __pyx_L3_error)
  6293. CYTHON_FALLTHROUGH;
  6294. case 3:
  6295. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6296. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 293, __pyx_L3_error)
  6297. CYTHON_FALLTHROUGH;
  6298. case 2:
  6299. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6300. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 293, __pyx_L3_error)
  6301. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6302. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 293, __pyx_L3_error)
  6303. break;
  6304. default: goto __pyx_L5_argtuple_error;
  6305. }
  6306. if (!values[2]) values[2] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  6307. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  6308. }
  6309. __pyx_v_deltas = values[0];
  6310. __pyx_v_coords = values[1];
  6311. __pyx_v_forced = ((PyObject*)values[2]);
  6312. if (values[3]) {
  6313. __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error)
  6314. } else {
  6315. __pyx_v_tolerance = ((double)((double)0.0));
  6316. }
  6317. __pyx_v_lookback = values[4];
  6318. }
  6319. goto __pyx_L6_skip;
  6320. __pyx_L5_argtuple_error:;
  6321. __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 293, __pyx_L3_error)
  6322. __pyx_L6_skip:;
  6323. goto __pyx_L4_argument_unpacking_done;
  6324. __pyx_L3_error:;
  6325. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6326. Py_XDECREF(values[__pyx_temp]);
  6327. }
  6328. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6329. __Pyx_RefNannyFinishContext();
  6330. return NULL;
  6331. __pyx_L4_argument_unpacking_done:;
  6332. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_forced), (&PySet_Type), 1, "forced", 1))) __PYX_ERR(0, 305, __pyx_L1_error)
  6333. __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);
  6334. /* "fontTools/varLib/iup.py":293
  6335. *
  6336. *
  6337. * @cython.locals( # <<<<<<<<<<<<<<
  6338. * i=cython.int,
  6339. * j=cython.int,
  6340. */
  6341. /* function exit code */
  6342. goto __pyx_L0;
  6343. __pyx_L1_error:;
  6344. __pyx_r = NULL;
  6345. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6346. Py_XDECREF(values[__pyx_temp]);
  6347. }
  6348. goto __pyx_L7_cleaned_up;
  6349. __pyx_L0:;
  6350. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6351. Py_XDECREF(values[__pyx_temp]);
  6352. }
  6353. __pyx_L7_cleaned_up:;
  6354. __Pyx_RefNannyFinishContext();
  6355. return __pyx_r;
  6356. }
  6357. 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) {
  6358. int __pyx_v_i;
  6359. int __pyx_v_j;
  6360. double __pyx_v_best_cost;
  6361. double __pyx_v_cost;
  6362. Py_ssize_t __pyx_v_n;
  6363. PyObject *__pyx_v_costs = NULL;
  6364. PyObject *__pyx_v_chain = NULL;
  6365. PyObject *__pyx_r = NULL;
  6366. __Pyx_RefNannyDeclarations
  6367. Py_ssize_t __pyx_t_1;
  6368. int __pyx_t_2;
  6369. PyObject *__pyx_t_3 = NULL;
  6370. PyObject *__pyx_t_4 = NULL;
  6371. PyObject *__pyx_t_5 = NULL;
  6372. PyObject *__pyx_t_6 = NULL;
  6373. Py_ssize_t __pyx_t_7;
  6374. int __pyx_t_8;
  6375. double __pyx_t_9;
  6376. long __pyx_t_10;
  6377. Py_ssize_t __pyx_t_11;
  6378. Py_ssize_t __pyx_t_12;
  6379. int __pyx_t_13;
  6380. int __pyx_t_14;
  6381. int __pyx_t_15;
  6382. int __pyx_lineno = 0;
  6383. const char *__pyx_filename = NULL;
  6384. int __pyx_clineno = 0;
  6385. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp", 0);
  6386. __Pyx_INCREF(__pyx_v_lookback);
  6387. /* "fontTools/varLib/iup.py":318
  6388. * As major speedup, we stop looking further whenever we see a "forced" point."""
  6389. *
  6390. * n = len(deltas) # <<<<<<<<<<<<<<
  6391. * if lookback is None:
  6392. * lookback = n
  6393. */
  6394. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
  6395. __pyx_v_n = __pyx_t_1;
  6396. /* "fontTools/varLib/iup.py":319
  6397. *
  6398. * n = len(deltas)
  6399. * if lookback is None: # <<<<<<<<<<<<<<
  6400. * lookback = n
  6401. * lookback = min(lookback, MAX_LOOKBACK)
  6402. */
  6403. __pyx_t_2 = (__pyx_v_lookback == Py_None);
  6404. if (__pyx_t_2) {
  6405. /* "fontTools/varLib/iup.py":320
  6406. * n = len(deltas)
  6407. * if lookback is None:
  6408. * lookback = n # <<<<<<<<<<<<<<
  6409. * lookback = min(lookback, MAX_LOOKBACK)
  6410. * costs = {-1: 0}
  6411. */
  6412. __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
  6413. __Pyx_GOTREF(__pyx_t_3);
  6414. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6415. __pyx_t_3 = 0;
  6416. /* "fontTools/varLib/iup.py":319
  6417. *
  6418. * n = len(deltas)
  6419. * if lookback is None: # <<<<<<<<<<<<<<
  6420. * lookback = n
  6421. * lookback = min(lookback, MAX_LOOKBACK)
  6422. */
  6423. }
  6424. /* "fontTools/varLib/iup.py":321
  6425. * if lookback is None:
  6426. * lookback = n
  6427. * lookback = min(lookback, MAX_LOOKBACK) # <<<<<<<<<<<<<<
  6428. * costs = {-1: 0}
  6429. * chain = {-1: None}
  6430. */
  6431. __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)
  6432. __Pyx_GOTREF(__pyx_t_3);
  6433. __Pyx_INCREF(__pyx_v_lookback);
  6434. __pyx_t_4 = __pyx_v_lookback;
  6435. __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)
  6436. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 321, __pyx_L1_error)
  6437. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6438. if (__pyx_t_2) {
  6439. __Pyx_INCREF(__pyx_t_3);
  6440. __pyx_t_5 = __pyx_t_3;
  6441. } else {
  6442. __Pyx_INCREF(__pyx_t_4);
  6443. __pyx_t_5 = __pyx_t_4;
  6444. }
  6445. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6446. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6447. __pyx_t_3 = __pyx_t_5;
  6448. __Pyx_INCREF(__pyx_t_3);
  6449. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6450. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6451. __pyx_t_3 = 0;
  6452. /* "fontTools/varLib/iup.py":322
  6453. * lookback = n
  6454. * lookback = min(lookback, MAX_LOOKBACK)
  6455. * costs = {-1: 0} # <<<<<<<<<<<<<<
  6456. * chain = {-1: None}
  6457. * for i in range(0, n):
  6458. */
  6459. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
  6460. __Pyx_GOTREF(__pyx_t_3);
  6461. 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)
  6462. __pyx_v_costs = ((PyObject*)__pyx_t_3);
  6463. __pyx_t_3 = 0;
  6464. /* "fontTools/varLib/iup.py":323
  6465. * lookback = min(lookback, MAX_LOOKBACK)
  6466. * costs = {-1: 0}
  6467. * chain = {-1: None} # <<<<<<<<<<<<<<
  6468. * for i in range(0, n):
  6469. * best_cost = costs[i - 1] + 1
  6470. */
  6471. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
  6472. __Pyx_GOTREF(__pyx_t_3);
  6473. if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_int_neg_1, Py_None) < (0)) __PYX_ERR(0, 323, __pyx_L1_error)
  6474. __pyx_v_chain = ((PyObject*)__pyx_t_3);
  6475. __pyx_t_3 = 0;
  6476. /* "fontTools/varLib/iup.py":324
  6477. * costs = {-1: 0}
  6478. * chain = {-1: None}
  6479. * for i in range(0, n): # <<<<<<<<<<<<<<
  6480. * best_cost = costs[i - 1] + 1
  6481. *
  6482. */
  6483. __pyx_t_1 = __pyx_v_n;
  6484. __pyx_t_7 = __pyx_t_1;
  6485. for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
  6486. __pyx_v_i = __pyx_t_8;
  6487. /* "fontTools/varLib/iup.py":325
  6488. * chain = {-1: None}
  6489. * for i in range(0, n):
  6490. * best_cost = costs[i - 1] + 1 # <<<<<<<<<<<<<<
  6491. *
  6492. * costs[i] = best_cost
  6493. */
  6494. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  6495. __Pyx_GOTREF(__pyx_t_3);
  6496. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 325, __pyx_L1_error)
  6497. __Pyx_GOTREF(__pyx_t_5);
  6498. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6499. __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)
  6500. __Pyx_GOTREF(__pyx_t_3);
  6501. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6502. __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)
  6503. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6504. __pyx_v_best_cost = __pyx_t_9;
  6505. /* "fontTools/varLib/iup.py":327
  6506. * best_cost = costs[i - 1] + 1
  6507. *
  6508. * costs[i] = best_cost # <<<<<<<<<<<<<<
  6509. * chain[i] = i - 1
  6510. *
  6511. */
  6512. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_best_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
  6513. __Pyx_GOTREF(__pyx_t_3);
  6514. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
  6515. __Pyx_GOTREF(__pyx_t_5);
  6516. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 327, __pyx_L1_error)
  6517. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6518. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6519. /* "fontTools/varLib/iup.py":328
  6520. *
  6521. * costs[i] = best_cost
  6522. * chain[i] = i - 1 # <<<<<<<<<<<<<<
  6523. *
  6524. * if i - 1 in forced:
  6525. */
  6526. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
  6527. __Pyx_GOTREF(__pyx_t_3);
  6528. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
  6529. __Pyx_GOTREF(__pyx_t_5);
  6530. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 328, __pyx_L1_error)
  6531. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6532. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6533. /* "fontTools/varLib/iup.py":330
  6534. * chain[i] = i - 1
  6535. *
  6536. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6537. * continue
  6538. *
  6539. */
  6540. __pyx_t_3 = __Pyx_PyLong_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  6541. __Pyx_GOTREF(__pyx_t_3);
  6542. if (unlikely(__pyx_v_forced == Py_None)) {
  6543. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6544. __PYX_ERR(0, 330, __pyx_L1_error)
  6545. }
  6546. __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)
  6547. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6548. if (__pyx_t_2) {
  6549. /* "fontTools/varLib/iup.py":331
  6550. *
  6551. * if i - 1 in forced:
  6552. * continue # <<<<<<<<<<<<<<
  6553. *
  6554. * for j in range(i - 2, max(i - lookback, -2), -1):
  6555. */
  6556. goto __pyx_L4_continue;
  6557. /* "fontTools/varLib/iup.py":330
  6558. * chain[i] = i - 1
  6559. *
  6560. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6561. * continue
  6562. *
  6563. */
  6564. }
  6565. /* "fontTools/varLib/iup.py":333
  6566. * continue
  6567. *
  6568. * for j in range(i - 2, max(i - lookback, -2), -1): # <<<<<<<<<<<<<<
  6569. * cost = costs[j] + 1
  6570. *
  6571. */
  6572. __pyx_t_10 = -2L;
  6573. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  6574. __Pyx_GOTREF(__pyx_t_3);
  6575. __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_v_lookback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
  6576. __Pyx_GOTREF(__pyx_t_5);
  6577. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6578. __pyx_t_4 = __Pyx_PyLong_From_long(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
  6579. __Pyx_GOTREF(__pyx_t_4);
  6580. __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)
  6581. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6582. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 333, __pyx_L1_error)
  6583. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6584. if (__pyx_t_2) {
  6585. __pyx_t_6 = __Pyx_PyLong_From_long(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
  6586. __Pyx_GOTREF(__pyx_t_6);
  6587. __pyx_t_3 = __pyx_t_6;
  6588. __pyx_t_6 = 0;
  6589. } else {
  6590. __Pyx_INCREF(__pyx_t_5);
  6591. __pyx_t_3 = __pyx_t_5;
  6592. }
  6593. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6594. __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)
  6595. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6596. __pyx_t_12 = __pyx_t_11;
  6597. for (__pyx_t_13 = (__pyx_v_i - 2); __pyx_t_13 > __pyx_t_12; __pyx_t_13-=1) {
  6598. __pyx_v_j = __pyx_t_13;
  6599. /* "fontTools/varLib/iup.py":334
  6600. *
  6601. * for j in range(i - 2, max(i - lookback, -2), -1):
  6602. * cost = costs[j] + 1 # <<<<<<<<<<<<<<
  6603. *
  6604. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6605. */
  6606. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
  6607. __Pyx_GOTREF(__pyx_t_3);
  6608. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
  6609. __Pyx_GOTREF(__pyx_t_5);
  6610. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6611. __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)
  6612. __Pyx_GOTREF(__pyx_t_3);
  6613. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6614. __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)
  6615. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6616. __pyx_v_cost = __pyx_t_9;
  6617. /* "fontTools/varLib/iup.py":336
  6618. * cost = costs[j] + 1
  6619. *
  6620. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  6621. * costs[i] = best_cost = cost
  6622. * chain[i] = j
  6623. */
  6624. __pyx_t_14 = (__pyx_v_cost < __pyx_v_best_cost);
  6625. if (__pyx_t_14) {
  6626. } else {
  6627. __pyx_t_2 = __pyx_t_14;
  6628. goto __pyx_L10_bool_binop_done;
  6629. }
  6630. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
  6631. __Pyx_GOTREF(__pyx_t_3);
  6632. __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)
  6633. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6634. __pyx_t_14 = (__pyx_t_15 != 0);
  6635. __pyx_t_2 = __pyx_t_14;
  6636. __pyx_L10_bool_binop_done:;
  6637. if (__pyx_t_2) {
  6638. /* "fontTools/varLib/iup.py":337
  6639. *
  6640. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6641. * costs[i] = best_cost = cost # <<<<<<<<<<<<<<
  6642. * chain[i] = j
  6643. *
  6644. */
  6645. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
  6646. __Pyx_GOTREF(__pyx_t_3);
  6647. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
  6648. __Pyx_GOTREF(__pyx_t_5);
  6649. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 337, __pyx_L1_error)
  6650. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6651. __pyx_v_best_cost = __pyx_v_cost;
  6652. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6653. /* "fontTools/varLib/iup.py":338
  6654. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6655. * costs[i] = best_cost = cost
  6656. * chain[i] = j # <<<<<<<<<<<<<<
  6657. *
  6658. * if j in forced:
  6659. */
  6660. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
  6661. __Pyx_GOTREF(__pyx_t_3);
  6662. __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
  6663. __Pyx_GOTREF(__pyx_t_5);
  6664. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 338, __pyx_L1_error)
  6665. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6666. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6667. /* "fontTools/varLib/iup.py":336
  6668. * cost = costs[j] + 1
  6669. *
  6670. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  6671. * costs[i] = best_cost = cost
  6672. * chain[i] = j
  6673. */
  6674. }
  6675. /* "fontTools/varLib/iup.py":340
  6676. * chain[i] = j
  6677. *
  6678. * if j in forced: # <<<<<<<<<<<<<<
  6679. * break
  6680. *
  6681. */
  6682. __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
  6683. __Pyx_GOTREF(__pyx_t_3);
  6684. if (unlikely(__pyx_v_forced == Py_None)) {
  6685. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6686. __PYX_ERR(0, 340, __pyx_L1_error)
  6687. }
  6688. __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)
  6689. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6690. if (__pyx_t_2) {
  6691. /* "fontTools/varLib/iup.py":341
  6692. *
  6693. * if j in forced:
  6694. * break # <<<<<<<<<<<<<<
  6695. *
  6696. * return chain, costs
  6697. */
  6698. goto __pyx_L8_break;
  6699. /* "fontTools/varLib/iup.py":340
  6700. * chain[i] = j
  6701. *
  6702. * if j in forced: # <<<<<<<<<<<<<<
  6703. * break
  6704. *
  6705. */
  6706. }
  6707. }
  6708. __pyx_L8_break:;
  6709. __pyx_L4_continue:;
  6710. }
  6711. /* "fontTools/varLib/iup.py":343
  6712. * break
  6713. *
  6714. * return chain, costs # <<<<<<<<<<<<<<
  6715. *
  6716. *
  6717. */
  6718. __Pyx_XDECREF(__pyx_r);
  6719. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
  6720. __Pyx_GOTREF(__pyx_t_3);
  6721. __Pyx_INCREF(__pyx_v_chain);
  6722. __Pyx_GIVEREF(__pyx_v_chain);
  6723. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chain) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
  6724. __Pyx_INCREF(__pyx_v_costs);
  6725. __Pyx_GIVEREF(__pyx_v_costs);
  6726. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_costs) != (0)) __PYX_ERR(0, 343, __pyx_L1_error);
  6727. __pyx_r = __pyx_t_3;
  6728. __pyx_t_3 = 0;
  6729. goto __pyx_L0;
  6730. /* "fontTools/varLib/iup.py":293
  6731. *
  6732. *
  6733. * @cython.locals( # <<<<<<<<<<<<<<
  6734. * i=cython.int,
  6735. * j=cython.int,
  6736. */
  6737. /* function exit code */
  6738. __pyx_L1_error:;
  6739. __Pyx_XDECREF(__pyx_t_3);
  6740. __Pyx_XDECREF(__pyx_t_4);
  6741. __Pyx_XDECREF(__pyx_t_5);
  6742. __Pyx_XDECREF(__pyx_t_6);
  6743. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6744. __pyx_r = NULL;
  6745. __pyx_L0:;
  6746. __Pyx_XDECREF(__pyx_v_costs);
  6747. __Pyx_XDECREF(__pyx_v_chain);
  6748. __Pyx_XDECREF(__pyx_v_lookback);
  6749. __Pyx_XGIVEREF(__pyx_r);
  6750. __Pyx_RefNannyFinishContext();
  6751. return __pyx_r;
  6752. }
  6753. /* "fontTools/varLib/iup.py":346
  6754. *
  6755. *
  6756. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  6757. * """Rotate list by k items forward. Ie. item at position 0 will be
  6758. * at position k in returned list. Negative k is allowed."""
  6759. */
  6760. /* Python wrapper */
  6761. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_9_rot_list(PyObject *__pyx_self,
  6762. #if CYTHON_METH_FASTCALL
  6763. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6764. #else
  6765. PyObject *__pyx_args, PyObject *__pyx_kwds
  6766. #endif
  6767. ); /*proto*/
  6768. 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.");
  6769. 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};
  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. ) {
  6777. PyObject *__pyx_v_l = 0;
  6778. PyObject *__pyx_v_k = 0;
  6779. #if !CYTHON_METH_FASTCALL
  6780. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6781. #endif
  6782. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6783. PyObject* values[2] = {0,0};
  6784. int __pyx_lineno = 0;
  6785. const char *__pyx_filename = NULL;
  6786. int __pyx_clineno = 0;
  6787. PyObject *__pyx_r = 0;
  6788. __Pyx_RefNannyDeclarations
  6789. __Pyx_RefNannySetupContext("_rot_list (wrapper)", 0);
  6790. #if !CYTHON_METH_FASTCALL
  6791. #if CYTHON_ASSUME_SAFE_SIZE
  6792. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6793. #else
  6794. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6795. #endif
  6796. #endif
  6797. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6798. {
  6799. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_l,&__pyx_mstate_global->__pyx_n_u_k,0};
  6800. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6801. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 346, __pyx_L3_error)
  6802. if (__pyx_kwds_len > 0) {
  6803. switch (__pyx_nargs) {
  6804. case 2:
  6805. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6806. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 346, __pyx_L3_error)
  6807. CYTHON_FALLTHROUGH;
  6808. case 1:
  6809. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6810. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error)
  6811. CYTHON_FALLTHROUGH;
  6812. case 0: break;
  6813. default: goto __pyx_L5_argtuple_error;
  6814. }
  6815. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6816. 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)
  6817. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  6818. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, i); __PYX_ERR(0, 346, __pyx_L3_error) }
  6819. }
  6820. } else if (unlikely(__pyx_nargs != 2)) {
  6821. goto __pyx_L5_argtuple_error;
  6822. } else {
  6823. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6824. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error)
  6825. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6826. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 346, __pyx_L3_error)
  6827. }
  6828. __pyx_v_l = ((PyObject*)values[0]);
  6829. if (__Pyx_PyInt_FromNumber(&values[1], "k", 0) < (0)) __PYX_ERR(0, 346, __pyx_L3_error)
  6830. __pyx_v_k = ((PyObject*)values[1]);
  6831. }
  6832. goto __pyx_L6_skip;
  6833. __pyx_L5_argtuple_error:;
  6834. __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 346, __pyx_L3_error)
  6835. __pyx_L6_skip:;
  6836. goto __pyx_L4_argument_unpacking_done;
  6837. __pyx_L3_error:;
  6838. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6839. Py_XDECREF(values[__pyx_temp]);
  6840. }
  6841. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6842. __Pyx_RefNannyFinishContext();
  6843. return NULL;
  6844. __pyx_L4_argument_unpacking_done:;
  6845. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l), (&PyList_Type), 0, "l", 2))) __PYX_ERR(0, 346, __pyx_L1_error)
  6846. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyLong_Type), 0, "k", 2))) __PYX_ERR(0, 346, __pyx_L1_error)
  6847. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_8_rot_list(__pyx_self, __pyx_v_l, __pyx_v_k);
  6848. /* function exit code */
  6849. goto __pyx_L0;
  6850. __pyx_L1_error:;
  6851. __pyx_r = NULL;
  6852. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6853. Py_XDECREF(values[__pyx_temp]);
  6854. }
  6855. goto __pyx_L7_cleaned_up;
  6856. __pyx_L0:;
  6857. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6858. Py_XDECREF(values[__pyx_temp]);
  6859. }
  6860. __pyx_L7_cleaned_up:;
  6861. __Pyx_RefNannyFinishContext();
  6862. return __pyx_r;
  6863. }
  6864. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k) {
  6865. PyObject *__pyx_v_n = NULL;
  6866. PyObject *__pyx_r = NULL;
  6867. __Pyx_RefNannyDeclarations
  6868. Py_ssize_t __pyx_t_1;
  6869. PyObject *__pyx_t_2 = NULL;
  6870. int __pyx_t_3;
  6871. int __pyx_t_4;
  6872. Py_ssize_t __pyx_t_5;
  6873. PyObject *__pyx_t_6 = NULL;
  6874. PyObject *__pyx_t_7 = NULL;
  6875. int __pyx_lineno = 0;
  6876. const char *__pyx_filename = NULL;
  6877. int __pyx_clineno = 0;
  6878. __Pyx_RefNannySetupContext("_rot_list", 0);
  6879. __Pyx_INCREF(__pyx_v_k);
  6880. /* "fontTools/varLib/iup.py":349
  6881. * """Rotate list by k items forward. Ie. item at position 0 will be
  6882. * at position k in returned list. Negative k is allowed."""
  6883. * n = len(l) # <<<<<<<<<<<<<<
  6884. * k %= n
  6885. * if not k:
  6886. */
  6887. __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)
  6888. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  6889. __Pyx_GOTREF(__pyx_t_2);
  6890. __pyx_v_n = __pyx_t_2;
  6891. __pyx_t_2 = 0;
  6892. /* "fontTools/varLib/iup.py":350
  6893. * at position k in returned list. Negative k is allowed."""
  6894. * n = len(l)
  6895. * k %= n # <<<<<<<<<<<<<<
  6896. * if not k:
  6897. * return l
  6898. */
  6899. __pyx_t_2 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
  6900. __Pyx_GOTREF(__pyx_t_2);
  6901. if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 350, __pyx_L1_error)
  6902. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_2));
  6903. __pyx_t_2 = 0;
  6904. /* "fontTools/varLib/iup.py":351
  6905. * n = len(l)
  6906. * k %= n
  6907. * if not k: # <<<<<<<<<<<<<<
  6908. * return l
  6909. * return l[n - k :] + l[: n - k]
  6910. */
  6911. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 351, __pyx_L1_error)
  6912. __pyx_t_4 = (!__pyx_t_3);
  6913. if (__pyx_t_4) {
  6914. /* "fontTools/varLib/iup.py":352
  6915. * k %= n
  6916. * if not k:
  6917. * return l # <<<<<<<<<<<<<<
  6918. * return l[n - k :] + l[: n - k]
  6919. *
  6920. */
  6921. __Pyx_XDECREF(__pyx_r);
  6922. __Pyx_INCREF(__pyx_v_l);
  6923. __pyx_r = __pyx_v_l;
  6924. goto __pyx_L0;
  6925. /* "fontTools/varLib/iup.py":351
  6926. * n = len(l)
  6927. * k %= n
  6928. * if not k: # <<<<<<<<<<<<<<
  6929. * return l
  6930. * return l[n - k :] + l[: n - k]
  6931. */
  6932. }
  6933. /* "fontTools/varLib/iup.py":353
  6934. * if not k:
  6935. * return l
  6936. * return l[n - k :] + l[: n - k] # <<<<<<<<<<<<<<
  6937. *
  6938. *
  6939. */
  6940. __Pyx_XDECREF(__pyx_r);
  6941. __pyx_t_2 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
  6942. __Pyx_GOTREF(__pyx_t_2);
  6943. __pyx_t_4 = (__pyx_t_2 == Py_None);
  6944. if (__pyx_t_4) {
  6945. __pyx_t_1 = 0;
  6946. } else {
  6947. __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)
  6948. __pyx_t_1 = __pyx_t_5;
  6949. }
  6950. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6951. __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)
  6952. __Pyx_GOTREF(__pyx_t_2);
  6953. __pyx_t_6 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error)
  6954. __Pyx_GOTREF(__pyx_t_6);
  6955. __pyx_t_4 = (__pyx_t_6 == Py_None);
  6956. if (__pyx_t_4) {
  6957. __pyx_t_1 = PY_SSIZE_T_MAX;
  6958. } else {
  6959. __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)
  6960. __pyx_t_1 = __pyx_t_5;
  6961. }
  6962. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6963. __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)
  6964. __Pyx_GOTREF(__pyx_t_6);
  6965. __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error)
  6966. __Pyx_GOTREF(__pyx_t_7);
  6967. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6968. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6969. __pyx_r = __pyx_t_7;
  6970. __pyx_t_7 = 0;
  6971. goto __pyx_L0;
  6972. /* "fontTools/varLib/iup.py":346
  6973. *
  6974. *
  6975. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  6976. * """Rotate list by k items forward. Ie. item at position 0 will be
  6977. * at position k in returned list. Negative k is allowed."""
  6978. */
  6979. /* function exit code */
  6980. __pyx_L1_error:;
  6981. __Pyx_XDECREF(__pyx_t_2);
  6982. __Pyx_XDECREF(__pyx_t_6);
  6983. __Pyx_XDECREF(__pyx_t_7);
  6984. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6985. __pyx_r = NULL;
  6986. __pyx_L0:;
  6987. __Pyx_XDECREF(__pyx_v_n);
  6988. __Pyx_XDECREF(__pyx_v_k);
  6989. __Pyx_XGIVEREF(__pyx_r);
  6990. __Pyx_RefNannyFinishContext();
  6991. return __pyx_r;
  6992. }
  6993. /* "fontTools/varLib/iup.py":356
  6994. *
  6995. *
  6996. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  6997. * k %= n
  6998. * if not k:
  6999. */
  7000. /* Python wrapper */
  7001. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_11_rot_set(PyObject *__pyx_self,
  7002. #if CYTHON_METH_FASTCALL
  7003. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7004. #else
  7005. PyObject *__pyx_args, PyObject *__pyx_kwds
  7006. #endif
  7007. ); /*proto*/
  7008. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_10_rot_set, "_rot_set(set s: set, int k: int, int n: int)");
  7009. 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};
  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. ) {
  7017. PyObject *__pyx_v_s = 0;
  7018. PyObject *__pyx_v_k = 0;
  7019. PyObject *__pyx_v_n = 0;
  7020. #if !CYTHON_METH_FASTCALL
  7021. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7022. #endif
  7023. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7024. PyObject* values[3] = {0,0,0};
  7025. int __pyx_lineno = 0;
  7026. const char *__pyx_filename = NULL;
  7027. int __pyx_clineno = 0;
  7028. PyObject *__pyx_r = 0;
  7029. __Pyx_RefNannyDeclarations
  7030. __Pyx_RefNannySetupContext("_rot_set (wrapper)", 0);
  7031. #if !CYTHON_METH_FASTCALL
  7032. #if CYTHON_ASSUME_SAFE_SIZE
  7033. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7034. #else
  7035. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7036. #endif
  7037. #endif
  7038. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7039. {
  7040. 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};
  7041. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7042. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 356, __pyx_L3_error)
  7043. if (__pyx_kwds_len > 0) {
  7044. switch (__pyx_nargs) {
  7045. case 3:
  7046. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7047. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 356, __pyx_L3_error)
  7048. CYTHON_FALLTHROUGH;
  7049. case 2:
  7050. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7051. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 356, __pyx_L3_error)
  7052. CYTHON_FALLTHROUGH;
  7053. case 1:
  7054. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7055. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 356, __pyx_L3_error)
  7056. CYTHON_FALLTHROUGH;
  7057. case 0: break;
  7058. default: goto __pyx_L5_argtuple_error;
  7059. }
  7060. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7061. 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)
  7062. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  7063. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, i); __PYX_ERR(0, 356, __pyx_L3_error) }
  7064. }
  7065. } else if (unlikely(__pyx_nargs != 3)) {
  7066. goto __pyx_L5_argtuple_error;
  7067. } else {
  7068. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7069. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 356, __pyx_L3_error)
  7070. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7071. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 356, __pyx_L3_error)
  7072. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7073. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 356, __pyx_L3_error)
  7074. }
  7075. __pyx_v_s = ((PyObject*)values[0]);
  7076. if (__Pyx_PyInt_FromNumber(&values[1], "k", 0) < (0)) __PYX_ERR(0, 356, __pyx_L3_error)
  7077. __pyx_v_k = ((PyObject*)values[1]);
  7078. if (__Pyx_PyInt_FromNumber(&values[2], "n", 0) < (0)) __PYX_ERR(0, 356, __pyx_L3_error)
  7079. __pyx_v_n = ((PyObject*)values[2]);
  7080. }
  7081. goto __pyx_L6_skip;
  7082. __pyx_L5_argtuple_error:;
  7083. __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 356, __pyx_L3_error)
  7084. __pyx_L6_skip:;
  7085. goto __pyx_L4_argument_unpacking_done;
  7086. __pyx_L3_error:;
  7087. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7088. Py_XDECREF(values[__pyx_temp]);
  7089. }
  7090. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7091. __Pyx_RefNannyFinishContext();
  7092. return NULL;
  7093. __pyx_L4_argument_unpacking_done:;
  7094. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PySet_Type), 0, "s", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7095. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyLong_Type), 0, "k", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7096. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), (&PyLong_Type), 0, "n", 2))) __PYX_ERR(0, 356, __pyx_L1_error)
  7097. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_10_rot_set(__pyx_self, __pyx_v_s, __pyx_v_k, __pyx_v_n);
  7098. /* function exit code */
  7099. goto __pyx_L0;
  7100. __pyx_L1_error:;
  7101. __pyx_r = NULL;
  7102. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7103. Py_XDECREF(values[__pyx_temp]);
  7104. }
  7105. goto __pyx_L7_cleaned_up;
  7106. __pyx_L0:;
  7107. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7108. Py_XDECREF(values[__pyx_temp]);
  7109. }
  7110. __pyx_L7_cleaned_up:;
  7111. __Pyx_RefNannyFinishContext();
  7112. return __pyx_r;
  7113. }
  7114. 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) {
  7115. PyObject *__pyx_8genexpr2__pyx_v_v = NULL;
  7116. PyObject *__pyx_r = NULL;
  7117. __Pyx_RefNannyDeclarations
  7118. PyObject *__pyx_t_1 = NULL;
  7119. int __pyx_t_2;
  7120. int __pyx_t_3;
  7121. PyObject *__pyx_t_4 = NULL;
  7122. Py_ssize_t __pyx_t_5;
  7123. Py_ssize_t __pyx_t_6;
  7124. int __pyx_t_7;
  7125. PyObject *__pyx_t_8 = NULL;
  7126. int __pyx_t_9;
  7127. PyObject *__pyx_t_10 = NULL;
  7128. int __pyx_lineno = 0;
  7129. const char *__pyx_filename = NULL;
  7130. int __pyx_clineno = 0;
  7131. __Pyx_RefNannySetupContext("_rot_set", 0);
  7132. __Pyx_INCREF(__pyx_v_k);
  7133. /* "fontTools/varLib/iup.py":357
  7134. *
  7135. * def _rot_set(s: set, k: int, n: int):
  7136. * k %= n # <<<<<<<<<<<<<<
  7137. * if not k:
  7138. * return s
  7139. */
  7140. __pyx_t_1 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  7141. __Pyx_GOTREF(__pyx_t_1);
  7142. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_1));
  7143. __pyx_t_1 = 0;
  7144. /* "fontTools/varLib/iup.py":358
  7145. * def _rot_set(s: set, k: int, n: int):
  7146. * k %= n
  7147. * if not k: # <<<<<<<<<<<<<<
  7148. * return s
  7149. * return {(v + k) % n for v in s}
  7150. */
  7151. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 358, __pyx_L1_error)
  7152. __pyx_t_3 = (!__pyx_t_2);
  7153. if (__pyx_t_3) {
  7154. /* "fontTools/varLib/iup.py":359
  7155. * k %= n
  7156. * if not k:
  7157. * return s # <<<<<<<<<<<<<<
  7158. * return {(v + k) % n for v in s}
  7159. *
  7160. */
  7161. __Pyx_XDECREF(__pyx_r);
  7162. __Pyx_INCREF(__pyx_v_s);
  7163. __pyx_r = __pyx_v_s;
  7164. goto __pyx_L0;
  7165. /* "fontTools/varLib/iup.py":358
  7166. * def _rot_set(s: set, k: int, n: int):
  7167. * k %= n
  7168. * if not k: # <<<<<<<<<<<<<<
  7169. * return s
  7170. * return {(v + k) % n for v in s}
  7171. */
  7172. }
  7173. /* "fontTools/varLib/iup.py":360
  7174. * if not k:
  7175. * return s
  7176. * return {(v + k) % n for v in s} # <<<<<<<<<<<<<<
  7177. *
  7178. *
  7179. */
  7180. __Pyx_XDECREF(__pyx_r);
  7181. { /* enter inner scope */
  7182. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L6_error)
  7183. __Pyx_GOTREF(__pyx_t_1);
  7184. __pyx_t_5 = 0;
  7185. __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)
  7186. __Pyx_GOTREF(__pyx_t_8);
  7187. __Pyx_XDECREF(__pyx_t_4);
  7188. __pyx_t_4 = __pyx_t_8;
  7189. __pyx_t_8 = 0;
  7190. while (1) {
  7191. __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, __pyx_t_7);
  7192. if (unlikely(__pyx_t_9 == 0)) break;
  7193. if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 360, __pyx_L6_error)
  7194. __Pyx_GOTREF(__pyx_t_8);
  7195. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_v, __pyx_t_8);
  7196. __pyx_t_8 = 0;
  7197. __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)
  7198. __Pyx_GOTREF(__pyx_t_8);
  7199. __pyx_t_10 = PyNumber_Remainder(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 360, __pyx_L6_error)
  7200. __Pyx_GOTREF(__pyx_t_10);
  7201. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7202. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 360, __pyx_L6_error)
  7203. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7204. }
  7205. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7206. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7207. goto __pyx_L9_exit_scope;
  7208. __pyx_L6_error:;
  7209. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7210. goto __pyx_L1_error;
  7211. __pyx_L9_exit_scope:;
  7212. } /* exit inner scope */
  7213. __pyx_r = __pyx_t_1;
  7214. __pyx_t_1 = 0;
  7215. goto __pyx_L0;
  7216. /* "fontTools/varLib/iup.py":356
  7217. *
  7218. *
  7219. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  7220. * k %= n
  7221. * if not k:
  7222. */
  7223. /* function exit code */
  7224. __pyx_L1_error:;
  7225. __Pyx_XDECREF(__pyx_t_1);
  7226. __Pyx_XDECREF(__pyx_t_4);
  7227. __Pyx_XDECREF(__pyx_t_8);
  7228. __Pyx_XDECREF(__pyx_t_10);
  7229. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7230. __pyx_r = NULL;
  7231. __pyx_L0:;
  7232. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v);
  7233. __Pyx_XDECREF(__pyx_v_k);
  7234. __Pyx_XGIVEREF(__pyx_r);
  7235. __Pyx_RefNannyFinishContext();
  7236. return __pyx_r;
  7237. }
  7238. /* "fontTools/varLib/iup.py":363
  7239. *
  7240. *
  7241. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  7242. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  7243. * ) -> _DeltaOrNoneSegment:
  7244. */
  7245. /* Python wrapper */
  7246. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize(PyObject *__pyx_self,
  7247. #if CYTHON_METH_FASTCALL
  7248. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7249. #else
  7250. PyObject *__pyx_args, PyObject *__pyx_kwds
  7251. #endif
  7252. ); /*proto*/
  7253. 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.");
  7254. 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};
  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. ) {
  7262. PyObject *__pyx_v_deltas = 0;
  7263. PyObject *__pyx_v_coords = 0;
  7264. PyObject *__pyx_v_tolerance = 0;
  7265. #if !CYTHON_METH_FASTCALL
  7266. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7267. #endif
  7268. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7269. PyObject* values[3] = {0,0,0};
  7270. int __pyx_lineno = 0;
  7271. const char *__pyx_filename = NULL;
  7272. int __pyx_clineno = 0;
  7273. PyObject *__pyx_r = 0;
  7274. __Pyx_RefNannyDeclarations
  7275. __Pyx_RefNannySetupContext("iup_contour_optimize (wrapper)", 0);
  7276. #if !CYTHON_METH_FASTCALL
  7277. #if CYTHON_ASSUME_SAFE_SIZE
  7278. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7279. #else
  7280. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7281. #endif
  7282. #endif
  7283. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7284. {
  7285. 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};
  7286. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7287. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 363, __pyx_L3_error)
  7288. if (__pyx_kwds_len > 0) {
  7289. switch (__pyx_nargs) {
  7290. case 3:
  7291. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7292. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 363, __pyx_L3_error)
  7293. CYTHON_FALLTHROUGH;
  7294. case 2:
  7295. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7296. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 363, __pyx_L3_error)
  7297. CYTHON_FALLTHROUGH;
  7298. case 1:
  7299. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7300. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 363, __pyx_L3_error)
  7301. CYTHON_FALLTHROUGH;
  7302. case 0: break;
  7303. default: goto __pyx_L5_argtuple_error;
  7304. }
  7305. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7306. 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)
  7307. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  7308. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  7309. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, i); __PYX_ERR(0, 363, __pyx_L3_error) }
  7310. }
  7311. } else {
  7312. switch (__pyx_nargs) {
  7313. case 3:
  7314. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7315. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 363, __pyx_L3_error)
  7316. CYTHON_FALLTHROUGH;
  7317. case 2:
  7318. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7319. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 363, __pyx_L3_error)
  7320. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7321. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 363, __pyx_L3_error)
  7322. break;
  7323. default: goto __pyx_L5_argtuple_error;
  7324. }
  7325. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  7326. }
  7327. __pyx_v_deltas = values[0];
  7328. __pyx_v_coords = values[1];
  7329. __pyx_v_tolerance = values[2];
  7330. }
  7331. goto __pyx_L6_skip;
  7332. __pyx_L5_argtuple_error:;
  7333. __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 363, __pyx_L3_error)
  7334. __pyx_L6_skip:;
  7335. goto __pyx_L4_argument_unpacking_done;
  7336. __pyx_L3_error:;
  7337. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7338. Py_XDECREF(values[__pyx_temp]);
  7339. }
  7340. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7341. __Pyx_RefNannyFinishContext();
  7342. return NULL;
  7343. __pyx_L4_argument_unpacking_done:;
  7344. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_12iup_contour_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  7345. /* function exit code */
  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_RefNannyFinishContext();
  7350. return __pyx_r;
  7351. }
  7352. 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 */
  7353. /* "fontTools/varLib/iup.py":378
  7354. *
  7355. * # If all are within tolerance distance of 0, encode nothing:
  7356. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7357. * return [None] * n
  7358. *
  7359. */
  7360. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7361. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  7362. PyObject *__pyx_r = NULL;
  7363. __Pyx_RefNannyDeclarations
  7364. int __pyx_lineno = 0;
  7365. const char *__pyx_filename = NULL;
  7366. int __pyx_clineno = 0;
  7367. __Pyx_RefNannySetupContext("genexpr", 0);
  7368. __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);
  7369. if (unlikely(!__pyx_cur_scope)) {
  7370. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)Py_None);
  7371. __Pyx_INCREF(Py_None);
  7372. __PYX_ERR(0, 378, __pyx_L1_error)
  7373. } else {
  7374. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7375. }
  7376. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7377. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7378. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7379. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7380. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7381. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7382. {
  7383. __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)
  7384. __Pyx_DECREF(__pyx_cur_scope);
  7385. __Pyx_RefNannyFinishContext();
  7386. return (PyObject *) gen;
  7387. }
  7388. /* function exit code */
  7389. __pyx_L1_error:;
  7390. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7391. __pyx_r = NULL;
  7392. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  7393. __Pyx_XGIVEREF(__pyx_r);
  7394. __Pyx_RefNannyFinishContext();
  7395. return __pyx_r;
  7396. }
  7397. 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 */
  7398. {
  7399. 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);
  7400. PyObject *__pyx_r = NULL;
  7401. PyObject *__pyx_t_1 = NULL;
  7402. Py_ssize_t __pyx_t_2;
  7403. PyObject *(*__pyx_t_3)(PyObject *);
  7404. PyObject *__pyx_t_4 = NULL;
  7405. PyObject *__pyx_t_5 = NULL;
  7406. int __pyx_t_6;
  7407. int __pyx_t_7;
  7408. int __pyx_lineno = 0;
  7409. const char *__pyx_filename = NULL;
  7410. int __pyx_clineno = 0;
  7411. __Pyx_RefNannyDeclarations
  7412. __Pyx_RefNannySetupContext("genexpr", 0);
  7413. switch (__pyx_generator->resume_label) {
  7414. case 0: goto __pyx_L3_first_run;
  7415. default: /* CPython raises the right error here */
  7416. __Pyx_RefNannyFinishContext();
  7417. return NULL;
  7418. }
  7419. __pyx_L3_first_run:;
  7420. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 378, __pyx_L1_error)
  7421. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 378, __pyx_L1_error) }
  7422. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  7423. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  7424. __pyx_t_2 = 0;
  7425. __pyx_t_3 = NULL;
  7426. } else {
  7427. __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)
  7428. __Pyx_GOTREF(__pyx_t_1);
  7429. __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)
  7430. }
  7431. for (;;) {
  7432. if (likely(!__pyx_t_3)) {
  7433. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7434. {
  7435. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  7436. #if !CYTHON_ASSUME_SAFE_SIZE
  7437. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7438. #endif
  7439. if (__pyx_t_2 >= __pyx_temp) break;
  7440. }
  7441. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  7442. ++__pyx_t_2;
  7443. } else {
  7444. {
  7445. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  7446. #if !CYTHON_ASSUME_SAFE_SIZE
  7447. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7448. #endif
  7449. if (__pyx_t_2 >= __pyx_temp) break;
  7450. }
  7451. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7452. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  7453. #else
  7454. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  7455. #endif
  7456. ++__pyx_t_2;
  7457. }
  7458. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7459. } else {
  7460. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7461. if (unlikely(!__pyx_t_4)) {
  7462. PyObject* exc_type = PyErr_Occurred();
  7463. if (exc_type) {
  7464. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 378, __pyx_L1_error)
  7465. PyErr_Clear();
  7466. }
  7467. break;
  7468. }
  7469. }
  7470. __Pyx_GOTREF(__pyx_t_4);
  7471. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);
  7472. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_4);
  7473. __Pyx_GIVEREF(__pyx_t_4);
  7474. __pyx_t_4 = 0;
  7475. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_cur_scope->__pyx_v_p); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7476. __Pyx_GOTREF(__pyx_t_4);
  7477. __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)
  7478. __Pyx_GOTREF(__pyx_t_5);
  7479. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7480. __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error)
  7481. __Pyx_GOTREF(__pyx_t_4);
  7482. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7483. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 378, __pyx_L1_error) }
  7484. __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)
  7485. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7486. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7487. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7488. __pyx_t_7 = (!__pyx_t_6);
  7489. if (__pyx_t_7) {
  7490. __Pyx_XDECREF(__pyx_r);
  7491. __Pyx_INCREF(Py_False);
  7492. __pyx_r = Py_False;
  7493. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7494. goto __pyx_L0;
  7495. }
  7496. }
  7497. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7498. /*else*/ {
  7499. __Pyx_XDECREF(__pyx_r);
  7500. __Pyx_INCREF(Py_True);
  7501. __pyx_r = Py_True;
  7502. goto __pyx_L0;
  7503. }
  7504. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  7505. /* function exit code */
  7506. goto __pyx_L0;
  7507. __pyx_L1_error:;
  7508. __Pyx_XDECREF(__pyx_t_1);
  7509. __Pyx_XDECREF(__pyx_t_4);
  7510. __Pyx_XDECREF(__pyx_t_5);
  7511. if (__Pyx_PyErr_Occurred()) {
  7512. __Pyx_Generator_Replace_StopIteration(0);
  7513. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7514. }
  7515. __pyx_L0:;
  7516. __Pyx_XGIVEREF(__pyx_r);
  7517. #if !CYTHON_USE_EXC_INFO_STACK
  7518. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  7519. #endif
  7520. __pyx_generator->resume_label = -1;
  7521. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  7522. __Pyx_RefNannyFinishContext();
  7523. return __pyx_r;
  7524. }
  7525. 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 */
  7526. /* "fontTools/varLib/iup.py":387
  7527. * # If all deltas are exactly the same, return just one (the first one):
  7528. * d0 = deltas[0]
  7529. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7530. * return [d0] + [None] * (n - 1)
  7531. *
  7532. */
  7533. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7534. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  7535. PyObject *__pyx_r = NULL;
  7536. __Pyx_RefNannyDeclarations
  7537. int __pyx_lineno = 0;
  7538. const char *__pyx_filename = NULL;
  7539. int __pyx_clineno = 0;
  7540. __Pyx_RefNannySetupContext("genexpr", 0);
  7541. __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);
  7542. if (unlikely(!__pyx_cur_scope)) {
  7543. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)Py_None);
  7544. __Pyx_INCREF(Py_None);
  7545. __PYX_ERR(0, 387, __pyx_L1_error)
  7546. } else {
  7547. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7548. }
  7549. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7550. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7551. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7552. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7553. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7554. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7555. {
  7556. __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)
  7557. __Pyx_DECREF(__pyx_cur_scope);
  7558. __Pyx_RefNannyFinishContext();
  7559. return (PyObject *) gen;
  7560. }
  7561. /* function exit code */
  7562. __pyx_L1_error:;
  7563. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7564. __pyx_r = NULL;
  7565. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  7566. __Pyx_XGIVEREF(__pyx_r);
  7567. __Pyx_RefNannyFinishContext();
  7568. return __pyx_r;
  7569. }
  7570. 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 */
  7571. {
  7572. 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);
  7573. PyObject *__pyx_r = NULL;
  7574. PyObject *__pyx_t_1 = NULL;
  7575. Py_ssize_t __pyx_t_2;
  7576. PyObject *(*__pyx_t_3)(PyObject *);
  7577. PyObject *__pyx_t_4 = NULL;
  7578. int __pyx_t_5;
  7579. int __pyx_t_6;
  7580. int __pyx_lineno = 0;
  7581. const char *__pyx_filename = NULL;
  7582. int __pyx_clineno = 0;
  7583. __Pyx_RefNannyDeclarations
  7584. __Pyx_RefNannySetupContext("genexpr", 0);
  7585. switch (__pyx_generator->resume_label) {
  7586. case 0: goto __pyx_L3_first_run;
  7587. default: /* CPython raises the right error here */
  7588. __Pyx_RefNannyFinishContext();
  7589. return NULL;
  7590. }
  7591. __pyx_L3_first_run:;
  7592. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 387, __pyx_L1_error)
  7593. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 387, __pyx_L1_error) }
  7594. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  7595. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  7596. __pyx_t_2 = 0;
  7597. __pyx_t_3 = NULL;
  7598. } else {
  7599. __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)
  7600. __Pyx_GOTREF(__pyx_t_1);
  7601. __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)
  7602. }
  7603. for (;;) {
  7604. if (likely(!__pyx_t_3)) {
  7605. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7606. {
  7607. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  7608. #if !CYTHON_ASSUME_SAFE_SIZE
  7609. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7610. #endif
  7611. if (__pyx_t_2 >= __pyx_temp) break;
  7612. }
  7613. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  7614. ++__pyx_t_2;
  7615. } else {
  7616. {
  7617. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  7618. #if !CYTHON_ASSUME_SAFE_SIZE
  7619. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7620. #endif
  7621. if (__pyx_t_2 >= __pyx_temp) break;
  7622. }
  7623. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7624. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  7625. #else
  7626. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  7627. #endif
  7628. ++__pyx_t_2;
  7629. }
  7630. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
  7631. } else {
  7632. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7633. if (unlikely(!__pyx_t_4)) {
  7634. PyObject* exc_type = PyErr_Occurred();
  7635. if (exc_type) {
  7636. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 387, __pyx_L1_error)
  7637. PyErr_Clear();
  7638. }
  7639. break;
  7640. }
  7641. }
  7642. __Pyx_GOTREF(__pyx_t_4);
  7643. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_d);
  7644. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_4);
  7645. __Pyx_GIVEREF(__pyx_t_4);
  7646. __pyx_t_4 = 0;
  7647. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_d0)) { __Pyx_RaiseClosureNameError("d0"); __PYX_ERR(0, 387, __pyx_L1_error) }
  7648. __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)
  7649. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7650. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7651. __pyx_t_6 = (!__pyx_t_5);
  7652. if (__pyx_t_6) {
  7653. __Pyx_XDECREF(__pyx_r);
  7654. __Pyx_INCREF(Py_False);
  7655. __pyx_r = Py_False;
  7656. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7657. goto __pyx_L0;
  7658. }
  7659. }
  7660. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7661. /*else*/ {
  7662. __Pyx_XDECREF(__pyx_r);
  7663. __Pyx_INCREF(Py_True);
  7664. __pyx_r = Py_True;
  7665. goto __pyx_L0;
  7666. }
  7667. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  7668. /* function exit code */
  7669. goto __pyx_L0;
  7670. __pyx_L1_error:;
  7671. __Pyx_XDECREF(__pyx_t_1);
  7672. __Pyx_XDECREF(__pyx_t_4);
  7673. if (__Pyx_PyErr_Occurred()) {
  7674. __Pyx_Generator_Replace_StopIteration(0);
  7675. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7676. }
  7677. __pyx_L0:;
  7678. __Pyx_XGIVEREF(__pyx_r);
  7679. #if !CYTHON_USE_EXC_INFO_STACK
  7680. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  7681. #endif
  7682. __pyx_generator->resume_label = -1;
  7683. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  7684. __Pyx_RefNannyFinishContext();
  7685. return __pyx_r;
  7686. }
  7687. /* "fontTools/varLib/iup.py":363
  7688. *
  7689. *
  7690. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  7691. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  7692. * ) -> _DeltaOrNoneSegment:
  7693. */
  7694. 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) {
  7695. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_cur_scope;
  7696. PyObject *__pyx_v_n = NULL;
  7697. PyObject *__pyx_v_forced = NULL;
  7698. PyObject *__pyx_v_k = NULL;
  7699. PyObject *__pyx_v_chain = NULL;
  7700. PyObject *__pyx_v_costs = NULL;
  7701. PyObject *__pyx_v_solution = NULL;
  7702. PyObject *__pyx_v_i = NULL;
  7703. PyObject *__pyx_v_best_sol = NULL;
  7704. PyObject *__pyx_v_best_cost = NULL;
  7705. PyObject *__pyx_v_start = NULL;
  7706. PyObject *__pyx_v_cost = NULL;
  7707. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1 = 0;
  7708. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2 = 0;
  7709. PyObject *__pyx_8genexpr5__pyx_v_i = NULL;
  7710. PyObject *__pyx_8genexpr6__pyx_v_i = NULL;
  7711. PyObject *__pyx_r = NULL;
  7712. __Pyx_RefNannyDeclarations
  7713. Py_ssize_t __pyx_t_1;
  7714. PyObject *__pyx_t_2 = NULL;
  7715. PyObject *__pyx_t_3 = NULL;
  7716. int __pyx_t_4;
  7717. PyObject *__pyx_t_5 = NULL;
  7718. size_t __pyx_t_6;
  7719. PyObject *__pyx_t_7 = NULL;
  7720. PyObject *(*__pyx_t_8)(PyObject *);
  7721. int __pyx_t_9;
  7722. PyObject *(*__pyx_t_10)(PyObject *);
  7723. PyObject *__pyx_t_11 = NULL;
  7724. int __pyx_lineno = 0;
  7725. const char *__pyx_filename = NULL;
  7726. int __pyx_clineno = 0;
  7727. __Pyx_RefNannySetupContext("iup_contour_optimize", 0);
  7728. __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);
  7729. if (unlikely(!__pyx_cur_scope)) {
  7730. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)Py_None);
  7731. __Pyx_INCREF(Py_None);
  7732. __PYX_ERR(0, 363, __pyx_L1_error)
  7733. } else {
  7734. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7735. }
  7736. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  7737. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  7738. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  7739. __Pyx_INCREF(__pyx_v_deltas);
  7740. __Pyx_INCREF(__pyx_v_coords);
  7741. /* "fontTools/varLib/iup.py":373
  7742. * """
  7743. *
  7744. * n = len(deltas) # <<<<<<<<<<<<<<
  7745. *
  7746. * # Get the easy cases out of the way:
  7747. */
  7748. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 373, __pyx_L1_error)
  7749. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
  7750. __Pyx_GOTREF(__pyx_t_2);
  7751. __pyx_v_n = __pyx_t_2;
  7752. __pyx_t_2 = 0;
  7753. /* "fontTools/varLib/iup.py":378
  7754. *
  7755. * # If all are within tolerance distance of 0, encode nothing:
  7756. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7757. * return [None] * n
  7758. *
  7759. */
  7760. __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)
  7761. __Pyx_GOTREF(__pyx_t_2);
  7762. __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
  7763. __Pyx_GOTREF(__pyx_t_3);
  7764. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7765. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  7766. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7767. if (__pyx_t_4) {
  7768. /* "fontTools/varLib/iup.py":379
  7769. * # If all are within tolerance distance of 0, encode nothing:
  7770. * if all(abs(complex(*p)) <= tolerance for p in deltas):
  7771. * return [None] * n # <<<<<<<<<<<<<<
  7772. *
  7773. * # If there's exactly one point, return it:
  7774. */
  7775. __Pyx_XDECREF(__pyx_r);
  7776. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  7777. __Pyx_GOTREF(__pyx_t_3);
  7778. __Pyx_INCREF(Py_None);
  7779. __Pyx_GIVEREF(Py_None);
  7780. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(0, 379, __pyx_L1_error);
  7781. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 379, __pyx_L1_error)
  7782. __Pyx_GOTREF(__pyx_temp);
  7783. __Pyx_DECREF(__pyx_t_3);
  7784. __pyx_t_3 = __pyx_temp;
  7785. }
  7786. __pyx_r = __pyx_t_3;
  7787. __pyx_t_3 = 0;
  7788. goto __pyx_L0;
  7789. /* "fontTools/varLib/iup.py":378
  7790. *
  7791. * # If all are within tolerance distance of 0, encode nothing:
  7792. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7793. * return [None] * n
  7794. *
  7795. */
  7796. }
  7797. /* "fontTools/varLib/iup.py":382
  7798. *
  7799. * # If there's exactly one point, return it:
  7800. * if n == 1: # <<<<<<<<<<<<<<
  7801. * return deltas
  7802. *
  7803. */
  7804. __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)
  7805. if (__pyx_t_4) {
  7806. /* "fontTools/varLib/iup.py":383
  7807. * # If there's exactly one point, return it:
  7808. * if n == 1:
  7809. * return deltas # <<<<<<<<<<<<<<
  7810. *
  7811. * # If all deltas are exactly the same, return just one (the first one):
  7812. */
  7813. __Pyx_XDECREF(__pyx_r);
  7814. __Pyx_INCREF(__pyx_v_deltas);
  7815. __pyx_r = __pyx_v_deltas;
  7816. goto __pyx_L0;
  7817. /* "fontTools/varLib/iup.py":382
  7818. *
  7819. * # If there's exactly one point, return it:
  7820. * if n == 1: # <<<<<<<<<<<<<<
  7821. * return deltas
  7822. *
  7823. */
  7824. }
  7825. /* "fontTools/varLib/iup.py":386
  7826. *
  7827. * # If all deltas are exactly the same, return just one (the first one):
  7828. * d0 = deltas[0] # <<<<<<<<<<<<<<
  7829. * if all(d0 == d for d in deltas):
  7830. * return [d0] + [None] * (n - 1)
  7831. */
  7832. __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)
  7833. __Pyx_GOTREF(__pyx_t_3);
  7834. __Pyx_GIVEREF(__pyx_t_3);
  7835. __pyx_cur_scope->__pyx_v_d0 = __pyx_t_3;
  7836. __pyx_t_3 = 0;
  7837. /* "fontTools/varLib/iup.py":387
  7838. * # If all deltas are exactly the same, return just one (the first one):
  7839. * d0 = deltas[0]
  7840. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7841. * return [d0] + [None] * (n - 1)
  7842. *
  7843. */
  7844. __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)
  7845. __Pyx_GOTREF(__pyx_t_3);
  7846. __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
  7847. __Pyx_GOTREF(__pyx_t_2);
  7848. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7849. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 387, __pyx_L1_error)
  7850. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7851. if (__pyx_t_4) {
  7852. /* "fontTools/varLib/iup.py":388
  7853. * d0 = deltas[0]
  7854. * if all(d0 == d for d in deltas):
  7855. * return [d0] + [None] * (n - 1) # <<<<<<<<<<<<<<
  7856. *
  7857. * # Else, solve the general problem using Dynamic Programming.
  7858. */
  7859. __Pyx_XDECREF(__pyx_r);
  7860. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  7861. __Pyx_GOTREF(__pyx_t_2);
  7862. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_d0);
  7863. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_d0);
  7864. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_d0) != (0)) __PYX_ERR(0, 388, __pyx_L1_error);
  7865. __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)
  7866. __Pyx_GOTREF(__pyx_t_3);
  7867. __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
  7868. __Pyx_GOTREF(__pyx_t_5);
  7869. __Pyx_INCREF(Py_None);
  7870. __Pyx_GIVEREF(Py_None);
  7871. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, Py_None) != (0)) __PYX_ERR(0, 388, __pyx_L1_error);
  7872. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 388, __pyx_L1_error)
  7873. __Pyx_GOTREF(__pyx_temp);
  7874. __Pyx_DECREF(__pyx_t_5);
  7875. __pyx_t_5 = __pyx_temp;
  7876. }
  7877. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7878. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  7879. __Pyx_GOTREF(__pyx_t_3);
  7880. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7881. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7882. __pyx_r = __pyx_t_3;
  7883. __pyx_t_3 = 0;
  7884. goto __pyx_L0;
  7885. /* "fontTools/varLib/iup.py":387
  7886. * # If all deltas are exactly the same, return just one (the first one):
  7887. * d0 = deltas[0]
  7888. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7889. * return [d0] + [None] * (n - 1)
  7890. *
  7891. */
  7892. }
  7893. /* "fontTools/varLib/iup.py":392
  7894. * # Else, solve the general problem using Dynamic Programming.
  7895. *
  7896. * forced = _iup_contour_bound_forced_set(deltas, coords, tolerance) # <<<<<<<<<<<<<<
  7897. * # The _iup_contour_optimize_dp() routine returns the optimal encoding
  7898. * # solution given the constraint that the last point is always encoded.
  7899. */
  7900. __pyx_t_5 = NULL;
  7901. __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)
  7902. __Pyx_GOTREF(__pyx_t_2);
  7903. __pyx_t_6 = 1;
  7904. #if CYTHON_UNPACK_METHODS
  7905. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  7906. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  7907. assert(__pyx_t_5);
  7908. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  7909. __Pyx_INCREF(__pyx_t_5);
  7910. __Pyx_INCREF(__pyx__function);
  7911. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  7912. __pyx_t_6 = 0;
  7913. }
  7914. #endif
  7915. {
  7916. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_deltas, __pyx_v_coords, __pyx_cur_scope->__pyx_v_tolerance};
  7917. __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));
  7918. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7919. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7920. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
  7921. __Pyx_GOTREF(__pyx_t_3);
  7922. }
  7923. __pyx_v_forced = __pyx_t_3;
  7924. __pyx_t_3 = 0;
  7925. /* "fontTools/varLib/iup.py":401
  7926. * # if the font size changes (reduced); that would mean the forced-set
  7927. * # has members it should not have.
  7928. * if forced: # <<<<<<<<<<<<<<
  7929. * # Forced set is non-empty: rotate the contour start point
  7930. * # such that the last point in the list is a forced point.
  7931. */
  7932. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_forced); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
  7933. if (__pyx_t_4) {
  7934. /* "fontTools/varLib/iup.py":404
  7935. * # Forced set is non-empty: rotate the contour start point
  7936. * # such that the last point in the list is a forced point.
  7937. * k = (n - 1) - max(forced) # <<<<<<<<<<<<<<
  7938. * assert k >= 0
  7939. *
  7940. */
  7941. __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)
  7942. __Pyx_GOTREF(__pyx_t_3);
  7943. __pyx_t_5 = NULL;
  7944. __pyx_t_6 = 1;
  7945. {
  7946. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_forced};
  7947. __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));
  7948. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7949. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  7950. __Pyx_GOTREF(__pyx_t_2);
  7951. }
  7952. __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error)
  7953. __Pyx_GOTREF(__pyx_t_5);
  7954. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7955. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7956. __pyx_v_k = __pyx_t_5;
  7957. __pyx_t_5 = 0;
  7958. /* "fontTools/varLib/iup.py":405
  7959. * # such that the last point in the list is a forced point.
  7960. * k = (n - 1) - max(forced)
  7961. * assert k >= 0 # <<<<<<<<<<<<<<
  7962. *
  7963. * deltas = _rot_list(deltas, k)
  7964. */
  7965. #ifndef CYTHON_WITHOUT_ASSERTIONS
  7966. if (unlikely(__pyx_assertions_enabled())) {
  7967. __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)
  7968. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 405, __pyx_L1_error)
  7969. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7970. if (unlikely(!__pyx_t_4)) {
  7971. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  7972. __PYX_ERR(0, 405, __pyx_L1_error)
  7973. }
  7974. }
  7975. #else
  7976. if ((1)); else __PYX_ERR(0, 405, __pyx_L1_error)
  7977. #endif
  7978. /* "fontTools/varLib/iup.py":407
  7979. * assert k >= 0
  7980. *
  7981. * deltas = _rot_list(deltas, k) # <<<<<<<<<<<<<<
  7982. * coords = _rot_list(coords, k)
  7983. * forced = _rot_set(forced, k, n)
  7984. */
  7985. __pyx_t_2 = NULL;
  7986. __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)
  7987. __Pyx_GOTREF(__pyx_t_3);
  7988. __pyx_t_6 = 1;
  7989. #if CYTHON_UNPACK_METHODS
  7990. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  7991. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  7992. assert(__pyx_t_2);
  7993. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7994. __Pyx_INCREF(__pyx_t_2);
  7995. __Pyx_INCREF(__pyx__function);
  7996. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  7997. __pyx_t_6 = 0;
  7998. }
  7999. #endif
  8000. {
  8001. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_deltas, __pyx_v_k};
  8002. __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));
  8003. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8004. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8005. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L1_error)
  8006. __Pyx_GOTREF(__pyx_t_5);
  8007. }
  8008. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_5);
  8009. __pyx_t_5 = 0;
  8010. /* "fontTools/varLib/iup.py":408
  8011. *
  8012. * deltas = _rot_list(deltas, k)
  8013. * coords = _rot_list(coords, k) # <<<<<<<<<<<<<<
  8014. * forced = _rot_set(forced, k, n)
  8015. *
  8016. */
  8017. __pyx_t_3 = NULL;
  8018. __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)
  8019. __Pyx_GOTREF(__pyx_t_2);
  8020. __pyx_t_6 = 1;
  8021. #if CYTHON_UNPACK_METHODS
  8022. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8023. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  8024. assert(__pyx_t_3);
  8025. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8026. __Pyx_INCREF(__pyx_t_3);
  8027. __Pyx_INCREF(__pyx__function);
  8028. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8029. __pyx_t_6 = 0;
  8030. }
  8031. #endif
  8032. {
  8033. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_coords, __pyx_v_k};
  8034. __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));
  8035. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8036. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8037. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error)
  8038. __Pyx_GOTREF(__pyx_t_5);
  8039. }
  8040. __Pyx_DECREF_SET(__pyx_v_coords, __pyx_t_5);
  8041. __pyx_t_5 = 0;
  8042. /* "fontTools/varLib/iup.py":409
  8043. * deltas = _rot_list(deltas, k)
  8044. * coords = _rot_list(coords, k)
  8045. * forced = _rot_set(forced, k, n) # <<<<<<<<<<<<<<
  8046. *
  8047. * # Debugging: Pass a set() instead of forced variable to the next call
  8048. */
  8049. __pyx_t_2 = NULL;
  8050. __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)
  8051. __Pyx_GOTREF(__pyx_t_3);
  8052. __pyx_t_6 = 1;
  8053. #if CYTHON_UNPACK_METHODS
  8054. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  8055. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  8056. assert(__pyx_t_2);
  8057. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8058. __Pyx_INCREF(__pyx_t_2);
  8059. __Pyx_INCREF(__pyx__function);
  8060. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  8061. __pyx_t_6 = 0;
  8062. }
  8063. #endif
  8064. {
  8065. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_forced, __pyx_v_k, __pyx_v_n};
  8066. __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));
  8067. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8068. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8069. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  8070. __Pyx_GOTREF(__pyx_t_5);
  8071. }
  8072. __Pyx_DECREF_SET(__pyx_v_forced, __pyx_t_5);
  8073. __pyx_t_5 = 0;
  8074. /* "fontTools/varLib/iup.py":413
  8075. * # Debugging: Pass a set() instead of forced variable to the next call
  8076. * # to exercise forced-set computation for under-counting.
  8077. * chain, costs = _iup_contour_optimize_dp(deltas, coords, forced, tolerance) # <<<<<<<<<<<<<<
  8078. *
  8079. * # Assemble solution.
  8080. */
  8081. __pyx_t_3 = NULL;
  8082. __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)
  8083. __Pyx_GOTREF(__pyx_t_2);
  8084. __pyx_t_6 = 1;
  8085. #if CYTHON_UNPACK_METHODS
  8086. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8087. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  8088. assert(__pyx_t_3);
  8089. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8090. __Pyx_INCREF(__pyx_t_3);
  8091. __Pyx_INCREF(__pyx__function);
  8092. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8093. __pyx_t_6 = 0;
  8094. }
  8095. #endif
  8096. {
  8097. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_deltas, __pyx_v_coords, __pyx_v_forced, __pyx_cur_scope->__pyx_v_tolerance};
  8098. __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));
  8099. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8100. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8101. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error)
  8102. __Pyx_GOTREF(__pyx_t_5);
  8103. }
  8104. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  8105. PyObject* sequence = __pyx_t_5;
  8106. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8107. if (unlikely(size != 2)) {
  8108. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8109. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8110. __PYX_ERR(0, 413, __pyx_L1_error)
  8111. }
  8112. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8113. if (likely(PyTuple_CheckExact(sequence))) {
  8114. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  8115. __Pyx_INCREF(__pyx_t_2);
  8116. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
  8117. __Pyx_INCREF(__pyx_t_3);
  8118. } else {
  8119. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8120. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8121. __Pyx_XGOTREF(__pyx_t_2);
  8122. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8123. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
  8124. __Pyx_XGOTREF(__pyx_t_3);
  8125. }
  8126. #else
  8127. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8128. __Pyx_GOTREF(__pyx_t_2);
  8129. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
  8130. __Pyx_GOTREF(__pyx_t_3);
  8131. #endif
  8132. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8133. } else {
  8134. Py_ssize_t index = -1;
  8135. __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 413, __pyx_L1_error)
  8136. __Pyx_GOTREF(__pyx_t_7);
  8137. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8138. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  8139. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  8140. __Pyx_GOTREF(__pyx_t_2);
  8141. index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
  8142. __Pyx_GOTREF(__pyx_t_3);
  8143. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 413, __pyx_L1_error)
  8144. __pyx_t_8 = NULL;
  8145. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8146. goto __pyx_L8_unpacking_done;
  8147. __pyx_L7_unpacking_failed:;
  8148. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8149. __pyx_t_8 = NULL;
  8150. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8151. __PYX_ERR(0, 413, __pyx_L1_error)
  8152. __pyx_L8_unpacking_done:;
  8153. }
  8154. __pyx_v_chain = __pyx_t_2;
  8155. __pyx_t_2 = 0;
  8156. __pyx_v_costs = __pyx_t_3;
  8157. __pyx_t_3 = 0;
  8158. /* "fontTools/varLib/iup.py":416
  8159. *
  8160. * # Assemble solution.
  8161. * solution = set() # <<<<<<<<<<<<<<
  8162. * i = n - 1
  8163. * while i is not None:
  8164. */
  8165. __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error)
  8166. __Pyx_GOTREF(__pyx_t_5);
  8167. __pyx_v_solution = ((PyObject*)__pyx_t_5);
  8168. __pyx_t_5 = 0;
  8169. /* "fontTools/varLib/iup.py":417
  8170. * # Assemble solution.
  8171. * solution = set()
  8172. * i = n - 1 # <<<<<<<<<<<<<<
  8173. * while i is not None:
  8174. * solution.add(i)
  8175. */
  8176. __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)
  8177. __Pyx_GOTREF(__pyx_t_5);
  8178. __pyx_v_i = __pyx_t_5;
  8179. __pyx_t_5 = 0;
  8180. /* "fontTools/varLib/iup.py":418
  8181. * solution = set()
  8182. * i = n - 1
  8183. * while i is not None: # <<<<<<<<<<<<<<
  8184. * solution.add(i)
  8185. * i = chain[i]
  8186. */
  8187. while (1) {
  8188. __pyx_t_4 = (__pyx_v_i != Py_None);
  8189. if (!__pyx_t_4) break;
  8190. /* "fontTools/varLib/iup.py":419
  8191. * i = n - 1
  8192. * while i is not None:
  8193. * solution.add(i) # <<<<<<<<<<<<<<
  8194. * i = chain[i]
  8195. * solution.remove(-1)
  8196. */
  8197. __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)
  8198. /* "fontTools/varLib/iup.py":420
  8199. * while i is not None:
  8200. * solution.add(i)
  8201. * i = chain[i] # <<<<<<<<<<<<<<
  8202. * solution.remove(-1)
  8203. *
  8204. */
  8205. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error)
  8206. __Pyx_GOTREF(__pyx_t_5);
  8207. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_5);
  8208. __pyx_t_5 = 0;
  8209. }
  8210. /* "fontTools/varLib/iup.py":421
  8211. * solution.add(i)
  8212. * i = chain[i]
  8213. * solution.remove(-1) # <<<<<<<<<<<<<<
  8214. *
  8215. * # if not forced <= solution:
  8216. */
  8217. __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)
  8218. /* "fontTools/varLib/iup.py":427
  8219. * # print("deltas", deltas)
  8220. * # print("len", len(deltas))
  8221. * assert forced <= solution, (forced, solution) # <<<<<<<<<<<<<<
  8222. *
  8223. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8224. */
  8225. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8226. if (unlikely(__pyx_assertions_enabled())) {
  8227. __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)
  8228. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 427, __pyx_L1_error)
  8229. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8230. if (unlikely(!__pyx_t_4)) {
  8231. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  8232. __Pyx_GOTREF(__pyx_t_5);
  8233. __Pyx_INCREF(__pyx_v_forced);
  8234. __Pyx_GIVEREF(__pyx_v_forced);
  8235. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_forced) != (0)) __PYX_ERR(0, 427, __pyx_L1_error);
  8236. __Pyx_INCREF(__pyx_v_solution);
  8237. __Pyx_GIVEREF(__pyx_v_solution);
  8238. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_solution) != (0)) __PYX_ERR(0, 427, __pyx_L1_error);
  8239. __pyx_t_3 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
  8240. __Pyx_GOTREF(__pyx_t_3);
  8241. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8242. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
  8243. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8244. __PYX_ERR(0, 427, __pyx_L1_error)
  8245. }
  8246. }
  8247. #else
  8248. if ((1)); else __PYX_ERR(0, 427, __pyx_L1_error)
  8249. #endif
  8250. /* "fontTools/varLib/iup.py":429
  8251. * assert forced <= solution, (forced, solution)
  8252. *
  8253. * deltas = [deltas[i] if i in solution else None for i in range(n)] # <<<<<<<<<<<<<<
  8254. *
  8255. * deltas = _rot_list(deltas, -k)
  8256. */
  8257. { /* enter inner scope */
  8258. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L13_error)
  8259. __Pyx_GOTREF(__pyx_t_3);
  8260. __pyx_t_2 = NULL;
  8261. __pyx_t_6 = 1;
  8262. {
  8263. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_n};
  8264. __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));
  8265. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8266. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L13_error)
  8267. __Pyx_GOTREF(__pyx_t_5);
  8268. }
  8269. __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L13_error)
  8270. __Pyx_GOTREF(__pyx_t_2);
  8271. __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)
  8272. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8273. for (;;) {
  8274. {
  8275. __pyx_t_5 = __pyx_t_10(__pyx_t_2);
  8276. if (unlikely(!__pyx_t_5)) {
  8277. PyObject* exc_type = PyErr_Occurred();
  8278. if (exc_type) {
  8279. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 429, __pyx_L13_error)
  8280. PyErr_Clear();
  8281. }
  8282. break;
  8283. }
  8284. }
  8285. __Pyx_GOTREF(__pyx_t_5);
  8286. __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_i, __pyx_t_5);
  8287. __pyx_t_5 = 0;
  8288. __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)
  8289. if (__pyx_t_4) {
  8290. __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)
  8291. __Pyx_GOTREF(__pyx_t_7);
  8292. __pyx_t_5 = __pyx_t_7;
  8293. __pyx_t_7 = 0;
  8294. } else {
  8295. __Pyx_INCREF(Py_None);
  8296. __pyx_t_5 = Py_None;
  8297. }
  8298. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 429, __pyx_L13_error)
  8299. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8300. }
  8301. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8302. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8303. goto __pyx_L17_exit_scope;
  8304. __pyx_L13_error:;
  8305. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8306. goto __pyx_L1_error;
  8307. __pyx_L17_exit_scope:;
  8308. } /* exit inner scope */
  8309. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8310. __pyx_t_3 = 0;
  8311. /* "fontTools/varLib/iup.py":431
  8312. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8313. *
  8314. * deltas = _rot_list(deltas, -k) # <<<<<<<<<<<<<<
  8315. * else:
  8316. * # Repeat the contour an extra time, solve the new case, then look for solutions of the
  8317. */
  8318. __pyx_t_2 = NULL;
  8319. __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)
  8320. __Pyx_GOTREF(__pyx_t_5);
  8321. __pyx_t_7 = PyNumber_Negative(__pyx_v_k); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
  8322. __Pyx_GOTREF(__pyx_t_7);
  8323. __pyx_t_6 = 1;
  8324. #if CYTHON_UNPACK_METHODS
  8325. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8326. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
  8327. assert(__pyx_t_2);
  8328. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8329. __Pyx_INCREF(__pyx_t_2);
  8330. __Pyx_INCREF(__pyx__function);
  8331. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  8332. __pyx_t_6 = 0;
  8333. }
  8334. #endif
  8335. {
  8336. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_deltas, __pyx_t_7};
  8337. __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));
  8338. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8339. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8340. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8341. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error)
  8342. __Pyx_GOTREF(__pyx_t_3);
  8343. }
  8344. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8345. __pyx_t_3 = 0;
  8346. /* "fontTools/varLib/iup.py":401
  8347. * # if the font size changes (reduced); that would mean the forced-set
  8348. * # has members it should not have.
  8349. * if forced: # <<<<<<<<<<<<<<
  8350. * # Forced set is non-empty: rotate the contour start point
  8351. * # such that the last point in the list is a forced point.
  8352. */
  8353. goto __pyx_L6;
  8354. }
  8355. /* "fontTools/varLib/iup.py":436
  8356. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8357. * # this always produces the optimal solution...
  8358. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8359. * deltas + deltas, coords + coords, forced, tolerance, n
  8360. * )
  8361. */
  8362. /*else*/ {
  8363. __pyx_t_5 = NULL;
  8364. __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)
  8365. __Pyx_GOTREF(__pyx_t_7);
  8366. /* "fontTools/varLib/iup.py":437
  8367. * # this always produces the optimal solution...
  8368. * chain, costs = _iup_contour_optimize_dp(
  8369. * deltas + deltas, coords + coords, forced, tolerance, n # <<<<<<<<<<<<<<
  8370. * )
  8371. * best_sol, best_cost = None, n + 1
  8372. */
  8373. __pyx_t_2 = PyNumber_Add(__pyx_v_deltas, __pyx_v_deltas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error)
  8374. __Pyx_GOTREF(__pyx_t_2);
  8375. __pyx_t_11 = PyNumber_Add(__pyx_v_coords, __pyx_v_coords); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 437, __pyx_L1_error)
  8376. __Pyx_GOTREF(__pyx_t_11);
  8377. __pyx_t_6 = 1;
  8378. #if CYTHON_UNPACK_METHODS
  8379. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  8380. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
  8381. assert(__pyx_t_5);
  8382. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  8383. __Pyx_INCREF(__pyx_t_5);
  8384. __Pyx_INCREF(__pyx__function);
  8385. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  8386. __pyx_t_6 = 0;
  8387. }
  8388. #endif
  8389. {
  8390. 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};
  8391. __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));
  8392. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  8393. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8394. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8395. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8396. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
  8397. __Pyx_GOTREF(__pyx_t_3);
  8398. }
  8399. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  8400. PyObject* sequence = __pyx_t_3;
  8401. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8402. if (unlikely(size != 2)) {
  8403. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8404. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8405. __PYX_ERR(0, 436, __pyx_L1_error)
  8406. }
  8407. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8408. if (likely(PyTuple_CheckExact(sequence))) {
  8409. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  8410. __Pyx_INCREF(__pyx_t_7);
  8411. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
  8412. __Pyx_INCREF(__pyx_t_11);
  8413. } else {
  8414. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8415. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L1_error)
  8416. __Pyx_XGOTREF(__pyx_t_7);
  8417. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8418. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 436, __pyx_L1_error)
  8419. __Pyx_XGOTREF(__pyx_t_11);
  8420. }
  8421. #else
  8422. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L1_error)
  8423. __Pyx_GOTREF(__pyx_t_7);
  8424. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 436, __pyx_L1_error)
  8425. __Pyx_GOTREF(__pyx_t_11);
  8426. #endif
  8427. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8428. } else {
  8429. Py_ssize_t index = -1;
  8430. __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error)
  8431. __Pyx_GOTREF(__pyx_t_2);
  8432. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8433. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
  8434. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
  8435. __Pyx_GOTREF(__pyx_t_7);
  8436. index = 1; __pyx_t_11 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed;
  8437. __Pyx_GOTREF(__pyx_t_11);
  8438. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 436, __pyx_L1_error)
  8439. __pyx_t_8 = NULL;
  8440. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8441. goto __pyx_L19_unpacking_done;
  8442. __pyx_L18_unpacking_failed:;
  8443. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8444. __pyx_t_8 = NULL;
  8445. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8446. __PYX_ERR(0, 436, __pyx_L1_error)
  8447. __pyx_L19_unpacking_done:;
  8448. }
  8449. /* "fontTools/varLib/iup.py":436
  8450. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8451. * # this always produces the optimal solution...
  8452. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8453. * deltas + deltas, coords + coords, forced, tolerance, n
  8454. * )
  8455. */
  8456. __pyx_v_chain = __pyx_t_7;
  8457. __pyx_t_7 = 0;
  8458. __pyx_v_costs = __pyx_t_11;
  8459. __pyx_t_11 = 0;
  8460. /* "fontTools/varLib/iup.py":439
  8461. * deltas + deltas, coords + coords, forced, tolerance, n
  8462. * )
  8463. * best_sol, best_cost = None, n + 1 # <<<<<<<<<<<<<<
  8464. *
  8465. * for start in range(n - 1, len(costs) - 1):
  8466. */
  8467. __pyx_t_3 = Py_None;
  8468. __Pyx_INCREF(__pyx_t_3);
  8469. __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)
  8470. __Pyx_GOTREF(__pyx_t_11);
  8471. __pyx_v_best_sol = ((PyObject*)__pyx_t_3);
  8472. __pyx_t_3 = 0;
  8473. __pyx_v_best_cost = __pyx_t_11;
  8474. __pyx_t_11 = 0;
  8475. /* "fontTools/varLib/iup.py":441
  8476. * best_sol, best_cost = None, n + 1
  8477. *
  8478. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  8479. * # Assemble solution.
  8480. * solution = set()
  8481. */
  8482. __pyx_t_3 = NULL;
  8483. __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)
  8484. __Pyx_GOTREF(__pyx_t_7);
  8485. __pyx_t_1 = PyObject_Length(__pyx_v_costs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 441, __pyx_L1_error)
  8486. __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_1 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  8487. __Pyx_GOTREF(__pyx_t_2);
  8488. __pyx_t_6 = 1;
  8489. {
  8490. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_2};
  8491. __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));
  8492. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8493. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8494. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8495. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 441, __pyx_L1_error)
  8496. __Pyx_GOTREF(__pyx_t_11);
  8497. }
  8498. __pyx_t_2 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  8499. __Pyx_GOTREF(__pyx_t_2);
  8500. __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)
  8501. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8502. for (;;) {
  8503. {
  8504. __pyx_t_11 = __pyx_t_10(__pyx_t_2);
  8505. if (unlikely(!__pyx_t_11)) {
  8506. PyObject* exc_type = PyErr_Occurred();
  8507. if (exc_type) {
  8508. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 441, __pyx_L1_error)
  8509. PyErr_Clear();
  8510. }
  8511. break;
  8512. }
  8513. }
  8514. __Pyx_GOTREF(__pyx_t_11);
  8515. __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_11);
  8516. __pyx_t_11 = 0;
  8517. /* "fontTools/varLib/iup.py":443
  8518. * for start in range(n - 1, len(costs) - 1):
  8519. * # Assemble solution.
  8520. * solution = set() # <<<<<<<<<<<<<<
  8521. * i = start
  8522. * while i > start - n:
  8523. */
  8524. __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 443, __pyx_L1_error)
  8525. __Pyx_GOTREF(__pyx_t_11);
  8526. __Pyx_XDECREF_SET(__pyx_v_solution, ((PyObject*)__pyx_t_11));
  8527. __pyx_t_11 = 0;
  8528. /* "fontTools/varLib/iup.py":444
  8529. * # Assemble solution.
  8530. * solution = set()
  8531. * i = start # <<<<<<<<<<<<<<
  8532. * while i > start - n:
  8533. * solution.add(i % n)
  8534. */
  8535. __Pyx_INCREF(__pyx_v_start);
  8536. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_v_start);
  8537. /* "fontTools/varLib/iup.py":445
  8538. * solution = set()
  8539. * i = start
  8540. * while i > start - n: # <<<<<<<<<<<<<<
  8541. * solution.add(i % n)
  8542. * i = chain[i]
  8543. */
  8544. while (1) {
  8545. __pyx_t_11 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
  8546. __Pyx_GOTREF(__pyx_t_11);
  8547. __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)
  8548. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8549. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 445, __pyx_L1_error)
  8550. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8551. if (!__pyx_t_4) break;
  8552. /* "fontTools/varLib/iup.py":446
  8553. * i = start
  8554. * while i > start - n:
  8555. * solution.add(i % n) # <<<<<<<<<<<<<<
  8556. * i = chain[i]
  8557. * if i == start - n:
  8558. */
  8559. __pyx_t_7 = PyNumber_Remainder(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error)
  8560. __Pyx_GOTREF(__pyx_t_7);
  8561. __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)
  8562. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8563. /* "fontTools/varLib/iup.py":447
  8564. * while i > start - n:
  8565. * solution.add(i % n)
  8566. * i = chain[i] # <<<<<<<<<<<<<<
  8567. * if i == start - n:
  8568. * cost = costs[start] - costs[start - n]
  8569. */
  8570. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error)
  8571. __Pyx_GOTREF(__pyx_t_7);
  8572. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_7);
  8573. __pyx_t_7 = 0;
  8574. }
  8575. /* "fontTools/varLib/iup.py":448
  8576. * solution.add(i % n)
  8577. * i = chain[i]
  8578. * if i == start - n: # <<<<<<<<<<<<<<
  8579. * cost = costs[start] - costs[start - n]
  8580. * if cost <= best_cost:
  8581. */
  8582. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error)
  8583. __Pyx_GOTREF(__pyx_t_7);
  8584. __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)
  8585. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8586. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 448, __pyx_L1_error)
  8587. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8588. if (__pyx_t_4) {
  8589. /* "fontTools/varLib/iup.py":449
  8590. * i = chain[i]
  8591. * if i == start - n:
  8592. * cost = costs[start] - costs[start - n] # <<<<<<<<<<<<<<
  8593. * if cost <= best_cost:
  8594. * best_sol, best_cost = solution, cost
  8595. */
  8596. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 449, __pyx_L1_error)
  8597. __Pyx_GOTREF(__pyx_t_11);
  8598. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error)
  8599. __Pyx_GOTREF(__pyx_t_7);
  8600. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
  8601. __Pyx_GOTREF(__pyx_t_3);
  8602. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8603. __pyx_t_7 = PyNumber_Subtract(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error)
  8604. __Pyx_GOTREF(__pyx_t_7);
  8605. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  8606. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8607. __Pyx_XDECREF_SET(__pyx_v_cost, __pyx_t_7);
  8608. __pyx_t_7 = 0;
  8609. /* "fontTools/varLib/iup.py":450
  8610. * if i == start - n:
  8611. * cost = costs[start] - costs[start - n]
  8612. * if cost <= best_cost: # <<<<<<<<<<<<<<
  8613. * best_sol, best_cost = solution, cost
  8614. *
  8615. */
  8616. __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)
  8617. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 450, __pyx_L1_error)
  8618. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8619. if (__pyx_t_4) {
  8620. /* "fontTools/varLib/iup.py":451
  8621. * cost = costs[start] - costs[start - n]
  8622. * if cost <= best_cost:
  8623. * best_sol, best_cost = solution, cost # <<<<<<<<<<<<<<
  8624. *
  8625. * # if not forced <= best_sol:
  8626. */
  8627. __pyx_t_7 = __pyx_v_solution;
  8628. __Pyx_INCREF(__pyx_t_7);
  8629. __pyx_t_3 = __pyx_v_cost;
  8630. __Pyx_INCREF(__pyx_t_3);
  8631. __Pyx_DECREF_SET(__pyx_v_best_sol, ((PyObject*)__pyx_t_7));
  8632. __pyx_t_7 = 0;
  8633. __Pyx_DECREF_SET(__pyx_v_best_cost, __pyx_t_3);
  8634. __pyx_t_3 = 0;
  8635. /* "fontTools/varLib/iup.py":450
  8636. * if i == start - n:
  8637. * cost = costs[start] - costs[start - n]
  8638. * if cost <= best_cost: # <<<<<<<<<<<<<<
  8639. * best_sol, best_cost = solution, cost
  8640. *
  8641. */
  8642. }
  8643. /* "fontTools/varLib/iup.py":448
  8644. * solution.add(i % n)
  8645. * i = chain[i]
  8646. * if i == start - n: # <<<<<<<<<<<<<<
  8647. * cost = costs[start] - costs[start - n]
  8648. * if cost <= best_cost:
  8649. */
  8650. }
  8651. /* "fontTools/varLib/iup.py":441
  8652. * best_sol, best_cost = None, n + 1
  8653. *
  8654. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  8655. * # Assemble solution.
  8656. * solution = set()
  8657. */
  8658. }
  8659. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8660. /* "fontTools/varLib/iup.py":457
  8661. * # print("deltas", deltas)
  8662. * # print("len", len(deltas))
  8663. * assert forced <= best_sol, (forced, best_sol) # <<<<<<<<<<<<<<
  8664. *
  8665. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  8666. */
  8667. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8668. if (unlikely(__pyx_assertions_enabled())) {
  8669. __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)
  8670. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 457, __pyx_L1_error)
  8671. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8672. if (unlikely(!__pyx_t_4)) {
  8673. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
  8674. __Pyx_GOTREF(__pyx_t_2);
  8675. __Pyx_INCREF(__pyx_v_forced);
  8676. __Pyx_GIVEREF(__pyx_v_forced);
  8677. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_forced) != (0)) __PYX_ERR(0, 457, __pyx_L1_error);
  8678. __Pyx_INCREF(__pyx_v_best_sol);
  8679. __Pyx_GIVEREF(__pyx_v_best_sol);
  8680. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_best_sol) != (0)) __PYX_ERR(0, 457, __pyx_L1_error);
  8681. __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error)
  8682. __Pyx_GOTREF(__pyx_t_3);
  8683. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8684. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), __pyx_t_3, 0, 0);
  8685. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8686. __PYX_ERR(0, 457, __pyx_L1_error)
  8687. }
  8688. }
  8689. #else
  8690. if ((1)); else __PYX_ERR(0, 457, __pyx_L1_error)
  8691. #endif
  8692. /* "fontTools/varLib/iup.py":459
  8693. * assert forced <= best_sol, (forced, best_sol)
  8694. *
  8695. * deltas = [deltas[i] if i in best_sol else None for i in range(n)] # <<<<<<<<<<<<<<
  8696. *
  8697. * return deltas
  8698. */
  8699. { /* enter inner scope */
  8700. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L29_error)
  8701. __Pyx_GOTREF(__pyx_t_3);
  8702. __pyx_t_7 = NULL;
  8703. __pyx_t_6 = 1;
  8704. {
  8705. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_n};
  8706. __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));
  8707. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  8708. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L29_error)
  8709. __Pyx_GOTREF(__pyx_t_2);
  8710. }
  8711. __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 459, __pyx_L29_error)
  8712. __Pyx_GOTREF(__pyx_t_7);
  8713. __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)
  8714. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8715. for (;;) {
  8716. {
  8717. __pyx_t_2 = __pyx_t_10(__pyx_t_7);
  8718. if (unlikely(!__pyx_t_2)) {
  8719. PyObject* exc_type = PyErr_Occurred();
  8720. if (exc_type) {
  8721. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 459, __pyx_L29_error)
  8722. PyErr_Clear();
  8723. }
  8724. break;
  8725. }
  8726. }
  8727. __Pyx_GOTREF(__pyx_t_2);
  8728. __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_i, __pyx_t_2);
  8729. __pyx_t_2 = 0;
  8730. if (unlikely(__pyx_v_best_sol == Py_None)) {
  8731. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  8732. __PYX_ERR(0, 459, __pyx_L29_error)
  8733. }
  8734. __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)
  8735. if (__pyx_t_4) {
  8736. __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)
  8737. __Pyx_GOTREF(__pyx_t_11);
  8738. __pyx_t_2 = __pyx_t_11;
  8739. __pyx_t_11 = 0;
  8740. } else {
  8741. __Pyx_INCREF(Py_None);
  8742. __pyx_t_2 = Py_None;
  8743. }
  8744. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 459, __pyx_L29_error)
  8745. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8746. }
  8747. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8748. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  8749. goto __pyx_L33_exit_scope;
  8750. __pyx_L29_error:;
  8751. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  8752. goto __pyx_L1_error;
  8753. __pyx_L33_exit_scope:;
  8754. } /* exit inner scope */
  8755. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8756. __pyx_t_3 = 0;
  8757. }
  8758. __pyx_L6:;
  8759. /* "fontTools/varLib/iup.py":461
  8760. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  8761. *
  8762. * return deltas # <<<<<<<<<<<<<<
  8763. *
  8764. *
  8765. */
  8766. __Pyx_XDECREF(__pyx_r);
  8767. __Pyx_INCREF(__pyx_v_deltas);
  8768. __pyx_r = __pyx_v_deltas;
  8769. goto __pyx_L0;
  8770. /* "fontTools/varLib/iup.py":363
  8771. *
  8772. *
  8773. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  8774. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  8775. * ) -> _DeltaOrNoneSegment:
  8776. */
  8777. /* function exit code */
  8778. __pyx_L1_error:;
  8779. __Pyx_XDECREF(__pyx_t_2);
  8780. __Pyx_XDECREF(__pyx_t_3);
  8781. __Pyx_XDECREF(__pyx_t_5);
  8782. __Pyx_XDECREF(__pyx_t_7);
  8783. __Pyx_XDECREF(__pyx_t_11);
  8784. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8785. __pyx_r = NULL;
  8786. __pyx_L0:;
  8787. __Pyx_XDECREF(__pyx_v_n);
  8788. __Pyx_XDECREF(__pyx_v_forced);
  8789. __Pyx_XDECREF(__pyx_v_k);
  8790. __Pyx_XDECREF(__pyx_v_chain);
  8791. __Pyx_XDECREF(__pyx_v_costs);
  8792. __Pyx_XDECREF(__pyx_v_solution);
  8793. __Pyx_XDECREF(__pyx_v_i);
  8794. __Pyx_XDECREF(__pyx_v_best_sol);
  8795. __Pyx_XDECREF(__pyx_v_best_cost);
  8796. __Pyx_XDECREF(__pyx_v_start);
  8797. __Pyx_XDECREF(__pyx_v_cost);
  8798. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1);
  8799. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2);
  8800. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i);
  8801. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i);
  8802. __Pyx_XDECREF(__pyx_v_deltas);
  8803. __Pyx_XDECREF(__pyx_v_coords);
  8804. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  8805. __Pyx_XGIVEREF(__pyx_r);
  8806. __Pyx_RefNannyFinishContext();
  8807. return __pyx_r;
  8808. }
  8809. /* "fontTools/varLib/iup.py":464
  8810. *
  8811. *
  8812. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  8813. * deltas: _DeltaSegment,
  8814. * coords: _PointSegment,
  8815. */
  8816. /* Python wrapper */
  8817. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize(PyObject *__pyx_self,
  8818. #if CYTHON_METH_FASTCALL
  8819. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8820. #else
  8821. PyObject *__pyx_args, PyObject *__pyx_kwds
  8822. #endif
  8823. ); /*proto*/
  8824. 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.");
  8825. 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};
  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. ) {
  8833. PyObject *__pyx_v_deltas = 0;
  8834. PyObject *__pyx_v_coords = 0;
  8835. PyObject *__pyx_v_ends = 0;
  8836. PyObject *__pyx_v_tolerance = 0;
  8837. #if !CYTHON_METH_FASTCALL
  8838. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  8839. #endif
  8840. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  8841. PyObject* values[4] = {0,0,0,0};
  8842. int __pyx_lineno = 0;
  8843. const char *__pyx_filename = NULL;
  8844. int __pyx_clineno = 0;
  8845. PyObject *__pyx_r = 0;
  8846. __Pyx_RefNannyDeclarations
  8847. __Pyx_RefNannySetupContext("iup_delta_optimize (wrapper)", 0);
  8848. #if !CYTHON_METH_FASTCALL
  8849. #if CYTHON_ASSUME_SAFE_SIZE
  8850. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  8851. #else
  8852. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  8853. #endif
  8854. #endif
  8855. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  8856. {
  8857. 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};
  8858. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  8859. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 464, __pyx_L3_error)
  8860. if (__pyx_kwds_len > 0) {
  8861. switch (__pyx_nargs) {
  8862. case 4:
  8863. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8864. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
  8865. CYTHON_FALLTHROUGH;
  8866. case 3:
  8867. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8868. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
  8869. CYTHON_FALLTHROUGH;
  8870. case 2:
  8871. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8872. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
  8873. CYTHON_FALLTHROUGH;
  8874. case 1:
  8875. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8876. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
  8877. CYTHON_FALLTHROUGH;
  8878. case 0: break;
  8879. default: goto __pyx_L5_argtuple_error;
  8880. }
  8881. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  8882. 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)
  8883. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  8884. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  8885. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, i); __PYX_ERR(0, 464, __pyx_L3_error) }
  8886. }
  8887. } else {
  8888. switch (__pyx_nargs) {
  8889. case 4:
  8890. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8891. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 464, __pyx_L3_error)
  8892. CYTHON_FALLTHROUGH;
  8893. case 3:
  8894. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8895. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 464, __pyx_L3_error)
  8896. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8897. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 464, __pyx_L3_error)
  8898. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8899. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 464, __pyx_L3_error)
  8900. break;
  8901. default: goto __pyx_L5_argtuple_error;
  8902. }
  8903. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_0)));
  8904. }
  8905. __pyx_v_deltas = values[0];
  8906. __pyx_v_coords = values[1];
  8907. __pyx_v_ends = values[2];
  8908. __pyx_v_tolerance = values[3];
  8909. }
  8910. goto __pyx_L6_skip;
  8911. __pyx_L5_argtuple_error:;
  8912. __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 464, __pyx_L3_error)
  8913. __pyx_L6_skip:;
  8914. goto __pyx_L4_argument_unpacking_done;
  8915. __pyx_L3_error:;
  8916. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8917. Py_XDECREF(values[__pyx_temp]);
  8918. }
  8919. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8920. __Pyx_RefNannyFinishContext();
  8921. return NULL;
  8922. __pyx_L4_argument_unpacking_done:;
  8923. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_14iup_delta_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends, __pyx_v_tolerance);
  8924. /* function exit code */
  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_RefNannyFinishContext();
  8929. return __pyx_r;
  8930. }
  8931. 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) {
  8932. PyObject *__pyx_v_n = NULL;
  8933. PyObject *__pyx_v_out = NULL;
  8934. PyObject *__pyx_v_start = NULL;
  8935. PyObject *__pyx_v_end = NULL;
  8936. PyObject *__pyx_v_contour = NULL;
  8937. PyObject *__pyx_r = NULL;
  8938. __Pyx_RefNannyDeclarations
  8939. int __pyx_t_1;
  8940. PyObject *__pyx_t_2 = NULL;
  8941. PyObject *__pyx_t_3 = NULL;
  8942. int __pyx_t_4;
  8943. Py_ssize_t __pyx_t_5;
  8944. PyObject *__pyx_t_6 = NULL;
  8945. PyObject *__pyx_t_7 = NULL;
  8946. PyObject *__pyx_t_8 = NULL;
  8947. PyObject *(*__pyx_t_9)(PyObject *);
  8948. PyObject *__pyx_t_10 = NULL;
  8949. PyObject *__pyx_t_11 = NULL;
  8950. size_t __pyx_t_12;
  8951. Py_ssize_t __pyx_t_13;
  8952. int __pyx_t_14;
  8953. int __pyx_lineno = 0;
  8954. const char *__pyx_filename = NULL;
  8955. int __pyx_clineno = 0;
  8956. __Pyx_RefNannySetupContext("iup_delta_optimize", 0);
  8957. __Pyx_INCREF(__pyx_v_ends);
  8958. /* "fontTools/varLib/iup.py":477
  8959. * the input delta.
  8960. * """
  8961. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  8962. * n = len(coords)
  8963. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  8964. */
  8965. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8966. if (unlikely(__pyx_assertions_enabled())) {
  8967. __pyx_t_2 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
  8968. __Pyx_GOTREF(__pyx_t_2);
  8969. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8970. __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)
  8971. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8972. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8973. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8974. if (__pyx_t_4) {
  8975. } else {
  8976. __pyx_t_1 = __pyx_t_4;
  8977. goto __pyx_L3_bool_binop_done;
  8978. }
  8979. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 477, __pyx_L1_error)
  8980. __pyx_t_3 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  8981. __Pyx_GOTREF(__pyx_t_3);
  8982. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  8983. if (__pyx_t_4) {
  8984. __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)
  8985. __Pyx_GOTREF(__pyx_t_6);
  8986. __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)
  8987. __Pyx_GOTREF(__pyx_t_7);
  8988. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8989. __pyx_t_2 = __pyx_t_7;
  8990. __pyx_t_7 = 0;
  8991. } else {
  8992. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  8993. __pyx_t_2 = __pyx_mstate_global->__pyx_int_0;
  8994. }
  8995. __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)
  8996. __Pyx_GOTREF(__pyx_t_7);
  8997. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8998. __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)
  8999. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9000. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9001. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 477, __pyx_L1_error)
  9002. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9003. __pyx_t_1 = __pyx_t_4;
  9004. __pyx_L3_bool_binop_done:;
  9005. if (unlikely(!__pyx_t_1)) {
  9006. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  9007. __PYX_ERR(0, 477, __pyx_L1_error)
  9008. }
  9009. }
  9010. #else
  9011. if ((1)); else __PYX_ERR(0, 477, __pyx_L1_error)
  9012. #endif
  9013. /* "fontTools/varLib/iup.py":478
  9014. * """
  9015. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9016. * n = len(coords) # <<<<<<<<<<<<<<
  9017. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9018. * out = []
  9019. */
  9020. __pyx_t_5 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 478, __pyx_L1_error)
  9021. __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
  9022. __Pyx_GOTREF(__pyx_t_2);
  9023. __pyx_v_n = __pyx_t_2;
  9024. __pyx_t_2 = 0;
  9025. /* "fontTools/varLib/iup.py":479
  9026. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9027. * n = len(coords)
  9028. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  9029. * out = []
  9030. * start = 0
  9031. */
  9032. __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)
  9033. __Pyx_GOTREF(__pyx_t_2);
  9034. __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)
  9035. __Pyx_GOTREF(__pyx_t_7);
  9036. __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)
  9037. __Pyx_GOTREF(__pyx_t_3);
  9038. __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)
  9039. __Pyx_GOTREF(__pyx_t_6);
  9040. __pyx_t_8 = PyList_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error)
  9041. __Pyx_GOTREF(__pyx_t_8);
  9042. __Pyx_GIVEREF(__pyx_t_2);
  9043. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9044. __Pyx_GIVEREF(__pyx_t_7);
  9045. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9046. __Pyx_GIVEREF(__pyx_t_3);
  9047. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9048. __Pyx_GIVEREF(__pyx_t_6);
  9049. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 479, __pyx_L1_error);
  9050. __pyx_t_2 = 0;
  9051. __pyx_t_7 = 0;
  9052. __pyx_t_3 = 0;
  9053. __pyx_t_6 = 0;
  9054. __pyx_t_6 = PyNumber_Add(__pyx_v_ends, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error)
  9055. __Pyx_GOTREF(__pyx_t_6);
  9056. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9057. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_6);
  9058. __pyx_t_6 = 0;
  9059. /* "fontTools/varLib/iup.py":480
  9060. * n = len(coords)
  9061. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9062. * out = [] # <<<<<<<<<<<<<<
  9063. * start = 0
  9064. * for end in ends:
  9065. */
  9066. __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
  9067. __Pyx_GOTREF(__pyx_t_6);
  9068. __pyx_v_out = ((PyObject*)__pyx_t_6);
  9069. __pyx_t_6 = 0;
  9070. /* "fontTools/varLib/iup.py":481
  9071. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9072. * out = []
  9073. * start = 0 # <<<<<<<<<<<<<<
  9074. * for end in ends:
  9075. * contour = iup_contour_optimize(
  9076. */
  9077. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  9078. __pyx_v_start = __pyx_mstate_global->__pyx_int_0;
  9079. /* "fontTools/varLib/iup.py":482
  9080. * out = []
  9081. * start = 0
  9082. * for end in ends: # <<<<<<<<<<<<<<
  9083. * contour = iup_contour_optimize(
  9084. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9085. */
  9086. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  9087. __pyx_t_6 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_6);
  9088. __pyx_t_5 = 0;
  9089. __pyx_t_9 = NULL;
  9090. } else {
  9091. __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error)
  9092. __Pyx_GOTREF(__pyx_t_6);
  9093. __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)
  9094. }
  9095. for (;;) {
  9096. if (likely(!__pyx_t_9)) {
  9097. if (likely(PyList_CheckExact(__pyx_t_6))) {
  9098. {
  9099. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  9100. #if !CYTHON_ASSUME_SAFE_SIZE
  9101. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 482, __pyx_L1_error)
  9102. #endif
  9103. if (__pyx_t_5 >= __pyx_temp) break;
  9104. }
  9105. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference);
  9106. ++__pyx_t_5;
  9107. } else {
  9108. {
  9109. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  9110. #if !CYTHON_ASSUME_SAFE_SIZE
  9111. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 482, __pyx_L1_error)
  9112. #endif
  9113. if (__pyx_t_5 >= __pyx_temp) break;
  9114. }
  9115. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9116. __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5));
  9117. #else
  9118. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_5);
  9119. #endif
  9120. ++__pyx_t_5;
  9121. }
  9122. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error)
  9123. } else {
  9124. __pyx_t_8 = __pyx_t_9(__pyx_t_6);
  9125. if (unlikely(!__pyx_t_8)) {
  9126. PyObject* exc_type = PyErr_Occurred();
  9127. if (exc_type) {
  9128. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 482, __pyx_L1_error)
  9129. PyErr_Clear();
  9130. }
  9131. break;
  9132. }
  9133. }
  9134. __Pyx_GOTREF(__pyx_t_8);
  9135. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_8);
  9136. __pyx_t_8 = 0;
  9137. /* "fontTools/varLib/iup.py":483
  9138. * start = 0
  9139. * for end in ends:
  9140. * contour = iup_contour_optimize( # <<<<<<<<<<<<<<
  9141. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9142. * )
  9143. */
  9144. __pyx_t_3 = NULL;
  9145. __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)
  9146. __Pyx_GOTREF(__pyx_t_7);
  9147. /* "fontTools/varLib/iup.py":484
  9148. * for end in ends:
  9149. * contour = iup_contour_optimize(
  9150. * deltas[start : end + 1], coords[start : end + 1], tolerance # <<<<<<<<<<<<<<
  9151. * )
  9152. * assert len(contour) == end - start + 1
  9153. */
  9154. __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)
  9155. __Pyx_GOTREF(__pyx_t_2);
  9156. __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)
  9157. __Pyx_GOTREF(__pyx_t_10);
  9158. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9159. __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)
  9160. __Pyx_GOTREF(__pyx_t_2);
  9161. __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)
  9162. __Pyx_GOTREF(__pyx_t_11);
  9163. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9164. __pyx_t_12 = 1;
  9165. #if CYTHON_UNPACK_METHODS
  9166. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  9167. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
  9168. assert(__pyx_t_3);
  9169. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  9170. __Pyx_INCREF(__pyx_t_3);
  9171. __Pyx_INCREF(__pyx__function);
  9172. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  9173. __pyx_t_12 = 0;
  9174. }
  9175. #endif
  9176. {
  9177. PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_t_10, __pyx_t_11, __pyx_v_tolerance};
  9178. __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));
  9179. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  9180. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9181. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9182. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9183. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 483, __pyx_L1_error)
  9184. __Pyx_GOTREF(__pyx_t_8);
  9185. }
  9186. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_8);
  9187. __pyx_t_8 = 0;
  9188. /* "fontTools/varLib/iup.py":486
  9189. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9190. * )
  9191. * assert len(contour) == end - start + 1 # <<<<<<<<<<<<<<
  9192. * out.extend(contour)
  9193. * start = end + 1
  9194. */
  9195. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9196. if (unlikely(__pyx_assertions_enabled())) {
  9197. __pyx_t_13 = PyObject_Length(__pyx_v_contour); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 486, __pyx_L1_error)
  9198. __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error)
  9199. __Pyx_GOTREF(__pyx_t_8);
  9200. __pyx_t_7 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error)
  9201. __Pyx_GOTREF(__pyx_t_7);
  9202. __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)
  9203. __Pyx_GOTREF(__pyx_t_11);
  9204. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9205. __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)
  9206. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9207. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9208. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 486, __pyx_L1_error)
  9209. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9210. if (unlikely(!__pyx_t_1)) {
  9211. __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0);
  9212. __PYX_ERR(0, 486, __pyx_L1_error)
  9213. }
  9214. }
  9215. #else
  9216. if ((1)); else __PYX_ERR(0, 486, __pyx_L1_error)
  9217. #endif
  9218. /* "fontTools/varLib/iup.py":487
  9219. * )
  9220. * assert len(contour) == end - start + 1
  9221. * out.extend(contour) # <<<<<<<<<<<<<<
  9222. * start = end + 1
  9223. *
  9224. */
  9225. __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)
  9226. /* "fontTools/varLib/iup.py":488
  9227. * assert len(contour) == end - start + 1
  9228. * out.extend(contour)
  9229. * start = end + 1 # <<<<<<<<<<<<<<
  9230. *
  9231. * return out
  9232. */
  9233. __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)
  9234. __Pyx_GOTREF(__pyx_t_7);
  9235. __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_7);
  9236. __pyx_t_7 = 0;
  9237. /* "fontTools/varLib/iup.py":482
  9238. * out = []
  9239. * start = 0
  9240. * for end in ends: # <<<<<<<<<<<<<<
  9241. * contour = iup_contour_optimize(
  9242. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9243. */
  9244. }
  9245. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9246. /* "fontTools/varLib/iup.py":490
  9247. * start = end + 1
  9248. *
  9249. * return out # <<<<<<<<<<<<<<
  9250. */
  9251. __Pyx_XDECREF(__pyx_r);
  9252. __Pyx_INCREF(__pyx_v_out);
  9253. __pyx_r = __pyx_v_out;
  9254. goto __pyx_L0;
  9255. /* "fontTools/varLib/iup.py":464
  9256. *
  9257. *
  9258. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  9259. * deltas: _DeltaSegment,
  9260. * coords: _PointSegment,
  9261. */
  9262. /* function exit code */
  9263. __pyx_L1_error:;
  9264. __Pyx_XDECREF(__pyx_t_2);
  9265. __Pyx_XDECREF(__pyx_t_3);
  9266. __Pyx_XDECREF(__pyx_t_6);
  9267. __Pyx_XDECREF(__pyx_t_7);
  9268. __Pyx_XDECREF(__pyx_t_8);
  9269. __Pyx_XDECREF(__pyx_t_10);
  9270. __Pyx_XDECREF(__pyx_t_11);
  9271. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9272. __pyx_r = NULL;
  9273. __pyx_L0:;
  9274. __Pyx_XDECREF(__pyx_v_n);
  9275. __Pyx_XDECREF(__pyx_v_out);
  9276. __Pyx_XDECREF(__pyx_v_start);
  9277. __Pyx_XDECREF(__pyx_v_end);
  9278. __Pyx_XDECREF(__pyx_v_contour);
  9279. __Pyx_XDECREF(__pyx_v_ends);
  9280. __Pyx_XGIVEREF(__pyx_r);
  9281. __Pyx_RefNannyFinishContext();
  9282. return __pyx_r;
  9283. }
  9284. /* #### Code section: module_exttypes ### */
  9285. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9286. PyObject *o;
  9287. o = __Pyx_AllocateExtensionType(t, 1);
  9288. if (unlikely(!o)) return 0;
  9289. return o;
  9290. }
  9291. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o) {
  9292. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9293. #if CYTHON_USE_TP_FINALIZE
  9294. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9295. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults) {
  9296. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9297. }
  9298. }
  9299. #endif
  9300. PyObject_GC_UnTrack(o);
  9301. Py_CLEAR(p->arg0);
  9302. PyTypeObject *tp = Py_TYPE(o);
  9303. #if CYTHON_USE_TYPE_SLOTS
  9304. (*tp->tp_free)(o);
  9305. #else
  9306. {
  9307. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9308. if (tp_free) tp_free(o);
  9309. }
  9310. #endif
  9311. #if CYTHON_USE_TYPE_SPECS
  9312. Py_DECREF(tp);
  9313. #endif
  9314. }
  9315. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o, visitproc v, void *a) {
  9316. int e;
  9317. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9318. {
  9319. e = __Pyx_call_type_traverse(o, 1, v, a);
  9320. if (e) return e;
  9321. }
  9322. if (p->arg0) {
  9323. e = (*v)(p->arg0, a); if (e) return e;
  9324. }
  9325. return 0;
  9326. }
  9327. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults(PyObject *o) {
  9328. PyObject* tmp;
  9329. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  9330. tmp = ((PyObject*)p->arg0);
  9331. p->arg0 = ((PyObject*)Py_None); Py_INCREF(Py_None);
  9332. Py_XDECREF(tmp);
  9333. return 0;
  9334. }
  9335. #if CYTHON_USE_TYPE_SPECS
  9336. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_slots[] = {
  9337. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults},
  9338. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults},
  9339. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults},
  9340. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults},
  9341. {0, 0},
  9342. };
  9343. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_spec = {
  9344. "fontTools.varLib.iup.__pyx_defaults",
  9345. sizeof(struct __pyx_defaults),
  9346. 0,
  9347. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9348. __pyx_type_9fontTools_6varLib_3iup___pyx_defaults_slots,
  9349. };
  9350. #else
  9351. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_defaults = {
  9352. PyVarObject_HEAD_INIT(0, 0)
  9353. "fontTools.varLib.iup.""__pyx_defaults", /*tp_name*/
  9354. sizeof(struct __pyx_defaults), /*tp_basicsize*/
  9355. 0, /*tp_itemsize*/
  9356. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_defaults, /*tp_dealloc*/
  9357. 0, /*tp_vectorcall_offset*/
  9358. 0, /*tp_getattr*/
  9359. 0, /*tp_setattr*/
  9360. 0, /*tp_as_async*/
  9361. 0, /*tp_repr*/
  9362. 0, /*tp_as_number*/
  9363. 0, /*tp_as_sequence*/
  9364. 0, /*tp_as_mapping*/
  9365. 0, /*tp_hash*/
  9366. 0, /*tp_call*/
  9367. 0, /*tp_str*/
  9368. 0, /*tp_getattro*/
  9369. 0, /*tp_setattro*/
  9370. 0, /*tp_as_buffer*/
  9371. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9372. 0, /*tp_doc*/
  9373. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_defaults, /*tp_traverse*/
  9374. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_defaults, /*tp_clear*/
  9375. 0, /*tp_richcompare*/
  9376. 0, /*tp_weaklistoffset*/
  9377. 0, /*tp_iter*/
  9378. 0, /*tp_iternext*/
  9379. 0, /*tp_methods*/
  9380. 0, /*tp_members*/
  9381. 0, /*tp_getset*/
  9382. 0, /*tp_base*/
  9383. 0, /*tp_dict*/
  9384. 0, /*tp_descr_get*/
  9385. 0, /*tp_descr_set*/
  9386. #if !CYTHON_USE_TYPE_SPECS
  9387. 0, /*tp_dictoffset*/
  9388. #endif
  9389. 0, /*tp_init*/
  9390. 0, /*tp_alloc*/
  9391. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_defaults, /*tp_new*/
  9392. 0, /*tp_free*/
  9393. 0, /*tp_is_gc*/
  9394. 0, /*tp_bases*/
  9395. 0, /*tp_mro*/
  9396. 0, /*tp_cache*/
  9397. 0, /*tp_subclasses*/
  9398. 0, /*tp_weaklist*/
  9399. 0, /*tp_del*/
  9400. 0, /*tp_version_tag*/
  9401. #if CYTHON_USE_TP_FINALIZE
  9402. 0, /*tp_finalize*/
  9403. #else
  9404. NULL, /*tp_finalize*/
  9405. #endif
  9406. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9407. 0, /*tp_vectorcall*/
  9408. #endif
  9409. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9410. 0, /*tp_print*/
  9411. #endif
  9412. #if PY_VERSION_HEX >= 0x030C0000
  9413. 0, /*tp_watched*/
  9414. #endif
  9415. #if PY_VERSION_HEX >= 0x030d00A4
  9416. 0, /*tp_versions_used*/
  9417. #endif
  9418. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9419. 0, /*tp_pypy_flags*/
  9420. #endif
  9421. };
  9422. #endif
  9423. 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) {
  9424. PyObject *o;
  9425. #if CYTHON_USE_FREELISTS
  9426. 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))))
  9427. {
  9428. 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];
  9429. #if CYTHON_USE_TYPE_SPECS
  9430. Py_DECREF(Py_TYPE(o));
  9431. #endif
  9432. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between));
  9433. #if CYTHON_COMPILING_IN_LIMITED_API
  9434. (void) PyObject_Init(o, t);
  9435. #else
  9436. (void) PyObject_INIT(o, t);
  9437. #endif
  9438. PyObject_GC_Track(o);
  9439. } else
  9440. #endif
  9441. {
  9442. o = __Pyx_AllocateExtensionType(t, 1);
  9443. if (unlikely(!o)) return 0;
  9444. }
  9445. return o;
  9446. }
  9447. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9448. 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;
  9449. #if CYTHON_USE_TP_FINALIZE
  9450. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9451. 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) {
  9452. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9453. }
  9454. }
  9455. #endif
  9456. PyObject_GC_UnTrack(o);
  9457. Py_CLEAR(p->__pyx_v_tolerance);
  9458. #if CYTHON_USE_FREELISTS
  9459. 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))))
  9460. {
  9461. __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);
  9462. } else
  9463. #endif
  9464. {
  9465. PyTypeObject *tp = Py_TYPE(o);
  9466. #if CYTHON_USE_TYPE_SLOTS
  9467. (*tp->tp_free)(o);
  9468. #else
  9469. {
  9470. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9471. if (tp_free) tp_free(o);
  9472. }
  9473. #endif
  9474. #if CYTHON_USE_TYPE_SPECS
  9475. Py_DECREF(tp);
  9476. #endif
  9477. }
  9478. }
  9479. 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) {
  9480. int e;
  9481. 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;
  9482. {
  9483. e = __Pyx_call_type_traverse(o, 1, v, a);
  9484. if (e) return e;
  9485. }
  9486. if (p->__pyx_v_tolerance) {
  9487. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  9488. }
  9489. return 0;
  9490. }
  9491. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9492. PyObject* tmp;
  9493. 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;
  9494. tmp = ((PyObject*)p->__pyx_v_tolerance);
  9495. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  9496. Py_XDECREF(tmp);
  9497. return 0;
  9498. }
  9499. #if CYTHON_USE_TYPE_SPECS
  9500. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots[] = {
  9501. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9502. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9503. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9504. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9505. {0, 0},
  9506. };
  9507. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_spec = {
  9508. "fontTools.varLib.iup.__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between",
  9509. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between),
  9510. 0,
  9511. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9512. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots,
  9513. };
  9514. #else
  9515. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = {
  9516. PyVarObject_HEAD_INIT(0, 0)
  9517. "fontTools.varLib.iup.""__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between", /*tp_name*/
  9518. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between), /*tp_basicsize*/
  9519. 0, /*tp_itemsize*/
  9520. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_dealloc*/
  9521. 0, /*tp_vectorcall_offset*/
  9522. 0, /*tp_getattr*/
  9523. 0, /*tp_setattr*/
  9524. 0, /*tp_as_async*/
  9525. 0, /*tp_repr*/
  9526. 0, /*tp_as_number*/
  9527. 0, /*tp_as_sequence*/
  9528. 0, /*tp_as_mapping*/
  9529. 0, /*tp_hash*/
  9530. 0, /*tp_call*/
  9531. 0, /*tp_str*/
  9532. 0, /*tp_getattro*/
  9533. 0, /*tp_setattro*/
  9534. 0, /*tp_as_buffer*/
  9535. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9536. 0, /*tp_doc*/
  9537. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_traverse*/
  9538. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_clear*/
  9539. 0, /*tp_richcompare*/
  9540. 0, /*tp_weaklistoffset*/
  9541. 0, /*tp_iter*/
  9542. 0, /*tp_iternext*/
  9543. 0, /*tp_methods*/
  9544. 0, /*tp_members*/
  9545. 0, /*tp_getset*/
  9546. 0, /*tp_base*/
  9547. 0, /*tp_dict*/
  9548. 0, /*tp_descr_get*/
  9549. 0, /*tp_descr_set*/
  9550. #if !CYTHON_USE_TYPE_SPECS
  9551. 0, /*tp_dictoffset*/
  9552. #endif
  9553. 0, /*tp_init*/
  9554. 0, /*tp_alloc*/
  9555. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_new*/
  9556. 0, /*tp_free*/
  9557. 0, /*tp_is_gc*/
  9558. 0, /*tp_bases*/
  9559. 0, /*tp_mro*/
  9560. 0, /*tp_cache*/
  9561. 0, /*tp_subclasses*/
  9562. 0, /*tp_weaklist*/
  9563. 0, /*tp_del*/
  9564. 0, /*tp_version_tag*/
  9565. #if CYTHON_USE_TP_FINALIZE
  9566. 0, /*tp_finalize*/
  9567. #else
  9568. NULL, /*tp_finalize*/
  9569. #endif
  9570. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9571. 0, /*tp_vectorcall*/
  9572. #endif
  9573. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9574. 0, /*tp_print*/
  9575. #endif
  9576. #if PY_VERSION_HEX >= 0x030C0000
  9577. 0, /*tp_watched*/
  9578. #endif
  9579. #if PY_VERSION_HEX >= 0x030d00A4
  9580. 0, /*tp_versions_used*/
  9581. #endif
  9582. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9583. 0, /*tp_pypy_flags*/
  9584. #endif
  9585. };
  9586. #endif
  9587. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9588. PyObject *o;
  9589. #if CYTHON_USE_FREELISTS
  9590. 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))))
  9591. {
  9592. 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];
  9593. #if CYTHON_USE_TYPE_SPECS
  9594. Py_DECREF(Py_TYPE(o));
  9595. #endif
  9596. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr));
  9597. #if CYTHON_COMPILING_IN_LIMITED_API
  9598. (void) PyObject_Init(o, t);
  9599. #else
  9600. (void) PyObject_INIT(o, t);
  9601. #endif
  9602. PyObject_GC_Track(o);
  9603. } else
  9604. #endif
  9605. {
  9606. o = __Pyx_AllocateExtensionType(t, 1);
  9607. if (unlikely(!o)) return 0;
  9608. }
  9609. return o;
  9610. }
  9611. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o) {
  9612. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  9613. #if CYTHON_USE_TP_FINALIZE
  9614. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9615. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) {
  9616. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9617. }
  9618. }
  9619. #endif
  9620. PyObject_GC_UnTrack(o);
  9621. Py_CLEAR(p->__pyx_outer_scope);
  9622. Py_CLEAR(p->__pyx_genexpr_arg_0);
  9623. #if CYTHON_USE_FREELISTS
  9624. 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))))
  9625. {
  9626. __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);
  9627. } else
  9628. #endif
  9629. {
  9630. PyTypeObject *tp = Py_TYPE(o);
  9631. #if CYTHON_USE_TYPE_SLOTS
  9632. (*tp->tp_free)(o);
  9633. #else
  9634. {
  9635. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9636. if (tp_free) tp_free(o);
  9637. }
  9638. #endif
  9639. #if CYTHON_USE_TYPE_SPECS
  9640. Py_DECREF(tp);
  9641. #endif
  9642. }
  9643. }
  9644. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  9645. int e;
  9646. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  9647. {
  9648. e = __Pyx_call_type_traverse(o, 1, v, a);
  9649. if (e) return e;
  9650. }
  9651. if (p->__pyx_outer_scope) {
  9652. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  9653. }
  9654. if (p->__pyx_genexpr_arg_0) {
  9655. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  9656. }
  9657. return 0;
  9658. }
  9659. #if CYTHON_USE_TYPE_SPECS
  9660. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots[] = {
  9661. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9662. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9663. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  9664. {0, 0},
  9665. };
  9666. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec = {
  9667. "fontTools.varLib.iup.__pyx_scope_struct_1_genexpr",
  9668. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr),
  9669. 0,
  9670. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9671. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots,
  9672. };
  9673. #else
  9674. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = {
  9675. PyVarObject_HEAD_INIT(0, 0)
  9676. "fontTools.varLib.iup.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  9677. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  9678. 0, /*tp_itemsize*/
  9679. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  9680. 0, /*tp_vectorcall_offset*/
  9681. 0, /*tp_getattr*/
  9682. 0, /*tp_setattr*/
  9683. 0, /*tp_as_async*/
  9684. 0, /*tp_repr*/
  9685. 0, /*tp_as_number*/
  9686. 0, /*tp_as_sequence*/
  9687. 0, /*tp_as_mapping*/
  9688. 0, /*tp_hash*/
  9689. 0, /*tp_call*/
  9690. 0, /*tp_str*/
  9691. 0, /*tp_getattro*/
  9692. 0, /*tp_setattro*/
  9693. 0, /*tp_as_buffer*/
  9694. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9695. 0, /*tp_doc*/
  9696. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  9697. 0, /*tp_clear*/
  9698. 0, /*tp_richcompare*/
  9699. 0, /*tp_weaklistoffset*/
  9700. 0, /*tp_iter*/
  9701. 0, /*tp_iternext*/
  9702. 0, /*tp_methods*/
  9703. 0, /*tp_members*/
  9704. 0, /*tp_getset*/
  9705. 0, /*tp_base*/
  9706. 0, /*tp_dict*/
  9707. 0, /*tp_descr_get*/
  9708. 0, /*tp_descr_set*/
  9709. #if !CYTHON_USE_TYPE_SPECS
  9710. 0, /*tp_dictoffset*/
  9711. #endif
  9712. 0, /*tp_init*/
  9713. 0, /*tp_alloc*/
  9714. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_new*/
  9715. 0, /*tp_free*/
  9716. 0, /*tp_is_gc*/
  9717. 0, /*tp_bases*/
  9718. 0, /*tp_mro*/
  9719. 0, /*tp_cache*/
  9720. 0, /*tp_subclasses*/
  9721. 0, /*tp_weaklist*/
  9722. 0, /*tp_del*/
  9723. 0, /*tp_version_tag*/
  9724. #if CYTHON_USE_TP_FINALIZE
  9725. 0, /*tp_finalize*/
  9726. #else
  9727. NULL, /*tp_finalize*/
  9728. #endif
  9729. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9730. 0, /*tp_vectorcall*/
  9731. #endif
  9732. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9733. 0, /*tp_print*/
  9734. #endif
  9735. #if PY_VERSION_HEX >= 0x030C0000
  9736. 0, /*tp_watched*/
  9737. #endif
  9738. #if PY_VERSION_HEX >= 0x030d00A4
  9739. 0, /*tp_versions_used*/
  9740. #endif
  9741. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9742. 0, /*tp_pypy_flags*/
  9743. #endif
  9744. };
  9745. #endif
  9746. 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) {
  9747. PyObject *o;
  9748. #if CYTHON_USE_FREELISTS
  9749. 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))))
  9750. {
  9751. 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];
  9752. #if CYTHON_USE_TYPE_SPECS
  9753. Py_DECREF(Py_TYPE(o));
  9754. #endif
  9755. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize));
  9756. #if CYTHON_COMPILING_IN_LIMITED_API
  9757. (void) PyObject_Init(o, t);
  9758. #else
  9759. (void) PyObject_INIT(o, t);
  9760. #endif
  9761. PyObject_GC_Track(o);
  9762. } else
  9763. #endif
  9764. {
  9765. o = __Pyx_AllocateExtensionType(t, 1);
  9766. if (unlikely(!o)) return 0;
  9767. }
  9768. return o;
  9769. }
  9770. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  9771. 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;
  9772. #if CYTHON_USE_TP_FINALIZE
  9773. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9774. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) {
  9775. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9776. }
  9777. }
  9778. #endif
  9779. PyObject_GC_UnTrack(o);
  9780. Py_CLEAR(p->__pyx_v_d0);
  9781. Py_CLEAR(p->__pyx_v_tolerance);
  9782. #if CYTHON_USE_FREELISTS
  9783. 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))))
  9784. {
  9785. __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);
  9786. } else
  9787. #endif
  9788. {
  9789. PyTypeObject *tp = Py_TYPE(o);
  9790. #if CYTHON_USE_TYPE_SLOTS
  9791. (*tp->tp_free)(o);
  9792. #else
  9793. {
  9794. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9795. if (tp_free) tp_free(o);
  9796. }
  9797. #endif
  9798. #if CYTHON_USE_TYPE_SPECS
  9799. Py_DECREF(tp);
  9800. #endif
  9801. }
  9802. }
  9803. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o, visitproc v, void *a) {
  9804. int e;
  9805. 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;
  9806. {
  9807. e = __Pyx_call_type_traverse(o, 1, v, a);
  9808. if (e) return e;
  9809. }
  9810. if (p->__pyx_v_d0) {
  9811. e = (*v)(p->__pyx_v_d0, a); if (e) return e;
  9812. }
  9813. if (p->__pyx_v_tolerance) {
  9814. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  9815. }
  9816. return 0;
  9817. }
  9818. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  9819. PyObject* tmp;
  9820. 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;
  9821. tmp = ((PyObject*)p->__pyx_v_d0);
  9822. p->__pyx_v_d0 = Py_None; Py_INCREF(Py_None);
  9823. Py_XDECREF(tmp);
  9824. tmp = ((PyObject*)p->__pyx_v_tolerance);
  9825. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  9826. Py_XDECREF(tmp);
  9827. return 0;
  9828. }
  9829. #if CYTHON_USE_TYPE_SPECS
  9830. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots[] = {
  9831. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9832. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9833. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9834. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  9835. {0, 0},
  9836. };
  9837. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec = {
  9838. "fontTools.varLib.iup.__pyx_scope_struct_2_iup_contour_optimize",
  9839. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize),
  9840. 0,
  9841. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  9842. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots,
  9843. };
  9844. #else
  9845. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = {
  9846. PyVarObject_HEAD_INIT(0, 0)
  9847. "fontTools.varLib.iup.""__pyx_scope_struct_2_iup_contour_optimize", /*tp_name*/
  9848. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize), /*tp_basicsize*/
  9849. 0, /*tp_itemsize*/
  9850. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_dealloc*/
  9851. 0, /*tp_vectorcall_offset*/
  9852. 0, /*tp_getattr*/
  9853. 0, /*tp_setattr*/
  9854. 0, /*tp_as_async*/
  9855. 0, /*tp_repr*/
  9856. 0, /*tp_as_number*/
  9857. 0, /*tp_as_sequence*/
  9858. 0, /*tp_as_mapping*/
  9859. 0, /*tp_hash*/
  9860. 0, /*tp_call*/
  9861. 0, /*tp_str*/
  9862. 0, /*tp_getattro*/
  9863. 0, /*tp_setattro*/
  9864. 0, /*tp_as_buffer*/
  9865. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  9866. 0, /*tp_doc*/
  9867. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_traverse*/
  9868. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_clear*/
  9869. 0, /*tp_richcompare*/
  9870. 0, /*tp_weaklistoffset*/
  9871. 0, /*tp_iter*/
  9872. 0, /*tp_iternext*/
  9873. 0, /*tp_methods*/
  9874. 0, /*tp_members*/
  9875. 0, /*tp_getset*/
  9876. 0, /*tp_base*/
  9877. 0, /*tp_dict*/
  9878. 0, /*tp_descr_get*/
  9879. 0, /*tp_descr_set*/
  9880. #if !CYTHON_USE_TYPE_SPECS
  9881. 0, /*tp_dictoffset*/
  9882. #endif
  9883. 0, /*tp_init*/
  9884. 0, /*tp_alloc*/
  9885. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_new*/
  9886. 0, /*tp_free*/
  9887. 0, /*tp_is_gc*/
  9888. 0, /*tp_bases*/
  9889. 0, /*tp_mro*/
  9890. 0, /*tp_cache*/
  9891. 0, /*tp_subclasses*/
  9892. 0, /*tp_weaklist*/
  9893. 0, /*tp_del*/
  9894. 0, /*tp_version_tag*/
  9895. #if CYTHON_USE_TP_FINALIZE
  9896. 0, /*tp_finalize*/
  9897. #else
  9898. NULL, /*tp_finalize*/
  9899. #endif
  9900. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  9901. 0, /*tp_vectorcall*/
  9902. #endif
  9903. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9904. 0, /*tp_print*/
  9905. #endif
  9906. #if PY_VERSION_HEX >= 0x030C0000
  9907. 0, /*tp_watched*/
  9908. #endif
  9909. #if PY_VERSION_HEX >= 0x030d00A4
  9910. 0, /*tp_versions_used*/
  9911. #endif
  9912. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9913. 0, /*tp_pypy_flags*/
  9914. #endif
  9915. };
  9916. #endif
  9917. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  9918. PyObject *o;
  9919. #if CYTHON_USE_FREELISTS
  9920. 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))))
  9921. {
  9922. 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];
  9923. #if CYTHON_USE_TYPE_SPECS
  9924. Py_DECREF(Py_TYPE(o));
  9925. #endif
  9926. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr));
  9927. #if CYTHON_COMPILING_IN_LIMITED_API
  9928. (void) PyObject_Init(o, t);
  9929. #else
  9930. (void) PyObject_INIT(o, t);
  9931. #endif
  9932. PyObject_GC_Track(o);
  9933. } else
  9934. #endif
  9935. {
  9936. o = __Pyx_AllocateExtensionType(t, 1);
  9937. if (unlikely(!o)) return 0;
  9938. }
  9939. return o;
  9940. }
  9941. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o) {
  9942. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  9943. #if CYTHON_USE_TP_FINALIZE
  9944. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9945. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) {
  9946. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9947. }
  9948. }
  9949. #endif
  9950. PyObject_GC_UnTrack(o);
  9951. Py_CLEAR(p->__pyx_outer_scope);
  9952. Py_CLEAR(p->__pyx_genexpr_arg_0);
  9953. Py_CLEAR(p->__pyx_v_p);
  9954. #if CYTHON_USE_FREELISTS
  9955. 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))))
  9956. {
  9957. __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);
  9958. } else
  9959. #endif
  9960. {
  9961. PyTypeObject *tp = Py_TYPE(o);
  9962. #if CYTHON_USE_TYPE_SLOTS
  9963. (*tp->tp_free)(o);
  9964. #else
  9965. {
  9966. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  9967. if (tp_free) tp_free(o);
  9968. }
  9969. #endif
  9970. #if CYTHON_USE_TYPE_SPECS
  9971. Py_DECREF(tp);
  9972. #endif
  9973. }
  9974. }
  9975. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  9976. int e;
  9977. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  9978. {
  9979. e = __Pyx_call_type_traverse(o, 1, v, a);
  9980. if (e) return e;
  9981. }
  9982. if (p->__pyx_outer_scope) {
  9983. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  9984. }
  9985. if (p->__pyx_genexpr_arg_0) {
  9986. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  9987. }
  9988. if (p->__pyx_v_p) {
  9989. e = (*v)(p->__pyx_v_p, a); if (e) return e;
  9990. }
  9991. return 0;
  9992. }
  9993. #if CYTHON_USE_TYPE_SPECS
  9994. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots[] = {
  9995. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  9996. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  9997. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  9998. {0, 0},
  9999. };
  10000. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec = {
  10001. "fontTools.varLib.iup.__pyx_scope_struct_3_genexpr",
  10002. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr),
  10003. 0,
  10004. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  10005. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots,
  10006. };
  10007. #else
  10008. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = {
  10009. PyVarObject_HEAD_INIT(0, 0)
  10010. "fontTools.varLib.iup.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  10011. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  10012. 0, /*tp_itemsize*/
  10013. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  10014. 0, /*tp_vectorcall_offset*/
  10015. 0, /*tp_getattr*/
  10016. 0, /*tp_setattr*/
  10017. 0, /*tp_as_async*/
  10018. 0, /*tp_repr*/
  10019. 0, /*tp_as_number*/
  10020. 0, /*tp_as_sequence*/
  10021. 0, /*tp_as_mapping*/
  10022. 0, /*tp_hash*/
  10023. 0, /*tp_call*/
  10024. 0, /*tp_str*/
  10025. 0, /*tp_getattro*/
  10026. 0, /*tp_setattro*/
  10027. 0, /*tp_as_buffer*/
  10028. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  10029. 0, /*tp_doc*/
  10030. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  10031. 0, /*tp_clear*/
  10032. 0, /*tp_richcompare*/
  10033. 0, /*tp_weaklistoffset*/
  10034. 0, /*tp_iter*/
  10035. 0, /*tp_iternext*/
  10036. 0, /*tp_methods*/
  10037. 0, /*tp_members*/
  10038. 0, /*tp_getset*/
  10039. 0, /*tp_base*/
  10040. 0, /*tp_dict*/
  10041. 0, /*tp_descr_get*/
  10042. 0, /*tp_descr_set*/
  10043. #if !CYTHON_USE_TYPE_SPECS
  10044. 0, /*tp_dictoffset*/
  10045. #endif
  10046. 0, /*tp_init*/
  10047. 0, /*tp_alloc*/
  10048. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_new*/
  10049. 0, /*tp_free*/
  10050. 0, /*tp_is_gc*/
  10051. 0, /*tp_bases*/
  10052. 0, /*tp_mro*/
  10053. 0, /*tp_cache*/
  10054. 0, /*tp_subclasses*/
  10055. 0, /*tp_weaklist*/
  10056. 0, /*tp_del*/
  10057. 0, /*tp_version_tag*/
  10058. #if CYTHON_USE_TP_FINALIZE
  10059. 0, /*tp_finalize*/
  10060. #else
  10061. NULL, /*tp_finalize*/
  10062. #endif
  10063. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  10064. 0, /*tp_vectorcall*/
  10065. #endif
  10066. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10067. 0, /*tp_print*/
  10068. #endif
  10069. #if PY_VERSION_HEX >= 0x030C0000
  10070. 0, /*tp_watched*/
  10071. #endif
  10072. #if PY_VERSION_HEX >= 0x030d00A4
  10073. 0, /*tp_versions_used*/
  10074. #endif
  10075. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10076. 0, /*tp_pypy_flags*/
  10077. #endif
  10078. };
  10079. #endif
  10080. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  10081. PyObject *o;
  10082. #if CYTHON_USE_FREELISTS
  10083. 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))))
  10084. {
  10085. 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];
  10086. #if CYTHON_USE_TYPE_SPECS
  10087. Py_DECREF(Py_TYPE(o));
  10088. #endif
  10089. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr));
  10090. #if CYTHON_COMPILING_IN_LIMITED_API
  10091. (void) PyObject_Init(o, t);
  10092. #else
  10093. (void) PyObject_INIT(o, t);
  10094. #endif
  10095. PyObject_GC_Track(o);
  10096. } else
  10097. #endif
  10098. {
  10099. o = __Pyx_AllocateExtensionType(t, 1);
  10100. if (unlikely(!o)) return 0;
  10101. }
  10102. return o;
  10103. }
  10104. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o) {
  10105. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10106. #if CYTHON_USE_TP_FINALIZE
  10107. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10108. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) {
  10109. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10110. }
  10111. }
  10112. #endif
  10113. PyObject_GC_UnTrack(o);
  10114. Py_CLEAR(p->__pyx_outer_scope);
  10115. Py_CLEAR(p->__pyx_genexpr_arg_0);
  10116. Py_CLEAR(p->__pyx_v_d);
  10117. #if CYTHON_USE_FREELISTS
  10118. 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))))
  10119. {
  10120. __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);
  10121. } else
  10122. #endif
  10123. {
  10124. PyTypeObject *tp = Py_TYPE(o);
  10125. #if CYTHON_USE_TYPE_SLOTS
  10126. (*tp->tp_free)(o);
  10127. #else
  10128. {
  10129. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  10130. if (tp_free) tp_free(o);
  10131. }
  10132. #endif
  10133. #if CYTHON_USE_TYPE_SPECS
  10134. Py_DECREF(tp);
  10135. #endif
  10136. }
  10137. }
  10138. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  10139. int e;
  10140. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10141. {
  10142. e = __Pyx_call_type_traverse(o, 1, v, a);
  10143. if (e) return e;
  10144. }
  10145. if (p->__pyx_outer_scope) {
  10146. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  10147. }
  10148. if (p->__pyx_genexpr_arg_0) {
  10149. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  10150. }
  10151. if (p->__pyx_v_d) {
  10152. e = (*v)(p->__pyx_v_d, a); if (e) return e;
  10153. }
  10154. return 0;
  10155. }
  10156. #if CYTHON_USE_TYPE_SPECS
  10157. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots[] = {
  10158. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10159. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10160. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10161. {0, 0},
  10162. };
  10163. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec = {
  10164. "fontTools.varLib.iup.__pyx_scope_struct_4_genexpr",
  10165. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr),
  10166. 0,
  10167. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  10168. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots,
  10169. };
  10170. #else
  10171. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = {
  10172. PyVarObject_HEAD_INIT(0, 0)
  10173. "fontTools.varLib.iup.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  10174. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  10175. 0, /*tp_itemsize*/
  10176. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  10177. 0, /*tp_vectorcall_offset*/
  10178. 0, /*tp_getattr*/
  10179. 0, /*tp_setattr*/
  10180. 0, /*tp_as_async*/
  10181. 0, /*tp_repr*/
  10182. 0, /*tp_as_number*/
  10183. 0, /*tp_as_sequence*/
  10184. 0, /*tp_as_mapping*/
  10185. 0, /*tp_hash*/
  10186. 0, /*tp_call*/
  10187. 0, /*tp_str*/
  10188. 0, /*tp_getattro*/
  10189. 0, /*tp_setattro*/
  10190. 0, /*tp_as_buffer*/
  10191. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  10192. 0, /*tp_doc*/
  10193. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  10194. 0, /*tp_clear*/
  10195. 0, /*tp_richcompare*/
  10196. 0, /*tp_weaklistoffset*/
  10197. 0, /*tp_iter*/
  10198. 0, /*tp_iternext*/
  10199. 0, /*tp_methods*/
  10200. 0, /*tp_members*/
  10201. 0, /*tp_getset*/
  10202. 0, /*tp_base*/
  10203. 0, /*tp_dict*/
  10204. 0, /*tp_descr_get*/
  10205. 0, /*tp_descr_set*/
  10206. #if !CYTHON_USE_TYPE_SPECS
  10207. 0, /*tp_dictoffset*/
  10208. #endif
  10209. 0, /*tp_init*/
  10210. 0, /*tp_alloc*/
  10211. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_new*/
  10212. 0, /*tp_free*/
  10213. 0, /*tp_is_gc*/
  10214. 0, /*tp_bases*/
  10215. 0, /*tp_mro*/
  10216. 0, /*tp_cache*/
  10217. 0, /*tp_subclasses*/
  10218. 0, /*tp_weaklist*/
  10219. 0, /*tp_del*/
  10220. 0, /*tp_version_tag*/
  10221. #if CYTHON_USE_TP_FINALIZE
  10222. 0, /*tp_finalize*/
  10223. #else
  10224. NULL, /*tp_finalize*/
  10225. #endif
  10226. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  10227. 0, /*tp_vectorcall*/
  10228. #endif
  10229. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10230. 0, /*tp_print*/
  10231. #endif
  10232. #if PY_VERSION_HEX >= 0x030C0000
  10233. 0, /*tp_watched*/
  10234. #endif
  10235. #if PY_VERSION_HEX >= 0x030d00A4
  10236. 0, /*tp_versions_used*/
  10237. #endif
  10238. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10239. 0, /*tp_pypy_flags*/
  10240. #endif
  10241. };
  10242. #endif
  10243. static PyMethodDef __pyx_methods[] = {
  10244. {0, 0, 0, 0}
  10245. };
  10246. /* #### Code section: initfunc_declarations ### */
  10247. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10248. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10249. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
  10250. static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10251. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10252. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10253. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10254. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10255. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10256. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10257. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10258. static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
  10259. /* #### Code section: init_module ### */
  10260. static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  10261. __Pyx_RefNannyDeclarations
  10262. CYTHON_UNUSED_VAR(__pyx_mstate);
  10263. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  10264. /*--- Global init code ---*/
  10265. __Pyx_RefNannyFinishContext();
  10266. return 0;
  10267. }
  10268. static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  10269. __Pyx_RefNannyDeclarations
  10270. CYTHON_UNUSED_VAR(__pyx_mstate);
  10271. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  10272. /*--- Variable export code ---*/
  10273. __Pyx_RefNannyFinishContext();
  10274. return 0;
  10275. }
  10276. static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  10277. __Pyx_RefNannyDeclarations
  10278. CYTHON_UNUSED_VAR(__pyx_mstate);
  10279. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  10280. /*--- Function export code ---*/
  10281. __Pyx_RefNannyFinishContext();
  10282. return 0;
  10283. }
  10284. static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  10285. __Pyx_RefNannyDeclarations
  10286. CYTHON_UNUSED_VAR(__pyx_mstate);
  10287. int __pyx_lineno = 0;
  10288. const char *__pyx_filename = NULL;
  10289. int __pyx_clineno = 0;
  10290. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  10291. /*--- Type init code ---*/
  10292. #if CYTHON_USE_TYPE_SPECS
  10293. __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)
  10294. 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)
  10295. #else
  10296. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults = &__pyx_type_9fontTools_6varLib_3iup___pyx_defaults;
  10297. #endif
  10298. #if !CYTHON_COMPILING_IN_LIMITED_API
  10299. #endif
  10300. #if !CYTHON_USE_TYPE_SPECS
  10301. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults) < (0)) __PYX_ERR(0, 293, __pyx_L1_error)
  10302. #endif
  10303. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10304. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults);
  10305. #endif
  10306. #if !CYTHON_COMPILING_IN_LIMITED_API
  10307. 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)) {
  10308. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults->tp_getattro = PyObject_GenericGetAttr;
  10309. }
  10310. #endif
  10311. #if CYTHON_USE_TYPE_SPECS
  10312. __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)
  10313. 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)
  10314. #else
  10315. __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;
  10316. #endif
  10317. #if !CYTHON_COMPILING_IN_LIMITED_API
  10318. #endif
  10319. #if !CYTHON_USE_TYPE_SPECS
  10320. 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)
  10321. #endif
  10322. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10323. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  10324. #endif
  10325. #if !CYTHON_COMPILING_IN_LIMITED_API
  10326. 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)) {
  10327. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_getattro = PyObject_GenericGetAttr;
  10328. }
  10329. #endif
  10330. #if CYTHON_USE_TYPE_SPECS
  10331. __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)
  10332. 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)
  10333. #else
  10334. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  10335. #endif
  10336. #if !CYTHON_COMPILING_IN_LIMITED_API
  10337. #endif
  10338. #if !CYTHON_USE_TYPE_SPECS
  10339. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 197, __pyx_L1_error)
  10340. #endif
  10341. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10342. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  10343. #endif
  10344. #if !CYTHON_COMPILING_IN_LIMITED_API
  10345. 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)) {
  10346. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10347. }
  10348. #endif
  10349. #if CYTHON_USE_TYPE_SPECS
  10350. __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)
  10351. 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)
  10352. #else
  10353. __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;
  10354. #endif
  10355. #if !CYTHON_COMPILING_IN_LIMITED_API
  10356. #endif
  10357. #if !CYTHON_USE_TYPE_SPECS
  10358. 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)
  10359. #endif
  10360. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10361. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  10362. #endif
  10363. #if !CYTHON_COMPILING_IN_LIMITED_API
  10364. 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)) {
  10365. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_getattro = PyObject_GenericGetAttr;
  10366. }
  10367. #endif
  10368. #if CYTHON_USE_TYPE_SPECS
  10369. __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)
  10370. 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)
  10371. #else
  10372. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  10373. #endif
  10374. #if !CYTHON_COMPILING_IN_LIMITED_API
  10375. #endif
  10376. #if !CYTHON_USE_TYPE_SPECS
  10377. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 378, __pyx_L1_error)
  10378. #endif
  10379. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10380. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  10381. #endif
  10382. #if !CYTHON_COMPILING_IN_LIMITED_API
  10383. 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)) {
  10384. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10385. }
  10386. #endif
  10387. #if CYTHON_USE_TYPE_SPECS
  10388. __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)
  10389. 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)
  10390. #else
  10391. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  10392. #endif
  10393. #if !CYTHON_COMPILING_IN_LIMITED_API
  10394. #endif
  10395. #if !CYTHON_USE_TYPE_SPECS
  10396. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 387, __pyx_L1_error)
  10397. #endif
  10398. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10399. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  10400. #endif
  10401. #if !CYTHON_COMPILING_IN_LIMITED_API
  10402. 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)) {
  10403. __pyx_mstate->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr;
  10404. }
  10405. #endif
  10406. __Pyx_RefNannyFinishContext();
  10407. return 0;
  10408. __pyx_L1_error:;
  10409. __Pyx_RefNannyFinishContext();
  10410. return -1;
  10411. }
  10412. static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  10413. __Pyx_RefNannyDeclarations
  10414. CYTHON_UNUSED_VAR(__pyx_mstate);
  10415. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  10416. /*--- Type import code ---*/
  10417. __Pyx_RefNannyFinishContext();
  10418. return 0;
  10419. }
  10420. static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  10421. __Pyx_RefNannyDeclarations
  10422. CYTHON_UNUSED_VAR(__pyx_mstate);
  10423. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  10424. /*--- Variable import code ---*/
  10425. __Pyx_RefNannyFinishContext();
  10426. return 0;
  10427. }
  10428. static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  10429. __Pyx_RefNannyDeclarations
  10430. CYTHON_UNUSED_VAR(__pyx_mstate);
  10431. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  10432. /*--- Function import code ---*/
  10433. __Pyx_RefNannyFinishContext();
  10434. return 0;
  10435. }
  10436. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10437. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  10438. static int __pyx_pymod_exec_iup(PyObject* module); /*proto*/
  10439. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  10440. {Py_mod_create, (void*)__pyx_pymod_create},
  10441. {Py_mod_exec, (void*)__pyx_pymod_exec_iup},
  10442. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  10443. {Py_mod_gil, Py_MOD_GIL_USED},
  10444. #endif
  10445. #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  10446. {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  10447. #endif
  10448. {0, NULL}
  10449. };
  10450. #endif
  10451. #ifdef __cplusplus
  10452. namespace {
  10453. struct PyModuleDef __pyx_moduledef =
  10454. #else
  10455. static struct PyModuleDef __pyx_moduledef =
  10456. #endif
  10457. {
  10458. PyModuleDef_HEAD_INIT,
  10459. "iup",
  10460. 0, /* m_doc */
  10461. #if CYTHON_USE_MODULE_STATE
  10462. sizeof(__pyx_mstatetype), /* m_size */
  10463. #else
  10464. (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
  10465. #endif
  10466. __pyx_methods /* m_methods */,
  10467. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10468. __pyx_moduledef_slots, /* m_slots */
  10469. #else
  10470. NULL, /* m_reload */
  10471. #endif
  10472. #if CYTHON_USE_MODULE_STATE
  10473. __pyx_m_traverse, /* m_traverse */
  10474. __pyx_m_clear, /* m_clear */
  10475. NULL /* m_free */
  10476. #else
  10477. NULL, /* m_traverse */
  10478. NULL, /* m_clear */
  10479. NULL /* m_free */
  10480. #endif
  10481. };
  10482. #ifdef __cplusplus
  10483. } /* anonymous namespace */
  10484. #endif
  10485. /* PyModInitFuncType */
  10486. #ifndef CYTHON_NO_PYINIT_EXPORT
  10487. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  10488. #else
  10489. #ifdef __cplusplus
  10490. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  10491. #else
  10492. #define __Pyx_PyMODINIT_FUNC PyObject *
  10493. #endif
  10494. #endif
  10495. __Pyx_PyMODINIT_FUNC PyInit_iup(void) CYTHON_SMALL_CODE; /*proto*/
  10496. __Pyx_PyMODINIT_FUNC PyInit_iup(void)
  10497. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10498. {
  10499. return PyModuleDef_Init(&__pyx_moduledef);
  10500. }
  10501. /* ModuleCreationPEP489 */
  10502. #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  10503. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  10504. static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
  10505. {
  10506. PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
  10507. if (!module) {
  10508. PyErr_Clear(); // just try the 3.8-3.12 version
  10509. module = PyImport_ImportModule("_xxsubinterpreters");
  10510. if (!module) goto bad;
  10511. }
  10512. PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
  10513. Py_DECREF(module);
  10514. if (!current) goto bad;
  10515. if (PyTuple_Check(current)) {
  10516. PyObject *new_current = PySequence_GetItem(current, 0);
  10517. Py_DECREF(current);
  10518. current = new_current;
  10519. if (!new_current) goto bad;
  10520. }
  10521. long long as_c_int = PyLong_AsLongLong(current);
  10522. Py_DECREF(current);
  10523. return as_c_int;
  10524. }
  10525. bad:
  10526. PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
  10527. return -1;
  10528. }
  10529. #endif
  10530. #if !CYTHON_USE_MODULE_STATE
  10531. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  10532. static PY_INT64_T main_interpreter_id = -1;
  10533. #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  10534. PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  10535. #elif CYTHON_COMPILING_IN_GRAAL
  10536. PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  10537. #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  10538. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  10539. PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
  10540. #elif CYTHON_COMPILING_IN_LIMITED_API
  10541. PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
  10542. #else
  10543. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  10544. #endif
  10545. if (unlikely(current_id == -1)) {
  10546. return -1;
  10547. }
  10548. if (main_interpreter_id == -1) {
  10549. main_interpreter_id = current_id;
  10550. return 0;
  10551. } else if (unlikely(main_interpreter_id != current_id)) {
  10552. PyErr_SetString(
  10553. PyExc_ImportError,
  10554. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  10555. return -1;
  10556. }
  10557. return 0;
  10558. }
  10559. #endif
  10560. 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)
  10561. {
  10562. PyObject *value = PyObject_GetAttrString(spec, from_name);
  10563. int result = 0;
  10564. if (likely(value)) {
  10565. if (allow_none || value != Py_None) {
  10566. result = PyDict_SetItemString(moddict, to_name, value);
  10567. }
  10568. Py_DECREF(value);
  10569. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  10570. PyErr_Clear();
  10571. } else {
  10572. result = -1;
  10573. }
  10574. return result;
  10575. }
  10576. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  10577. PyObject *module = NULL, *moddict, *modname;
  10578. CYTHON_UNUSED_VAR(def);
  10579. #if !CYTHON_USE_MODULE_STATE
  10580. if (__Pyx_check_single_interpreter())
  10581. return NULL;
  10582. #endif
  10583. if (__pyx_m)
  10584. return __Pyx_NewRef(__pyx_m);
  10585. modname = PyObject_GetAttrString(spec, "name");
  10586. if (unlikely(!modname)) goto bad;
  10587. module = PyModule_NewObject(modname);
  10588. Py_DECREF(modname);
  10589. if (unlikely(!module)) goto bad;
  10590. moddict = PyModule_GetDict(module);
  10591. if (unlikely(!moddict)) goto bad;
  10592. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  10593. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  10594. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  10595. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  10596. return module;
  10597. bad:
  10598. Py_XDECREF(module);
  10599. return NULL;
  10600. }
  10601. static CYTHON_SMALL_CODE int __pyx_pymod_exec_iup(PyObject *__pyx_pyinit_module)
  10602. #endif
  10603. {
  10604. int stringtab_initialized = 0;
  10605. #if CYTHON_USE_MODULE_STATE
  10606. int pystate_addmodule_run = 0;
  10607. #endif
  10608. __pyx_mstatetype *__pyx_mstate = NULL;
  10609. PyObject *__pyx_t_1 = NULL;
  10610. PyObject *__pyx_t_2 = NULL;
  10611. PyObject *__pyx_t_3 = NULL;
  10612. PyObject *__pyx_t_4 = NULL;
  10613. Py_ssize_t __pyx_t_5;
  10614. PyObject *__pyx_t_6 = NULL;
  10615. PyObject *__pyx_t_7 = NULL;
  10616. PyObject *__pyx_t_8 = NULL;
  10617. int __pyx_lineno = 0;
  10618. const char *__pyx_filename = NULL;
  10619. int __pyx_clineno = 0;
  10620. __Pyx_RefNannyDeclarations
  10621. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10622. if (__pyx_m) {
  10623. if (__pyx_m == __pyx_pyinit_module) return 0;
  10624. PyErr_SetString(PyExc_RuntimeError, "Module 'iup' has already been imported. Re-initialisation is not supported.");
  10625. return -1;
  10626. }
  10627. #else
  10628. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  10629. #endif
  10630. /*--- Module creation code ---*/
  10631. #if CYTHON_PEP489_MULTI_PHASE_INIT
  10632. __pyx_t_1 = __pyx_pyinit_module;
  10633. Py_INCREF(__pyx_t_1);
  10634. #else
  10635. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  10636. #endif
  10637. #if CYTHON_USE_MODULE_STATE
  10638. {
  10639. int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
  10640. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "iup" pseudovariable */
  10641. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10642. pystate_addmodule_run = 1;
  10643. }
  10644. #else
  10645. __pyx_m = __pyx_t_1;
  10646. #endif
  10647. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  10648. PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  10649. #endif
  10650. __pyx_mstate = __pyx_mstate_global;
  10651. CYTHON_UNUSED_VAR(__pyx_t_1);
  10652. __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  10653. Py_INCREF(__pyx_mstate->__pyx_d);
  10654. __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  10655. __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  10656. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  10657. /* ImportRefnannyAPI */
  10658. #if CYTHON_REFNANNY
  10659. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  10660. if (!__Pyx_RefNanny) {
  10661. PyErr_Clear();
  10662. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  10663. if (!__Pyx_RefNanny)
  10664. Py_FatalError("failed to import 'refnanny' module");
  10665. }
  10666. #endif
  10667. __Pyx_RefNannySetupContext("PyInit_iup", 0);
  10668. __Pyx_init_runtime_version();
  10669. 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)
  10670. __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  10671. __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  10672. __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  10673. /*--- Library function declarations ---*/
  10674. /*--- Initialize various global constants etc. ---*/
  10675. if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10676. stringtab_initialized = 1;
  10677. if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10678. if (__pyx_module_is_main_fontTools__varLib__iup) {
  10679. 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)
  10680. }
  10681. {
  10682. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  10683. if (!PyDict_GetItemString(modules, "fontTools.varLib.iup")) {
  10684. if (unlikely((PyDict_SetItemString(modules, "fontTools.varLib.iup", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10685. }
  10686. }
  10687. /*--- Builtin init code ---*/
  10688. if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10689. /*--- Constants init code ---*/
  10690. if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10691. if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10692. /*--- Global type/function init code ---*/
  10693. (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  10694. (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  10695. (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  10696. if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  10697. (void)__Pyx_modinit_type_import_code(__pyx_mstate);
  10698. (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  10699. (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  10700. /*--- Execution code ---*/
  10701. /* "fontTools/varLib/iup.py":1
  10702. * try: # <<<<<<<<<<<<<<
  10703. * import cython
  10704. * except (AttributeError, ImportError):
  10705. */
  10706. {
  10707. (void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
  10708. /*try:*/ {
  10709. /* "fontTools/varLib/iup.py":2
  10710. * try:
  10711. * import cython # <<<<<<<<<<<<<<
  10712. * except (AttributeError, ImportError):
  10713. * # if cython not installed, use mock module with no-op decorators and types
  10714. */
  10715. }
  10716. }
  10717. /* "fontTools/varLib/iup.py":6
  10718. * # if cython not installed, use mock module with no-op decorators and types
  10719. * from fontTools.misc import cython
  10720. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  10721. *
  10722. * from typing import (
  10723. */
  10724. 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)
  10725. /* "fontTools/varLib/iup.py":8
  10726. * COMPILED = cython.compiled
  10727. *
  10728. * from typing import ( # <<<<<<<<<<<<<<
  10729. * Sequence,
  10730. * Tuple,
  10731. */
  10732. {
  10733. 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};
  10734. __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)
  10735. }
  10736. __pyx_t_4 = __pyx_t_3;
  10737. __Pyx_GOTREF(__pyx_t_4);
  10738. {
  10739. 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};
  10740. for (__pyx_t_5=0; __pyx_t_5 < 3; __pyx_t_5++) {
  10741. __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)
  10742. __Pyx_GOTREF(__pyx_t_6);
  10743. 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)
  10744. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10745. }
  10746. }
  10747. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10748. /* "fontTools/varLib/iup.py":13
  10749. * Union,
  10750. * )
  10751. * from numbers import Integral, Real # <<<<<<<<<<<<<<
  10752. *
  10753. *
  10754. */
  10755. {
  10756. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Integral,__pyx_mstate_global->__pyx_n_u_Real};
  10757. __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)
  10758. }
  10759. __pyx_t_4 = __pyx_t_3;
  10760. __Pyx_GOTREF(__pyx_t_4);
  10761. {
  10762. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Integral,__pyx_mstate_global->__pyx_n_u_Real};
  10763. for (__pyx_t_5=0; __pyx_t_5 < 2; __pyx_t_5++) {
  10764. __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)
  10765. __Pyx_GOTREF(__pyx_t_6);
  10766. 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)
  10767. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10768. }
  10769. }
  10770. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10771. /* "fontTools/varLib/iup.py":16
  10772. *
  10773. *
  10774. * _Point = Tuple[Real, Real] # <<<<<<<<<<<<<<
  10775. * _Delta = Tuple[Real, Real]
  10776. * _PointSegment = Sequence[_Point]
  10777. */
  10778. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error)
  10779. __Pyx_GOTREF(__pyx_t_4);
  10780. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error)
  10781. __Pyx_GOTREF(__pyx_t_6);
  10782. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error)
  10783. __Pyx_GOTREF(__pyx_t_7);
  10784. __pyx_t_8 = PyTuple_Pack(2, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 16, __pyx_L1_error)
  10785. __Pyx_GOTREF(__pyx_t_8);
  10786. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10787. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10788. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error)
  10789. __Pyx_GOTREF(__pyx_t_7);
  10790. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10791. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  10792. 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)
  10793. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10794. /* "fontTools/varLib/iup.py":17
  10795. *
  10796. * _Point = Tuple[Real, Real]
  10797. * _Delta = Tuple[Real, Real] # <<<<<<<<<<<<<<
  10798. * _PointSegment = Sequence[_Point]
  10799. * _DeltaSegment = Sequence[_Delta]
  10800. */
  10801. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 17, __pyx_L1_error)
  10802. __Pyx_GOTREF(__pyx_t_7);
  10803. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 17, __pyx_L1_error)
  10804. __Pyx_GOTREF(__pyx_t_8);
  10805. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
  10806. __Pyx_GOTREF(__pyx_t_4);
  10807. __pyx_t_6 = PyTuple_Pack(2, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error)
  10808. __Pyx_GOTREF(__pyx_t_6);
  10809. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  10810. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10811. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error)
  10812. __Pyx_GOTREF(__pyx_t_4);
  10813. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10814. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10815. 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)
  10816. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10817. /* "fontTools/varLib/iup.py":18
  10818. * _Point = Tuple[Real, Real]
  10819. * _Delta = Tuple[Real, Real]
  10820. * _PointSegment = Sequence[_Point] # <<<<<<<<<<<<<<
  10821. * _DeltaSegment = Sequence[_Delta]
  10822. * _DeltaOrNone = Union[_Delta, None]
  10823. */
  10824. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
  10825. __Pyx_GOTREF(__pyx_t_4);
  10826. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Point); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 18, __pyx_L1_error)
  10827. __Pyx_GOTREF(__pyx_t_6);
  10828. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error)
  10829. __Pyx_GOTREF(__pyx_t_7);
  10830. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10831. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10832. 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)
  10833. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10834. /* "fontTools/varLib/iup.py":19
  10835. * _Delta = Tuple[Real, Real]
  10836. * _PointSegment = Sequence[_Point]
  10837. * _DeltaSegment = Sequence[_Delta] # <<<<<<<<<<<<<<
  10838. * _DeltaOrNone = Union[_Delta, None]
  10839. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10840. */
  10841. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L1_error)
  10842. __Pyx_GOTREF(__pyx_t_7);
  10843. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error)
  10844. __Pyx_GOTREF(__pyx_t_6);
  10845. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error)
  10846. __Pyx_GOTREF(__pyx_t_4);
  10847. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10848. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10849. 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)
  10850. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10851. /* "fontTools/varLib/iup.py":20
  10852. * _PointSegment = Sequence[_Point]
  10853. * _DeltaSegment = Sequence[_Delta]
  10854. * _DeltaOrNone = Union[_Delta, None] # <<<<<<<<<<<<<<
  10855. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10856. * _Endpoints = Sequence[Integral]
  10857. */
  10858. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error)
  10859. __Pyx_GOTREF(__pyx_t_4);
  10860. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
  10861. __Pyx_GOTREF(__pyx_t_6);
  10862. __pyx_t_7 = PyTuple_Pack(2, __pyx_t_6, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error)
  10863. __Pyx_GOTREF(__pyx_t_7);
  10864. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10865. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
  10866. __Pyx_GOTREF(__pyx_t_6);
  10867. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10868. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10869. 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)
  10870. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10871. /* "fontTools/varLib/iup.py":21
  10872. * _DeltaSegment = Sequence[_Delta]
  10873. * _DeltaOrNone = Union[_Delta, None]
  10874. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone] # <<<<<<<<<<<<<<
  10875. * _Endpoints = Sequence[Integral]
  10876. *
  10877. */
  10878. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error)
  10879. __Pyx_GOTREF(__pyx_t_6);
  10880. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_DeltaOrNone); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
  10881. __Pyx_GOTREF(__pyx_t_7);
  10882. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error)
  10883. __Pyx_GOTREF(__pyx_t_4);
  10884. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10885. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10886. 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)
  10887. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10888. /* "fontTools/varLib/iup.py":22
  10889. * _DeltaOrNone = Union[_Delta, None]
  10890. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  10891. * _Endpoints = Sequence[Integral] # <<<<<<<<<<<<<<
  10892. *
  10893. *
  10894. */
  10895. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error)
  10896. __Pyx_GOTREF(__pyx_t_4);
  10897. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Integral); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error)
  10898. __Pyx_GOTREF(__pyx_t_7);
  10899. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
  10900. __Pyx_GOTREF(__pyx_t_6);
  10901. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10902. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10903. 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)
  10904. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10905. /* "fontTools/varLib/iup.py":25
  10906. *
  10907. *
  10908. * MAX_LOOKBACK = 8 # <<<<<<<<<<<<<<
  10909. *
  10910. *
  10911. */
  10912. 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)
  10913. /* "fontTools/varLib/iup.py":91
  10914. *
  10915. *
  10916. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  10917. * """For the contour given in `coords`, interpolate any missing
  10918. * delta values in delta vector `deltas`.
  10919. */
  10920. __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
  10921. __Pyx_GOTREF(__pyx_t_6);
  10922. 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)
  10923. 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)
  10924. 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)
  10925. __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)
  10926. __Pyx_GOTREF(__pyx_t_7);
  10927. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10928. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  10929. #endif
  10930. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  10931. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10932. 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)
  10933. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10934. /* "fontTools/varLib/iup.py":143
  10935. *
  10936. *
  10937. * def iup_delta( # <<<<<<<<<<<<<<
  10938. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  10939. * ) -> _DeltaSegment:
  10940. */
  10941. __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
  10942. __Pyx_GOTREF(__pyx_t_7);
  10943. 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)
  10944. 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)
  10945. 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)
  10946. 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)
  10947. __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)
  10948. __Pyx_GOTREF(__pyx_t_6);
  10949. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10950. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  10951. #endif
  10952. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  10953. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10954. 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)
  10955. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10956. /* "fontTools/varLib/iup.py":202
  10957. *
  10958. *
  10959. * @cython.locals( # <<<<<<<<<<<<<<
  10960. * cj=cython.double,
  10961. * dj=cython.double,
  10962. */
  10963. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  10964. __Pyx_GOTREF(__pyx_t_6);
  10965. 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)
  10966. 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)
  10967. 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)
  10968. 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)
  10969. __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)
  10970. __Pyx_GOTREF(__pyx_t_7);
  10971. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10972. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  10973. #endif
  10974. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[2]);
  10975. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  10976. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10977. 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)
  10978. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10979. /* "fontTools/varLib/iup.py":293
  10980. *
  10981. *
  10982. * @cython.locals( # <<<<<<<<<<<<<<
  10983. * i=cython.int,
  10984. * j=cython.int,
  10985. */
  10986. __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 293, __pyx_L1_error)
  10987. __Pyx_GOTREF(__pyx_t_7);
  10988. 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)
  10989. 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)
  10990. 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)
  10991. 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)
  10992. __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)
  10993. __Pyx_GOTREF(__pyx_t_6);
  10994. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  10995. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  10996. #endif
  10997. if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_defaults)) __PYX_ERR(0, 293, __pyx_L1_error)
  10998. __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  10999. __Pyx_GOTREF(__pyx_t_4);
  11000. __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_t_6)->arg0 = ((PyObject*)__pyx_t_4);
  11001. __Pyx_GIVEREF(__pyx_t_4);
  11002. __pyx_t_4 = 0;
  11003. __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_9fontTools_6varLib_3iup_16__defaults__);
  11004. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11005. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11006. 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)
  11007. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11008. /* "fontTools/varLib/iup.py":346
  11009. *
  11010. *
  11011. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  11012. * """Rotate list by k items forward. Ie. item at position 0 will be
  11013. * at position k in returned list. Negative k is allowed."""
  11014. */
  11015. __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error)
  11016. __Pyx_GOTREF(__pyx_t_6);
  11017. 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)
  11018. 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)
  11019. __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)
  11020. __Pyx_GOTREF(__pyx_t_7);
  11021. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11022. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  11023. #endif
  11024. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  11025. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11026. 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)
  11027. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11028. /* "fontTools/varLib/iup.py":356
  11029. *
  11030. *
  11031. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  11032. * k %= n
  11033. * if not k:
  11034. */
  11035. __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
  11036. __Pyx_GOTREF(__pyx_t_7);
  11037. 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)
  11038. 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)
  11039. 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)
  11040. __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)
  11041. __Pyx_GOTREF(__pyx_t_6);
  11042. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11043. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  11044. #endif
  11045. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11046. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11047. 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)
  11048. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11049. /* "fontTools/varLib/iup.py":363
  11050. *
  11051. *
  11052. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  11053. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  11054. * ) -> _DeltaOrNoneSegment:
  11055. */
  11056. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error)
  11057. __Pyx_GOTREF(__pyx_t_6);
  11058. 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)
  11059. 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)
  11060. 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)
  11061. 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)
  11062. __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)
  11063. __Pyx_GOTREF(__pyx_t_7);
  11064. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11065. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7);
  11066. #endif
  11067. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[3]);
  11068. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6);
  11069. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11070. 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)
  11071. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11072. /* "fontTools/varLib/iup.py":464
  11073. *
  11074. *
  11075. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  11076. * deltas: _DeltaSegment,
  11077. * coords: _PointSegment,
  11078. */
  11079. __pyx_t_7 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 464, __pyx_L1_error)
  11080. __Pyx_GOTREF(__pyx_t_7);
  11081. 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)
  11082. 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)
  11083. 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)
  11084. 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)
  11085. 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)
  11086. __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)
  11087. __Pyx_GOTREF(__pyx_t_6);
  11088. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  11089. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6);
  11090. #endif
  11091. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[3]);
  11092. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_7);
  11093. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11094. 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)
  11095. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11096. /* "fontTools/varLib/iup.py":1
  11097. * try: # <<<<<<<<<<<<<<
  11098. * import cython
  11099. * except (AttributeError, ImportError):
  11100. */
  11101. __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  11102. __Pyx_GOTREF(__pyx_t_6);
  11103. 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)
  11104. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11105. /*--- Wrapped vars code ---*/
  11106. goto __pyx_L0;
  11107. __pyx_L1_error:;
  11108. __Pyx_XDECREF(__pyx_t_4);
  11109. __Pyx_XDECREF(__pyx_t_6);
  11110. __Pyx_XDECREF(__pyx_t_7);
  11111. __Pyx_XDECREF(__pyx_t_8);
  11112. if (__pyx_m) {
  11113. if (__pyx_mstate->__pyx_d && stringtab_initialized) {
  11114. __Pyx_AddTraceback("init fontTools.varLib.iup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11115. }
  11116. #if !CYTHON_USE_MODULE_STATE
  11117. Py_CLEAR(__pyx_m);
  11118. #else
  11119. Py_DECREF(__pyx_m);
  11120. if (pystate_addmodule_run) {
  11121. PyObject *tp, *value, *tb;
  11122. PyErr_Fetch(&tp, &value, &tb);
  11123. PyState_RemoveModule(&__pyx_moduledef);
  11124. PyErr_Restore(tp, value, tb);
  11125. }
  11126. #endif
  11127. } else if (!PyErr_Occurred()) {
  11128. PyErr_SetString(PyExc_ImportError, "init fontTools.varLib.iup");
  11129. }
  11130. __pyx_L0:;
  11131. __Pyx_RefNannyFinishContext();
  11132. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11133. return (__pyx_m != NULL) ? 0 : -1;
  11134. #else
  11135. return __pyx_m;
  11136. #endif
  11137. }
  11138. /* #### Code section: pystring_table ### */
  11139. /* #### Code section: cached_builtins ### */
  11140. static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  11141. CYTHON_UNUSED_VAR(__pyx_mstate);
  11142. __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 88, __pyx_L1_error)
  11143. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 103, __pyx_L1_error)
  11144. __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_max); if (!__pyx_builtin_max) __PYX_ERR(0, 404, __pyx_L1_error)
  11145. /* Cached unbound methods */
  11146. __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  11147. __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  11148. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  11149. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  11150. __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  11151. __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  11152. return 0;
  11153. __pyx_L1_error:;
  11154. return -1;
  11155. }
  11156. /* #### Code section: cached_constants ### */
  11157. static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  11158. __Pyx_RefNannyDeclarations
  11159. CYTHON_UNUSED_VAR(__pyx_mstate);
  11160. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  11161. /* "fontTools/varLib/iup.py":50
  11162. * # rd1 = reference delta 1
  11163. * out_arrays = [None, None]
  11164. * for j in 0, 1: # <<<<<<<<<<<<<<
  11165. * out_arrays[j] = out = []
  11166. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  11167. */
  11168. __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)
  11169. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  11170. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);
  11171. /* "fontTools/varLib/iup.py":106
  11172. * if not indices:
  11173. * # All deltas are None. Return 0,0 for all.
  11174. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  11175. *
  11176. * out = []
  11177. */
  11178. __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)
  11179. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  11180. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  11181. /* "fontTools/varLib/iup.py":202
  11182. *
  11183. *
  11184. * @cython.locals( # <<<<<<<<<<<<<<
  11185. * cj=cython.double,
  11186. * dj=cython.double,
  11187. */
  11188. __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)
  11189. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  11190. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
  11191. /* "fontTools/varLib/iup.py":363
  11192. *
  11193. *
  11194. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  11195. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  11196. * ) -> _DeltaOrNoneSegment:
  11197. */
  11198. __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)
  11199. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  11200. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  11201. #if CYTHON_IMMORTAL_CONSTANTS
  11202. {
  11203. PyObject **table = __pyx_mstate->__pyx_tuple;
  11204. for (Py_ssize_t i=0; i<4; ++i) {
  11205. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11206. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11207. #else
  11208. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11209. #endif
  11210. }
  11211. }
  11212. #endif
  11213. __Pyx_RefNannyFinishContext();
  11214. return 0;
  11215. __pyx_L1_error:;
  11216. __Pyx_RefNannyFinishContext();
  11217. return -1;
  11218. }
  11219. /* #### Code section: init_constants ### */
  11220. static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  11221. CYTHON_UNUSED_VAR(__pyx_mstate);
  11222. {
  11223. 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}};
  11224. #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1925 bytes) */
  11225. 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";
  11226. PyObject *data = __Pyx_DecompressString(cstring, 1925, 2);
  11227. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  11228. const char* const bytes = __Pyx_PyBytes_AsString(data);
  11229. #if !CYTHON_ASSUME_SAFE_MACROS
  11230. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  11231. #endif
  11232. #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1891 bytes) */
  11233. 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#";
  11234. PyObject *data = __Pyx_DecompressString(cstring, 1891, 1);
  11235. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  11236. const char* const bytes = __Pyx_PyBytes_AsString(data);
  11237. #if !CYTHON_ASSUME_SAFE_MACROS
  11238. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  11239. #endif
  11240. #else /* compression: none (3193 bytes) */
  11241. 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";
  11242. PyObject *data = NULL;
  11243. CYTHON_UNUSED_VAR(__Pyx_DecompressString);
  11244. #endif
  11245. PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
  11246. Py_ssize_t pos = 0;
  11247. for (int i = 0; i < 117; i++) {
  11248. Py_ssize_t bytes_length = index[i].length;
  11249. PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
  11250. if (likely(string) && i >= 9) PyUnicode_InternInPlace(&string);
  11251. if (unlikely(!string)) {
  11252. Py_XDECREF(data);
  11253. __PYX_ERR(0, 1, __pyx_L1_error)
  11254. }
  11255. stringtab[i] = string;
  11256. pos += bytes_length;
  11257. }
  11258. for (int i = 117; i < 128; i++) {
  11259. Py_ssize_t bytes_length = index[i].length;
  11260. PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
  11261. stringtab[i] = string;
  11262. pos += bytes_length;
  11263. if (unlikely(!string)) {
  11264. Py_XDECREF(data);
  11265. __PYX_ERR(0, 1, __pyx_L1_error)
  11266. }
  11267. }
  11268. Py_XDECREF(data);
  11269. for (Py_ssize_t i = 0; i < 128; i++) {
  11270. if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
  11271. __PYX_ERR(0, 1, __pyx_L1_error)
  11272. }
  11273. }
  11274. #if CYTHON_IMMORTAL_CONSTANTS
  11275. {
  11276. PyObject **table = stringtab + 117;
  11277. for (Py_ssize_t i=0; i<11; ++i) {
  11278. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11279. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11280. #else
  11281. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11282. #endif
  11283. }
  11284. }
  11285. #endif
  11286. }
  11287. {
  11288. PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
  11289. double const c_constants[] = {0.0};
  11290. for (int i = 0; i < 1; i++) {
  11291. numbertab[i] = PyFloat_FromDouble(c_constants[i]);
  11292. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  11293. }
  11294. }
  11295. {
  11296. PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 1;
  11297. int8_t const cint_constants_1[] = {0,-1,1,2,3,4,8};
  11298. for (int i = 0; i < 7; i++) {
  11299. numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]);
  11300. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  11301. }
  11302. }
  11303. #if CYTHON_IMMORTAL_CONSTANTS
  11304. {
  11305. PyObject **table = __pyx_mstate->__pyx_number_tab;
  11306. for (Py_ssize_t i=0; i<8; ++i) {
  11307. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  11308. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  11309. #else
  11310. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  11311. #endif
  11312. }
  11313. }
  11314. #endif
  11315. return 0;
  11316. __pyx_L1_error:;
  11317. return -1;
  11318. }
  11319. /* #### Code section: init_codeobjects ### */
  11320. typedef struct {
  11321. unsigned int argcount : 3;
  11322. unsigned int num_posonly_args : 1;
  11323. unsigned int num_kwonly_args : 1;
  11324. unsigned int nlocals : 5;
  11325. unsigned int flags : 10;
  11326. unsigned int first_line : 9;
  11327. } __Pyx_PyCode_New_function_description;
  11328. /* NewCodeObj.proto */
  11329. static PyObject* __Pyx_PyCode_New(
  11330. const __Pyx_PyCode_New_function_description descr,
  11331. PyObject * const *varnames,
  11332. PyObject *filename,
  11333. PyObject *funcname,
  11334. PyObject *line_table,
  11335. PyObject *tuple_dedup_map
  11336. );
  11337. static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  11338. PyObject* tuple_dedup_map = PyDict_New();
  11339. if (unlikely(!tuple_dedup_map)) return -1;
  11340. {
  11341. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 197};
  11342. 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};
  11343. __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;
  11344. }
  11345. {
  11346. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 378};
  11347. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p};
  11348. __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;
  11349. }
  11350. {
  11351. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 387};
  11352. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_d};
  11353. __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;
  11354. }
  11355. {
  11356. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 91};
  11357. 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};
  11358. __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;
  11359. }
  11360. {
  11361. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 143};
  11362. 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};
  11363. __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;
  11364. }
  11365. {
  11366. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 24, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 202};
  11367. 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};
  11368. __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;
  11369. }
  11370. {
  11371. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 293};
  11372. 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};
  11373. __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;
  11374. }
  11375. {
  11376. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 346};
  11377. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_l, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_n};
  11378. __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;
  11379. }
  11380. {
  11381. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 356};
  11382. 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};
  11383. __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;
  11384. }
  11385. {
  11386. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 363};
  11387. 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};
  11388. __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;
  11389. }
  11390. {
  11391. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 464};
  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_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};
  11393. __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;
  11394. }
  11395. Py_DECREF(tuple_dedup_map);
  11396. return 0;
  11397. bad:
  11398. Py_DECREF(tuple_dedup_map);
  11399. return -1;
  11400. }
  11401. /* #### Code section: init_globals ### */
  11402. static int __Pyx_InitGlobals(void) {
  11403. /* PythonCompatibility.init */
  11404. if (likely(__Pyx_init_co_variables() == 0)); else
  11405. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11406. /* AssertionsEnabled.init */
  11407. if (likely(__Pyx_init_assertions_enabled() == 0)); else
  11408. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11409. /* CommonTypesMetaclass.init */
  11410. if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  11411. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11412. /* CachedMethodType.init */
  11413. #if CYTHON_COMPILING_IN_LIMITED_API
  11414. {
  11415. PyObject *typesModule=NULL;
  11416. typesModule = PyImport_ImportModule("types");
  11417. if (typesModule) {
  11418. __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
  11419. Py_DECREF(typesModule);
  11420. }
  11421. } // error handling follows
  11422. #endif
  11423. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11424. /* CythonFunctionShared.init */
  11425. if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  11426. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11427. /* Generator.init */
  11428. if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  11429. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  11430. return 0;
  11431. __pyx_L1_error:;
  11432. return -1;
  11433. }
  11434. /* #### Code section: cleanup_globals ### */
  11435. /* #### Code section: cleanup_module ### */
  11436. /* #### Code section: main_method ### */
  11437. /* #### Code section: utility_code_pragmas ### */
  11438. #ifdef _MSC_VER
  11439. #pragma warning( push )
  11440. /* Warning 4127: conditional expression is constant
  11441. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  11442. * compile-time, so this warning is not useful
  11443. */
  11444. #pragma warning( disable : 4127 )
  11445. #endif
  11446. /* #### Code section: utility_code_def ### */
  11447. /* --- Runtime support code --- */
  11448. /* Refnanny */
  11449. #if CYTHON_REFNANNY
  11450. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  11451. PyObject *m = NULL, *p = NULL;
  11452. void *r = NULL;
  11453. m = PyImport_ImportModule(modname);
  11454. if (!m) goto end;
  11455. p = PyObject_GetAttrString(m, "RefNannyAPI");
  11456. if (!p) goto end;
  11457. r = PyLong_AsVoidPtr(p);
  11458. end:
  11459. Py_XDECREF(p);
  11460. Py_XDECREF(m);
  11461. return (__Pyx_RefNannyAPIStruct *)r;
  11462. }
  11463. #endif
  11464. /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
  11465. #if CYTHON_FAST_THREAD_STATE
  11466. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  11467. Py_ssize_t i, n;
  11468. n = PyTuple_GET_SIZE(tuple);
  11469. for (i=0; i<n; i++) {
  11470. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  11471. }
  11472. for (i=0; i<n; i++) {
  11473. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  11474. }
  11475. return 0;
  11476. }
  11477. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  11478. int result;
  11479. PyObject *exc_type;
  11480. #if PY_VERSION_HEX >= 0x030C00A6
  11481. PyObject *current_exception = tstate->current_exception;
  11482. if (unlikely(!current_exception)) return 0;
  11483. exc_type = (PyObject*) Py_TYPE(current_exception);
  11484. if (exc_type == err) return 1;
  11485. #else
  11486. exc_type = tstate->curexc_type;
  11487. if (exc_type == err) return 1;
  11488. if (unlikely(!exc_type)) return 0;
  11489. #endif
  11490. #if CYTHON_AVOID_BORROWED_REFS
  11491. Py_INCREF(exc_type);
  11492. #endif
  11493. if (unlikely(PyTuple_Check(err))) {
  11494. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  11495. } else {
  11496. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  11497. }
  11498. #if CYTHON_AVOID_BORROWED_REFS
  11499. Py_DECREF(exc_type);
  11500. #endif
  11501. return result;
  11502. }
  11503. #endif
  11504. /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
  11505. #if CYTHON_FAST_THREAD_STATE
  11506. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  11507. #if PY_VERSION_HEX >= 0x030C00A6
  11508. PyObject *tmp_value;
  11509. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  11510. if (value) {
  11511. #if CYTHON_COMPILING_IN_CPYTHON
  11512. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  11513. #endif
  11514. PyException_SetTraceback(value, tb);
  11515. }
  11516. tmp_value = tstate->current_exception;
  11517. tstate->current_exception = value;
  11518. Py_XDECREF(tmp_value);
  11519. Py_XDECREF(type);
  11520. Py_XDECREF(tb);
  11521. #else
  11522. PyObject *tmp_type, *tmp_value, *tmp_tb;
  11523. tmp_type = tstate->curexc_type;
  11524. tmp_value = tstate->curexc_value;
  11525. tmp_tb = tstate->curexc_traceback;
  11526. tstate->curexc_type = type;
  11527. tstate->curexc_value = value;
  11528. tstate->curexc_traceback = tb;
  11529. Py_XDECREF(tmp_type);
  11530. Py_XDECREF(tmp_value);
  11531. Py_XDECREF(tmp_tb);
  11532. #endif
  11533. }
  11534. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  11535. #if PY_VERSION_HEX >= 0x030C00A6
  11536. PyObject* exc_value;
  11537. exc_value = tstate->current_exception;
  11538. tstate->current_exception = 0;
  11539. *value = exc_value;
  11540. *type = NULL;
  11541. *tb = NULL;
  11542. if (exc_value) {
  11543. *type = (PyObject*) Py_TYPE(exc_value);
  11544. Py_INCREF(*type);
  11545. #if CYTHON_COMPILING_IN_CPYTHON
  11546. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  11547. Py_XINCREF(*tb);
  11548. #else
  11549. *tb = PyException_GetTraceback(exc_value);
  11550. #endif
  11551. }
  11552. #else
  11553. *type = tstate->curexc_type;
  11554. *value = tstate->curexc_value;
  11555. *tb = tstate->curexc_traceback;
  11556. tstate->curexc_type = 0;
  11557. tstate->curexc_value = 0;
  11558. tstate->curexc_traceback = 0;
  11559. #endif
  11560. }
  11561. #endif
  11562. /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
  11563. #if CYTHON_USE_TYPE_SLOTS
  11564. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  11565. PyTypeObject* tp = Py_TYPE(obj);
  11566. if (likely(tp->tp_getattro))
  11567. return tp->tp_getattro(obj, attr_name);
  11568. return PyObject_GetAttr(obj, attr_name);
  11569. }
  11570. #endif
  11571. /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
  11572. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  11573. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  11574. __Pyx_PyThreadState_declare
  11575. __Pyx_PyThreadState_assign
  11576. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  11577. __Pyx_PyErr_Clear();
  11578. }
  11579. #endif
  11580. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  11581. PyObject *result;
  11582. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  11583. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  11584. return result;
  11585. #else
  11586. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
  11587. PyTypeObject* tp = Py_TYPE(obj);
  11588. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  11589. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  11590. }
  11591. #endif
  11592. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  11593. if (unlikely(!result)) {
  11594. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  11595. }
  11596. return result;
  11597. #endif
  11598. }
  11599. /* GetBuiltinName */
  11600. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  11601. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
  11602. if (unlikely(!result) && !PyErr_Occurred()) {
  11603. PyErr_Format(PyExc_NameError,
  11604. "name '%U' is not defined", name);
  11605. }
  11606. return result;
  11607. }
  11608. /* SetItemInt */
  11609. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  11610. int r;
  11611. if (unlikely(!j)) return -1;
  11612. r = PyObject_SetItem(o, j, v);
  11613. Py_DECREF(j);
  11614. return r;
  11615. }
  11616. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  11617. int wraparound, int boundscheck, int unsafe_shared) {
  11618. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11619. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
  11620. if (is_list || PyList_CheckExact(o)) {
  11621. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  11622. if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
  11623. Py_INCREF(v);
  11624. return PyList_SetItem(o, n, v);
  11625. } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  11626. PyObject* old;
  11627. Py_INCREF(v);
  11628. old = PyList_GET_ITEM(o, n);
  11629. PyList_SET_ITEM(o, n, v);
  11630. Py_DECREF(old);
  11631. return 0;
  11632. }
  11633. } else
  11634. #endif
  11635. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  11636. {
  11637. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  11638. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  11639. if (!is_list && mm && mm->mp_ass_subscript) {
  11640. int r;
  11641. PyObject *key = PyLong_FromSsize_t(i);
  11642. if (unlikely(!key)) return -1;
  11643. r = mm->mp_ass_subscript(o, key, v);
  11644. Py_DECREF(key);
  11645. return r;
  11646. }
  11647. if (is_list || likely(sm && sm->sq_ass_item)) {
  11648. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  11649. Py_ssize_t l = sm->sq_length(o);
  11650. if (likely(l >= 0)) {
  11651. i += l;
  11652. } else {
  11653. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  11654. return -1;
  11655. PyErr_Clear();
  11656. }
  11657. }
  11658. return sm->sq_ass_item(o, i, v);
  11659. }
  11660. }
  11661. #else
  11662. if (is_list || !PyMapping_Check(o)) {
  11663. return PySequence_SetItem(o, i, v);
  11664. }
  11665. #endif
  11666. (void)wraparound;
  11667. (void)boundscheck;
  11668. return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
  11669. }
  11670. /* GetItemInt */
  11671. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  11672. PyObject *r;
  11673. if (unlikely(!j)) return NULL;
  11674. r = PyObject_GetItem(o, j);
  11675. Py_DECREF(j);
  11676. return r;
  11677. }
  11678. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  11679. int wraparound, int boundscheck, int unsafe_shared) {
  11680. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11681. #if CYTHON_ASSUME_SAFE_SIZE
  11682. Py_ssize_t wrapped_i = i;
  11683. if (wraparound & unlikely(i < 0)) {
  11684. wrapped_i += PyList_GET_SIZE(o);
  11685. }
  11686. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
  11687. return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
  11688. } else
  11689. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  11690. return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
  11691. }
  11692. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11693. #else
  11694. (void)wraparound;
  11695. (void)boundscheck;
  11696. return PySequence_GetItem(o, i);
  11697. #endif
  11698. }
  11699. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  11700. int wraparound, int boundscheck, int unsafe_shared) {
  11701. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11702. #if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11703. Py_ssize_t wrapped_i = i;
  11704. if (wraparound & unlikely(i < 0)) {
  11705. wrapped_i += PyTuple_GET_SIZE(o);
  11706. }
  11707. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  11708. return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
  11709. }
  11710. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11711. #else
  11712. (void)wraparound;
  11713. (void)boundscheck;
  11714. return PySequence_GetItem(o, i);
  11715. #endif
  11716. }
  11717. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  11718. int wraparound, int boundscheck, int unsafe_shared) {
  11719. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  11720. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  11721. if (is_list || PyList_CheckExact(o)) {
  11722. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  11723. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
  11724. return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
  11725. } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  11726. return __Pyx_NewRef(PyList_GET_ITEM(o, n));
  11727. }
  11728. } else
  11729. #if !CYTHON_AVOID_BORROWED_REFS
  11730. if (PyTuple_CheckExact(o)) {
  11731. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  11732. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  11733. return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
  11734. }
  11735. } else
  11736. #endif
  11737. #endif
  11738. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  11739. {
  11740. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  11741. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  11742. if (!is_list && mm && mm->mp_subscript) {
  11743. PyObject *r, *key = PyLong_FromSsize_t(i);
  11744. if (unlikely(!key)) return NULL;
  11745. r = mm->mp_subscript(o, key);
  11746. Py_DECREF(key);
  11747. return r;
  11748. }
  11749. if (is_list || likely(sm && sm->sq_item)) {
  11750. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  11751. Py_ssize_t l = sm->sq_length(o);
  11752. if (likely(l >= 0)) {
  11753. i += l;
  11754. } else {
  11755. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  11756. return NULL;
  11757. PyErr_Clear();
  11758. }
  11759. }
  11760. return sm->sq_item(o, i);
  11761. }
  11762. }
  11763. #else
  11764. if (is_list || !PyMapping_Check(o)) {
  11765. return PySequence_GetItem(o, i);
  11766. }
  11767. #endif
  11768. (void)wraparound;
  11769. (void)boundscheck;
  11770. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  11771. }
  11772. /* PyObjectCall */
  11773. #if CYTHON_COMPILING_IN_CPYTHON
  11774. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  11775. PyObject *result;
  11776. ternaryfunc call = Py_TYPE(func)->tp_call;
  11777. if (unlikely(!call))
  11778. return PyObject_Call(func, arg, kw);
  11779. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  11780. return NULL;
  11781. result = (*call)(func, arg, kw);
  11782. Py_LeaveRecursiveCall();
  11783. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  11784. PyErr_SetString(
  11785. PyExc_SystemError,
  11786. "NULL result without error in PyObject_Call");
  11787. }
  11788. return result;
  11789. }
  11790. #endif
  11791. /* TupleAndListFromArray (used by fastcall) */
  11792. #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
  11793. static CYTHON_INLINE PyObject *
  11794. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  11795. {
  11796. PyObject *res;
  11797. Py_ssize_t i;
  11798. if (n <= 0) {
  11799. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  11800. }
  11801. res = PyTuple_New(n);
  11802. if (unlikely(res == NULL)) return NULL;
  11803. for (i = 0; i < n; i++) {
  11804. if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
  11805. Py_DECREF(res);
  11806. return NULL;
  11807. }
  11808. Py_INCREF(src[i]);
  11809. }
  11810. return res;
  11811. }
  11812. #elif CYTHON_COMPILING_IN_CPYTHON
  11813. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  11814. PyObject *v;
  11815. Py_ssize_t i;
  11816. for (i = 0; i < length; i++) {
  11817. v = dest[i] = src[i];
  11818. Py_INCREF(v);
  11819. }
  11820. }
  11821. static CYTHON_INLINE PyObject *
  11822. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  11823. {
  11824. PyObject *res;
  11825. if (n <= 0) {
  11826. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  11827. }
  11828. res = PyTuple_New(n);
  11829. if (unlikely(res == NULL)) return NULL;
  11830. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  11831. return res;
  11832. }
  11833. static CYTHON_INLINE PyObject *
  11834. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  11835. {
  11836. PyObject *res;
  11837. if (n <= 0) {
  11838. return PyList_New(0);
  11839. }
  11840. res = PyList_New(n);
  11841. if (unlikely(res == NULL)) return NULL;
  11842. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  11843. return res;
  11844. }
  11845. #endif
  11846. /* BytesEquals (used by UnicodeEquals) */
  11847. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  11848. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
  11849. !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
  11850. return PyObject_RichCompareBool(s1, s2, equals);
  11851. #else
  11852. if (s1 == s2) {
  11853. return (equals == Py_EQ);
  11854. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  11855. const char *ps1, *ps2;
  11856. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  11857. if (length != PyBytes_GET_SIZE(s2))
  11858. return (equals == Py_NE);
  11859. ps1 = PyBytes_AS_STRING(s1);
  11860. ps2 = PyBytes_AS_STRING(s2);
  11861. if (ps1[0] != ps2[0]) {
  11862. return (equals == Py_NE);
  11863. } else if (length == 1) {
  11864. return (equals == Py_EQ);
  11865. } else {
  11866. int result;
  11867. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  11868. Py_hash_t hash1, hash2;
  11869. hash1 = ((PyBytesObject*)s1)->ob_shash;
  11870. hash2 = ((PyBytesObject*)s2)->ob_shash;
  11871. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  11872. return (equals == Py_NE);
  11873. }
  11874. #endif
  11875. result = memcmp(ps1, ps2, (size_t)length);
  11876. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  11877. }
  11878. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  11879. return (equals == Py_NE);
  11880. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  11881. return (equals == Py_NE);
  11882. } else {
  11883. int result;
  11884. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  11885. if (!py_result)
  11886. return -1;
  11887. result = __Pyx_PyObject_IsTrue(py_result);
  11888. Py_DECREF(py_result);
  11889. return result;
  11890. }
  11891. #endif
  11892. }
  11893. /* UnicodeEquals (used by fastcall) */
  11894. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  11895. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  11896. return PyObject_RichCompareBool(s1, s2, equals);
  11897. #else
  11898. int s1_is_unicode, s2_is_unicode;
  11899. if (s1 == s2) {
  11900. goto return_eq;
  11901. }
  11902. s1_is_unicode = PyUnicode_CheckExact(s1);
  11903. s2_is_unicode = PyUnicode_CheckExact(s2);
  11904. if (s1_is_unicode & s2_is_unicode) {
  11905. Py_ssize_t length, length2;
  11906. int kind;
  11907. void *data1, *data2;
  11908. #if !CYTHON_COMPILING_IN_LIMITED_API
  11909. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  11910. return -1;
  11911. #endif
  11912. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  11913. #if !CYTHON_ASSUME_SAFE_SIZE
  11914. if (unlikely(length < 0)) return -1;
  11915. #endif
  11916. length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
  11917. #if !CYTHON_ASSUME_SAFE_SIZE
  11918. if (unlikely(length2 < 0)) return -1;
  11919. #endif
  11920. if (length != length2) {
  11921. goto return_ne;
  11922. }
  11923. #if CYTHON_USE_UNICODE_INTERNALS
  11924. {
  11925. Py_hash_t hash1, hash2;
  11926. hash1 = ((PyASCIIObject*)s1)->hash;
  11927. hash2 = ((PyASCIIObject*)s2)->hash;
  11928. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  11929. goto return_ne;
  11930. }
  11931. }
  11932. #endif
  11933. kind = __Pyx_PyUnicode_KIND(s1);
  11934. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  11935. goto return_ne;
  11936. }
  11937. data1 = __Pyx_PyUnicode_DATA(s1);
  11938. data2 = __Pyx_PyUnicode_DATA(s2);
  11939. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  11940. goto return_ne;
  11941. } else if (length == 1) {
  11942. goto return_eq;
  11943. } else {
  11944. int result = memcmp(data1, data2, (size_t)(length * kind));
  11945. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  11946. }
  11947. } else if ((s1 == Py_None) & s2_is_unicode) {
  11948. goto return_ne;
  11949. } else if ((s2 == Py_None) & s1_is_unicode) {
  11950. goto return_ne;
  11951. } else {
  11952. int result;
  11953. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  11954. if (!py_result)
  11955. return -1;
  11956. result = __Pyx_PyObject_IsTrue(py_result);
  11957. Py_DECREF(py_result);
  11958. return result;
  11959. }
  11960. return_eq:
  11961. return (equals == Py_EQ);
  11962. return_ne:
  11963. return (equals == Py_NE);
  11964. #endif
  11965. }
  11966. /* fastcall */
  11967. #if CYTHON_METH_FASTCALL
  11968. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  11969. {
  11970. Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
  11971. #if !CYTHON_ASSUME_SAFE_SIZE
  11972. if (unlikely(n == -1)) return NULL;
  11973. #endif
  11974. for (i = 0; i < n; i++)
  11975. {
  11976. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  11977. #if !CYTHON_ASSUME_SAFE_MACROS
  11978. if (unlikely(!namei)) return NULL;
  11979. #endif
  11980. if (s == namei) return kwvalues[i];
  11981. }
  11982. for (i = 0; i < n; i++)
  11983. {
  11984. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  11985. #if !CYTHON_ASSUME_SAFE_MACROS
  11986. if (unlikely(!namei)) return NULL;
  11987. #endif
  11988. int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
  11989. if (unlikely(eq != 0)) {
  11990. if (unlikely(eq < 0)) return NULL;
  11991. return kwvalues[i];
  11992. }
  11993. }
  11994. return NULL;
  11995. }
  11996. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  11997. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  11998. Py_ssize_t i, nkwargs;
  11999. PyObject *dict;
  12000. #if !CYTHON_ASSUME_SAFE_SIZE
  12001. nkwargs = PyTuple_Size(kwnames);
  12002. if (unlikely(nkwargs < 0)) return NULL;
  12003. #else
  12004. nkwargs = PyTuple_GET_SIZE(kwnames);
  12005. #endif
  12006. dict = PyDict_New();
  12007. if (unlikely(!dict))
  12008. return NULL;
  12009. for (i=0; i<nkwargs; i++) {
  12010. #if !CYTHON_ASSUME_SAFE_MACROS
  12011. PyObject *key = PyTuple_GetItem(kwnames, i);
  12012. if (!key) goto bad;
  12013. #else
  12014. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  12015. #endif
  12016. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  12017. goto bad;
  12018. }
  12019. return dict;
  12020. bad:
  12021. Py_DECREF(dict);
  12022. return NULL;
  12023. }
  12024. #endif
  12025. #endif
  12026. /* PyObjectCallMethO (used by PyObjectFastCall) */
  12027. #if CYTHON_COMPILING_IN_CPYTHON
  12028. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  12029. PyObject *self, *result;
  12030. PyCFunction cfunc;
  12031. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  12032. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  12033. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  12034. return NULL;
  12035. result = cfunc(self, arg);
  12036. Py_LeaveRecursiveCall();
  12037. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  12038. PyErr_SetString(
  12039. PyExc_SystemError,
  12040. "NULL result without error in PyObject_Call");
  12041. }
  12042. return result;
  12043. }
  12044. #endif
  12045. /* PyObjectFastCall (used by PyObjectCallOneArg) */
  12046. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  12047. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
  12048. PyObject *argstuple;
  12049. PyObject *result = 0;
  12050. size_t i;
  12051. argstuple = PyTuple_New((Py_ssize_t)nargs);
  12052. if (unlikely(!argstuple)) return NULL;
  12053. for (i = 0; i < nargs; i++) {
  12054. Py_INCREF(args[i]);
  12055. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
  12056. }
  12057. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  12058. bad:
  12059. Py_DECREF(argstuple);
  12060. return result;
  12061. }
  12062. #endif
  12063. #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  12064. #if PY_VERSION_HEX < 0x03090000
  12065. #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  12066. #elif CYTHON_COMPILING_IN_CPYTHON
  12067. static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
  12068. PyTypeObject *tp = Py_TYPE(callable);
  12069. #if defined(__Pyx_CyFunction_USED)
  12070. if (__Pyx_CyFunction_CheckExact(callable)) {
  12071. return __Pyx_CyFunction_func_vectorcall(callable);
  12072. }
  12073. #endif
  12074. if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
  12075. return NULL;
  12076. }
  12077. assert(PyCallable_Check(callable));
  12078. Py_ssize_t offset = tp->tp_vectorcall_offset;
  12079. assert(offset > 0);
  12080. vectorcallfunc ptr;
  12081. memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
  12082. return ptr;
  12083. }
  12084. #else
  12085. #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  12086. #endif
  12087. #endif
  12088. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
  12089. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  12090. #if CYTHON_COMPILING_IN_CPYTHON
  12091. if (nargs == 0 && kwargs == NULL) {
  12092. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  12093. return __Pyx_PyObject_CallMethO(func, NULL);
  12094. }
  12095. else if (nargs == 1 && kwargs == NULL) {
  12096. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  12097. return __Pyx_PyObject_CallMethO(func, args[0]);
  12098. }
  12099. #endif
  12100. if (kwargs == NULL) {
  12101. #if CYTHON_VECTORCALL
  12102. #if CYTHON_COMPILING_IN_LIMITED_API
  12103. return PyObject_Vectorcall(func, args, _nargs, NULL);
  12104. #else
  12105. vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
  12106. if (f) {
  12107. return f(func, args, _nargs, NULL);
  12108. }
  12109. #endif
  12110. #endif
  12111. }
  12112. if (nargs == 0) {
  12113. return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
  12114. }
  12115. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  12116. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  12117. #else
  12118. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  12119. #endif
  12120. }
  12121. /* PyObjectCallOneArg (used by CallUnboundCMethod0) */
  12122. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  12123. PyObject *args[2] = {NULL, arg};
  12124. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  12125. }
  12126. /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
  12127. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  12128. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
  12129. PyObject *result;
  12130. PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
  12131. if (unlikely(!selfless_args)) return NULL;
  12132. result = PyObject_Call(method, selfless_args, kwargs);
  12133. Py_DECREF(selfless_args);
  12134. return result;
  12135. }
  12136. #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
  12137. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
  12138. return _PyObject_Vectorcall
  12139. (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
  12140. }
  12141. #else
  12142. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
  12143. return
  12144. #if PY_VERSION_HEX < 0x03090000
  12145. _PyObject_Vectorcall
  12146. #else
  12147. PyObject_Vectorcall
  12148. #endif
  12149. (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
  12150. }
  12151. #endif
  12152. static PyMethodDef __Pyx_UnboundCMethod_Def = {
  12153. "CythonUnboundCMethod",
  12154. __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
  12155. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  12156. METH_VARARGS | METH_KEYWORDS,
  12157. #else
  12158. METH_FASTCALL | METH_KEYWORDS,
  12159. #endif
  12160. NULL
  12161. };
  12162. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  12163. PyObject *method, *result=NULL;
  12164. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  12165. if (unlikely(!method))
  12166. return -1;
  12167. result = method;
  12168. #if CYTHON_COMPILING_IN_CPYTHON
  12169. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  12170. {
  12171. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  12172. target->func = descr->d_method->ml_meth;
  12173. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  12174. } else
  12175. #endif
  12176. #if CYTHON_COMPILING_IN_PYPY
  12177. #else
  12178. if (PyCFunction_Check(method))
  12179. #endif
  12180. {
  12181. PyObject *self;
  12182. int self_found;
  12183. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  12184. self = PyObject_GetAttrString(method, "__self__");
  12185. if (!self) {
  12186. PyErr_Clear();
  12187. }
  12188. #else
  12189. self = PyCFunction_GET_SELF(method);
  12190. #endif
  12191. self_found = (self && self != Py_None);
  12192. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  12193. Py_XDECREF(self);
  12194. #endif
  12195. if (self_found) {
  12196. PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
  12197. if (unlikely(!unbound_method)) return -1;
  12198. Py_DECREF(method);
  12199. result = unbound_method;
  12200. }
  12201. }
  12202. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12203. if (unlikely(target->method)) {
  12204. Py_DECREF(result);
  12205. } else
  12206. #endif
  12207. target->method = result;
  12208. return 0;
  12209. }
  12210. /* CallUnboundCMethod0 */
  12211. #if CYTHON_COMPILING_IN_CPYTHON
  12212. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  12213. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  12214. if (likely(was_initialized == 2 && cfunc->func)) {
  12215. if (likely(cfunc->flag == METH_NOARGS))
  12216. return __Pyx_CallCFunction(cfunc, self, NULL);
  12217. if (likely(cfunc->flag == METH_FASTCALL))
  12218. return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
  12219. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  12220. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
  12221. if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
  12222. return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  12223. if (cfunc->flag == METH_VARARGS)
  12224. return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
  12225. return __Pyx__CallUnboundCMethod0(cfunc, self);
  12226. }
  12227. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12228. else if (unlikely(was_initialized == 1)) {
  12229. __Pyx_CachedCFunction tmp_cfunc = {
  12230. #ifndef __cplusplus
  12231. 0
  12232. #endif
  12233. };
  12234. tmp_cfunc.type = cfunc->type;
  12235. tmp_cfunc.method_name = cfunc->method_name;
  12236. return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
  12237. }
  12238. #endif
  12239. PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
  12240. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  12241. return result;
  12242. }
  12243. #endif
  12244. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  12245. PyObject *result;
  12246. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  12247. result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
  12248. return result;
  12249. }
  12250. /* py_dict_items (used by OwnedDictNext) */
  12251. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
  12252. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
  12253. }
  12254. /* py_dict_values (used by OwnedDictNext) */
  12255. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
  12256. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
  12257. }
  12258. /* OwnedDictNext (used by ParseKeywordsImpl) */
  12259. #if CYTHON_AVOID_BORROWED_REFS
  12260. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
  12261. PyObject *next = NULL;
  12262. if (!*ppos) {
  12263. if (pvalue) {
  12264. PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
  12265. if (unlikely(!dictview)) goto bad;
  12266. *ppos = PyObject_GetIter(dictview);
  12267. Py_DECREF(dictview);
  12268. } else {
  12269. *ppos = PyObject_GetIter(p);
  12270. }
  12271. if (unlikely(!*ppos)) goto bad;
  12272. }
  12273. next = PyIter_Next(*ppos);
  12274. if (!next) {
  12275. if (PyErr_Occurred()) goto bad;
  12276. return 0;
  12277. }
  12278. if (pkey && pvalue) {
  12279. *pkey = __Pyx_PySequence_ITEM(next, 0);
  12280. if (unlikely(*pkey)) goto bad;
  12281. *pvalue = __Pyx_PySequence_ITEM(next, 1);
  12282. if (unlikely(*pvalue)) goto bad;
  12283. Py_DECREF(next);
  12284. } else if (pkey) {
  12285. *pkey = next;
  12286. } else {
  12287. assert(pvalue);
  12288. *pvalue = next;
  12289. }
  12290. return 1;
  12291. bad:
  12292. Py_XDECREF(next);
  12293. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  12294. PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
  12295. #else
  12296. PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
  12297. #endif
  12298. if (pkey) *pkey = NULL;
  12299. if (pvalue) *pvalue = NULL;
  12300. return 0;
  12301. }
  12302. #else // !CYTHON_AVOID_BORROWED_REFS
  12303. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
  12304. int result = PyDict_Next(p, ppos, pkey, pvalue);
  12305. if (likely(result == 1)) {
  12306. if (pkey) Py_INCREF(*pkey);
  12307. if (pvalue) Py_INCREF(*pvalue);
  12308. }
  12309. return result;
  12310. }
  12311. #endif
  12312. /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
  12313. static void __Pyx_RaiseDoubleKeywordsError(
  12314. const char* func_name,
  12315. PyObject* kw_name)
  12316. {
  12317. PyErr_Format(PyExc_TypeError,
  12318. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  12319. }
  12320. /* CallUnboundCMethod2 */
  12321. #if CYTHON_COMPILING_IN_CPYTHON
  12322. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
  12323. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  12324. if (likely(was_initialized == 2 && cfunc->func)) {
  12325. PyObject *args[2] = {arg1, arg2};
  12326. if (cfunc->flag == METH_FASTCALL) {
  12327. return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
  12328. }
  12329. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  12330. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
  12331. }
  12332. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  12333. else if (unlikely(was_initialized == 1)) {
  12334. __Pyx_CachedCFunction tmp_cfunc = {
  12335. #ifndef __cplusplus
  12336. 0
  12337. #endif
  12338. };
  12339. tmp_cfunc.type = cfunc->type;
  12340. tmp_cfunc.method_name = cfunc->method_name;
  12341. return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
  12342. }
  12343. #endif
  12344. PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
  12345. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  12346. return result;
  12347. }
  12348. #endif
  12349. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
  12350. if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  12351. #if CYTHON_COMPILING_IN_CPYTHON
  12352. if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
  12353. PyObject *result = NULL;
  12354. PyObject *args = PyTuple_New(2);
  12355. if (unlikely(!args)) return NULL;
  12356. Py_INCREF(arg1);
  12357. PyTuple_SET_ITEM(args, 0, arg1);
  12358. Py_INCREF(arg2);
  12359. PyTuple_SET_ITEM(args, 1, arg2);
  12360. if (cfunc->flag & METH_KEYWORDS)
  12361. result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
  12362. else
  12363. result = __Pyx_CallCFunction(cfunc, self, args);
  12364. Py_DECREF(args);
  12365. return result;
  12366. }
  12367. #endif
  12368. {
  12369. PyObject *args[4] = {NULL, self, arg1, arg2};
  12370. return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  12371. }
  12372. }
  12373. /* ParseKeywordsImpl (used by ParseKeywords) */
  12374. static int __Pyx_ValidateDuplicatePosArgs(
  12375. PyObject *kwds,
  12376. PyObject ** const argnames[],
  12377. PyObject ** const *first_kw_arg,
  12378. const char* function_name)
  12379. {
  12380. PyObject ** const *name = argnames;
  12381. while (name != first_kw_arg) {
  12382. PyObject *key = **name;
  12383. int found = PyDict_Contains(kwds, key);
  12384. if (unlikely(found)) {
  12385. if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12386. goto bad;
  12387. }
  12388. name++;
  12389. }
  12390. return 0;
  12391. bad:
  12392. return -1;
  12393. }
  12394. #if CYTHON_USE_UNICODE_INTERNALS
  12395. static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
  12396. int kind;
  12397. Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
  12398. if (len != PyUnicode_GET_LENGTH(s2)) return 0;
  12399. kind = PyUnicode_KIND(s1);
  12400. if (kind != PyUnicode_KIND(s2)) return 0;
  12401. const void *data1 = PyUnicode_DATA(s1);
  12402. const void *data2 = PyUnicode_DATA(s2);
  12403. return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
  12404. }
  12405. #endif
  12406. static int __Pyx_MatchKeywordArg_str(
  12407. PyObject *key,
  12408. PyObject ** const argnames[],
  12409. PyObject ** const *first_kw_arg,
  12410. size_t *index_found,
  12411. const char *function_name)
  12412. {
  12413. PyObject ** const *name;
  12414. #if CYTHON_USE_UNICODE_INTERNALS
  12415. Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
  12416. if (unlikely(key_hash == -1)) {
  12417. key_hash = PyObject_Hash(key);
  12418. if (unlikely(key_hash == -1))
  12419. goto bad;
  12420. }
  12421. #endif
  12422. name = first_kw_arg;
  12423. while (*name) {
  12424. PyObject *name_str = **name;
  12425. #if CYTHON_USE_UNICODE_INTERNALS
  12426. if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
  12427. *index_found = (size_t) (name - argnames);
  12428. return 1;
  12429. }
  12430. #else
  12431. #if CYTHON_ASSUME_SAFE_SIZE
  12432. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  12433. #endif
  12434. {
  12435. int cmp = PyUnicode_Compare(name_str, key);
  12436. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12437. if (cmp == 0) {
  12438. *index_found = (size_t) (name - argnames);
  12439. return 1;
  12440. }
  12441. }
  12442. #endif
  12443. name++;
  12444. }
  12445. name = argnames;
  12446. while (name != first_kw_arg) {
  12447. PyObject *name_str = **name;
  12448. #if CYTHON_USE_UNICODE_INTERNALS
  12449. if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
  12450. if (__Pyx_UnicodeKeywordsEqual(name_str, key))
  12451. goto arg_passed_twice;
  12452. }
  12453. #else
  12454. #if CYTHON_ASSUME_SAFE_SIZE
  12455. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  12456. #endif
  12457. {
  12458. if (unlikely(name_str == key)) goto arg_passed_twice;
  12459. int cmp = PyUnicode_Compare(name_str, key);
  12460. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12461. if (cmp == 0) goto arg_passed_twice;
  12462. }
  12463. #endif
  12464. name++;
  12465. }
  12466. return 0;
  12467. arg_passed_twice:
  12468. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12469. goto bad;
  12470. bad:
  12471. return -1;
  12472. }
  12473. static int __Pyx_MatchKeywordArg_nostr(
  12474. PyObject *key,
  12475. PyObject ** const argnames[],
  12476. PyObject ** const *first_kw_arg,
  12477. size_t *index_found,
  12478. const char *function_name)
  12479. {
  12480. PyObject ** const *name;
  12481. if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
  12482. name = first_kw_arg;
  12483. while (*name) {
  12484. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  12485. if (cmp == 1) {
  12486. *index_found = (size_t) (name - argnames);
  12487. return 1;
  12488. }
  12489. if (unlikely(cmp == -1)) goto bad;
  12490. name++;
  12491. }
  12492. name = argnames;
  12493. while (name != first_kw_arg) {
  12494. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  12495. if (unlikely(cmp != 0)) {
  12496. if (cmp == 1) goto arg_passed_twice;
  12497. else goto bad;
  12498. }
  12499. name++;
  12500. }
  12501. return 0;
  12502. arg_passed_twice:
  12503. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12504. goto bad;
  12505. invalid_keyword_type:
  12506. PyErr_Format(PyExc_TypeError,
  12507. "%.200s() keywords must be strings", function_name);
  12508. goto bad;
  12509. bad:
  12510. return -1;
  12511. }
  12512. static CYTHON_INLINE int __Pyx_MatchKeywordArg(
  12513. PyObject *key,
  12514. PyObject ** const argnames[],
  12515. PyObject ** const *first_kw_arg,
  12516. size_t *index_found,
  12517. const char *function_name)
  12518. {
  12519. return likely(PyUnicode_CheckExact(key)) ?
  12520. __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
  12521. __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
  12522. }
  12523. static void __Pyx_RejectUnknownKeyword(
  12524. PyObject *kwds,
  12525. PyObject ** const argnames[],
  12526. PyObject ** const *first_kw_arg,
  12527. const char *function_name)
  12528. {
  12529. #if CYTHON_AVOID_BORROWED_REFS
  12530. PyObject *pos = NULL;
  12531. #else
  12532. Py_ssize_t pos = 0;
  12533. #endif
  12534. PyObject *key = NULL;
  12535. __Pyx_BEGIN_CRITICAL_SECTION(kwds);
  12536. while (
  12537. #if CYTHON_AVOID_BORROWED_REFS
  12538. __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
  12539. #else
  12540. PyDict_Next(kwds, &pos, &key, NULL)
  12541. #endif
  12542. ) {
  12543. PyObject** const *name = first_kw_arg;
  12544. while (*name && (**name != key)) name++;
  12545. if (!*name) {
  12546. size_t index_found = 0;
  12547. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  12548. if (cmp != 1) {
  12549. if (cmp == 0) {
  12550. PyErr_Format(PyExc_TypeError,
  12551. "%s() got an unexpected keyword argument '%U'",
  12552. function_name, key);
  12553. }
  12554. #if CYTHON_AVOID_BORROWED_REFS
  12555. Py_DECREF(key);
  12556. #endif
  12557. break;
  12558. }
  12559. }
  12560. #if CYTHON_AVOID_BORROWED_REFS
  12561. Py_DECREF(key);
  12562. #endif
  12563. }
  12564. __Pyx_END_CRITICAL_SECTION();
  12565. #if CYTHON_AVOID_BORROWED_REFS
  12566. Py_XDECREF(pos);
  12567. #endif
  12568. assert(PyErr_Occurred());
  12569. }
  12570. static int __Pyx_ParseKeywordDict(
  12571. PyObject *kwds,
  12572. PyObject ** const argnames[],
  12573. PyObject *values[],
  12574. Py_ssize_t num_pos_args,
  12575. Py_ssize_t num_kwargs,
  12576. const char* function_name,
  12577. int ignore_unknown_kwargs)
  12578. {
  12579. PyObject** const *name;
  12580. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12581. Py_ssize_t extracted = 0;
  12582. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  12583. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  12584. #endif
  12585. name = first_kw_arg;
  12586. while (*name && num_kwargs > extracted) {
  12587. PyObject * key = **name;
  12588. PyObject *value;
  12589. int found = 0;
  12590. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  12591. found = PyDict_GetItemRef(kwds, key, &value);
  12592. #else
  12593. value = PyDict_GetItemWithError(kwds, key);
  12594. if (value) {
  12595. Py_INCREF(value);
  12596. found = 1;
  12597. } else {
  12598. if (unlikely(PyErr_Occurred())) goto bad;
  12599. }
  12600. #endif
  12601. if (found) {
  12602. if (unlikely(found < 0)) goto bad;
  12603. values[name-argnames] = value;
  12604. extracted++;
  12605. }
  12606. name++;
  12607. }
  12608. if (num_kwargs > extracted) {
  12609. if (ignore_unknown_kwargs) {
  12610. if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
  12611. goto bad;
  12612. } else {
  12613. __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
  12614. goto bad;
  12615. }
  12616. }
  12617. return 0;
  12618. bad:
  12619. return -1;
  12620. }
  12621. static int __Pyx_ParseKeywordDictToDict(
  12622. PyObject *kwds,
  12623. PyObject ** const argnames[],
  12624. PyObject *kwds2,
  12625. PyObject *values[],
  12626. Py_ssize_t num_pos_args,
  12627. const char* function_name)
  12628. {
  12629. PyObject** const *name;
  12630. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12631. Py_ssize_t len;
  12632. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  12633. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  12634. #endif
  12635. if (PyDict_Update(kwds2, kwds) < 0) goto bad;
  12636. name = first_kw_arg;
  12637. while (*name) {
  12638. PyObject *key = **name;
  12639. PyObject *value;
  12640. #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
  12641. int found = PyDict_Pop(kwds2, key, &value);
  12642. if (found) {
  12643. if (unlikely(found < 0)) goto bad;
  12644. values[name-argnames] = value;
  12645. }
  12646. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  12647. int found = PyDict_GetItemRef(kwds2, key, &value);
  12648. if (found) {
  12649. if (unlikely(found < 0)) goto bad;
  12650. values[name-argnames] = value;
  12651. if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
  12652. }
  12653. #else
  12654. #if CYTHON_COMPILING_IN_CPYTHON
  12655. value = _PyDict_Pop(kwds2, key, kwds2);
  12656. #else
  12657. value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
  12658. #endif
  12659. if (value == kwds2) {
  12660. Py_DECREF(value);
  12661. } else {
  12662. if (unlikely(!value)) goto bad;
  12663. values[name-argnames] = value;
  12664. }
  12665. #endif
  12666. name++;
  12667. }
  12668. len = PyDict_Size(kwds2);
  12669. if (len > 0) {
  12670. return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
  12671. } else if (unlikely(len == -1)) {
  12672. goto bad;
  12673. }
  12674. return 0;
  12675. bad:
  12676. return -1;
  12677. }
  12678. static int __Pyx_ParseKeywordsTuple(
  12679. PyObject *kwds,
  12680. PyObject * const *kwvalues,
  12681. PyObject ** const argnames[],
  12682. PyObject *kwds2,
  12683. PyObject *values[],
  12684. Py_ssize_t num_pos_args,
  12685. Py_ssize_t num_kwargs,
  12686. const char* function_name,
  12687. int ignore_unknown_kwargs)
  12688. {
  12689. PyObject *key = NULL;
  12690. PyObject** const * name;
  12691. PyObject** const *first_kw_arg = argnames + num_pos_args;
  12692. for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
  12693. #if CYTHON_AVOID_BORROWED_REFS
  12694. key = __Pyx_PySequence_ITEM(kwds, pos);
  12695. #else
  12696. key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
  12697. #endif
  12698. #if !CYTHON_ASSUME_SAFE_MACROS
  12699. if (unlikely(!key)) goto bad;
  12700. #endif
  12701. name = first_kw_arg;
  12702. while (*name && (**name != key)) name++;
  12703. if (*name) {
  12704. PyObject *value = kwvalues[pos];
  12705. values[name-argnames] = __Pyx_NewRef(value);
  12706. } else {
  12707. size_t index_found = 0;
  12708. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  12709. if (cmp == 1) {
  12710. PyObject *value = kwvalues[pos];
  12711. values[index_found] = __Pyx_NewRef(value);
  12712. } else {
  12713. if (unlikely(cmp == -1)) goto bad;
  12714. if (kwds2) {
  12715. PyObject *value = kwvalues[pos];
  12716. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  12717. } else if (!ignore_unknown_kwargs) {
  12718. goto invalid_keyword;
  12719. }
  12720. }
  12721. }
  12722. #if CYTHON_AVOID_BORROWED_REFS
  12723. Py_DECREF(key);
  12724. key = NULL;
  12725. #endif
  12726. }
  12727. return 0;
  12728. invalid_keyword:
  12729. PyErr_Format(PyExc_TypeError,
  12730. "%s() got an unexpected keyword argument '%U'",
  12731. function_name, key);
  12732. goto bad;
  12733. bad:
  12734. #if CYTHON_AVOID_BORROWED_REFS
  12735. Py_XDECREF(key);
  12736. #endif
  12737. return -1;
  12738. }
  12739. /* ParseKeywords */
  12740. static int __Pyx_ParseKeywords(
  12741. PyObject *kwds,
  12742. PyObject * const *kwvalues,
  12743. PyObject ** const argnames[],
  12744. PyObject *kwds2,
  12745. PyObject *values[],
  12746. Py_ssize_t num_pos_args,
  12747. Py_ssize_t num_kwargs,
  12748. const char* function_name,
  12749. int ignore_unknown_kwargs)
  12750. {
  12751. if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
  12752. return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  12753. else if (kwds2)
  12754. return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
  12755. else
  12756. return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  12757. }
  12758. /* RaiseArgTupleInvalid */
  12759. static void __Pyx_RaiseArgtupleInvalid(
  12760. const char* func_name,
  12761. int exact,
  12762. Py_ssize_t num_min,
  12763. Py_ssize_t num_max,
  12764. Py_ssize_t num_found)
  12765. {
  12766. Py_ssize_t num_expected;
  12767. const char *more_or_less;
  12768. if (num_found < num_min) {
  12769. num_expected = num_min;
  12770. more_or_less = "at least";
  12771. } else {
  12772. num_expected = num_max;
  12773. more_or_less = "at most";
  12774. }
  12775. if (exact) {
  12776. more_or_less = "exactly";
  12777. }
  12778. PyErr_Format(PyExc_TypeError,
  12779. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12780. func_name, more_or_less, num_expected,
  12781. (num_expected == 1) ? "" : "s", num_found);
  12782. }
  12783. /* RaiseException */
  12784. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  12785. PyObject* owned_instance = NULL;
  12786. if (tb == Py_None) {
  12787. tb = 0;
  12788. } else if (tb && !PyTraceBack_Check(tb)) {
  12789. PyErr_SetString(PyExc_TypeError,
  12790. "raise: arg 3 must be a traceback or None");
  12791. goto bad;
  12792. }
  12793. if (value == Py_None)
  12794. value = 0;
  12795. if (PyExceptionInstance_Check(type)) {
  12796. if (value) {
  12797. PyErr_SetString(PyExc_TypeError,
  12798. "instance exception may not have a separate value");
  12799. goto bad;
  12800. }
  12801. value = type;
  12802. type = (PyObject*) Py_TYPE(value);
  12803. } else if (PyExceptionClass_Check(type)) {
  12804. PyObject *instance_class = NULL;
  12805. if (value && PyExceptionInstance_Check(value)) {
  12806. instance_class = (PyObject*) Py_TYPE(value);
  12807. if (instance_class != type) {
  12808. int is_subclass = PyObject_IsSubclass(instance_class, type);
  12809. if (!is_subclass) {
  12810. instance_class = NULL;
  12811. } else if (unlikely(is_subclass == -1)) {
  12812. goto bad;
  12813. } else {
  12814. type = instance_class;
  12815. }
  12816. }
  12817. }
  12818. if (!instance_class) {
  12819. PyObject *args;
  12820. if (!value)
  12821. args = PyTuple_New(0);
  12822. else if (PyTuple_Check(value)) {
  12823. Py_INCREF(value);
  12824. args = value;
  12825. } else
  12826. args = PyTuple_Pack(1, value);
  12827. if (!args)
  12828. goto bad;
  12829. owned_instance = PyObject_Call(type, args, NULL);
  12830. Py_DECREF(args);
  12831. if (!owned_instance)
  12832. goto bad;
  12833. value = owned_instance;
  12834. if (!PyExceptionInstance_Check(value)) {
  12835. PyErr_Format(PyExc_TypeError,
  12836. "calling %R should have returned an instance of "
  12837. "BaseException, not %R",
  12838. type, Py_TYPE(value));
  12839. goto bad;
  12840. }
  12841. }
  12842. } else {
  12843. PyErr_SetString(PyExc_TypeError,
  12844. "raise: exception class must be a subclass of BaseException");
  12845. goto bad;
  12846. }
  12847. if (cause) {
  12848. PyObject *fixed_cause;
  12849. if (cause == Py_None) {
  12850. fixed_cause = NULL;
  12851. } else if (PyExceptionClass_Check(cause)) {
  12852. fixed_cause = PyObject_CallObject(cause, NULL);
  12853. if (fixed_cause == NULL)
  12854. goto bad;
  12855. } else if (PyExceptionInstance_Check(cause)) {
  12856. fixed_cause = cause;
  12857. Py_INCREF(fixed_cause);
  12858. } else {
  12859. PyErr_SetString(PyExc_TypeError,
  12860. "exception causes must derive from "
  12861. "BaseException");
  12862. goto bad;
  12863. }
  12864. PyException_SetCause(value, fixed_cause);
  12865. }
  12866. PyErr_SetObject(type, value);
  12867. if (tb) {
  12868. #if PY_VERSION_HEX >= 0x030C00A6
  12869. PyException_SetTraceback(value, tb);
  12870. #elif CYTHON_FAST_THREAD_STATE
  12871. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  12872. PyObject* tmp_tb = tstate->curexc_traceback;
  12873. if (tb != tmp_tb) {
  12874. Py_INCREF(tb);
  12875. tstate->curexc_traceback = tb;
  12876. Py_XDECREF(tmp_tb);
  12877. }
  12878. #else
  12879. PyObject *tmp_type, *tmp_value, *tmp_tb;
  12880. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  12881. Py_INCREF(tb);
  12882. PyErr_Restore(tmp_type, tmp_value, tb);
  12883. Py_XDECREF(tmp_tb);
  12884. #endif
  12885. }
  12886. bad:
  12887. Py_XDECREF(owned_instance);
  12888. return;
  12889. }
  12890. /* PyLongBinop */
  12891. #if !CYTHON_COMPILING_IN_PYPY
  12892. static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
  12893. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  12894. }
  12895. #if CYTHON_USE_PYLONG_INTERNALS
  12896. static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  12897. CYTHON_MAYBE_UNUSED_VAR(inplace);
  12898. CYTHON_UNUSED_VAR(zerodivision_check);
  12899. const long b = intval;
  12900. long a;
  12901. const PY_LONG_LONG llb = intval;
  12902. PY_LONG_LONG lla;
  12903. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  12904. return __Pyx_NewRef(op2);
  12905. }
  12906. const int is_positive = __Pyx_PyLong_IsPos(op1);
  12907. const digit* digits = __Pyx_PyLong_Digits(op1);
  12908. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  12909. if (likely(size == 1)) {
  12910. a = (long) digits[0];
  12911. if (!is_positive) a *= -1;
  12912. } else {
  12913. switch (size) {
  12914. case 2:
  12915. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  12916. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12917. if (!is_positive) a *= -1;
  12918. goto calculate_long;
  12919. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  12920. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  12921. if (!is_positive) lla *= -1;
  12922. goto calculate_long_long;
  12923. }
  12924. break;
  12925. case 3:
  12926. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  12927. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12928. if (!is_positive) a *= -1;
  12929. goto calculate_long;
  12930. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  12931. 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]));
  12932. if (!is_positive) lla *= -1;
  12933. goto calculate_long_long;
  12934. }
  12935. break;
  12936. case 4:
  12937. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  12938. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12939. if (!is_positive) a *= -1;
  12940. goto calculate_long;
  12941. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  12942. 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]));
  12943. if (!is_positive) lla *= -1;
  12944. goto calculate_long_long;
  12945. }
  12946. break;
  12947. }
  12948. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  12949. }
  12950. calculate_long:
  12951. {
  12952. long x;
  12953. x = a + b;
  12954. return PyLong_FromLong(x);
  12955. }
  12956. calculate_long_long:
  12957. {
  12958. PY_LONG_LONG llx;
  12959. llx = lla + llb;
  12960. return PyLong_FromLongLong(llx);
  12961. }
  12962. }
  12963. #endif
  12964. static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
  12965. CYTHON_UNUSED_VAR(zerodivision_check);
  12966. const long b = intval;
  12967. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  12968. double result;
  12969. result = ((double)a) + (double)b;
  12970. return PyFloat_FromDouble(result);
  12971. }
  12972. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  12973. CYTHON_MAYBE_UNUSED_VAR(intval);
  12974. CYTHON_UNUSED_VAR(zerodivision_check);
  12975. #if CYTHON_USE_PYLONG_INTERNALS
  12976. if (likely(PyLong_CheckExact(op1))) {
  12977. return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
  12978. }
  12979. #endif
  12980. if (PyFloat_CheckExact(op1)) {
  12981. return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
  12982. }
  12983. return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
  12984. }
  12985. #endif
  12986. /* IterNextPlain (used by IterNext) */
  12987. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  12988. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
  12989. if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
  12990. __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
  12991. return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
  12992. }
  12993. #endif
  12994. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
  12995. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  12996. PyObject *result;
  12997. PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
  12998. if (unlikely(!next)) return NULL;
  12999. result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
  13000. return result;
  13001. #else
  13002. (void)__Pyx_GetBuiltinName; // only for early limited API
  13003. iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
  13004. assert(iternext);
  13005. return iternext(iterator);
  13006. #endif
  13007. }
  13008. /* IterNext */
  13009. static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
  13010. PyObject* exc_type;
  13011. __Pyx_PyThreadState_declare
  13012. __Pyx_PyThreadState_assign
  13013. exc_type = __Pyx_PyErr_CurrentExceptionType();
  13014. if (unlikely(exc_type)) {
  13015. if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  13016. return NULL;
  13017. __Pyx_PyErr_Clear();
  13018. Py_INCREF(defval);
  13019. return defval;
  13020. }
  13021. if (defval) {
  13022. Py_INCREF(defval);
  13023. return defval;
  13024. }
  13025. __Pyx_PyErr_SetNone(PyExc_StopIteration);
  13026. return NULL;
  13027. }
  13028. static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
  13029. __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(iterator));
  13030. PyErr_Format(PyExc_TypeError,
  13031. __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
  13032. __Pyx_DECREF_TypeName(iterator_type_name);
  13033. }
  13034. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
  13035. PyObject* next;
  13036. #if !CYTHON_COMPILING_IN_LIMITED_API
  13037. iternextfunc iternext = __Pyx_PyObject_TryGetSlot(iterator, tp_iternext, iternextfunc);
  13038. if (likely(iternext)) {
  13039. next = iternext(iterator);
  13040. if (likely(next))
  13041. return next;
  13042. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13043. if (unlikely(iternext == &_PyObject_NextNotImplemented))
  13044. return NULL;
  13045. #endif
  13046. } else if (CYTHON_USE_TYPE_SLOTS) {
  13047. __Pyx_PyIter_Next_ErrorNoIterator(iterator);
  13048. return NULL;
  13049. } else
  13050. #endif
  13051. if (unlikely(!PyIter_Check(iterator))) {
  13052. __Pyx_PyIter_Next_ErrorNoIterator(iterator);
  13053. return NULL;
  13054. } else {
  13055. next = defval ? PyIter_Next(iterator) : __Pyx_PyIter_Next_Plain(iterator);
  13056. if (likely(next))
  13057. return next;
  13058. }
  13059. return __Pyx_PyIter_Next2Default(defval);
  13060. }
  13061. /* PyLongCompare */
  13062. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  13063. CYTHON_MAYBE_UNUSED_VAR(intval);
  13064. CYTHON_UNUSED_VAR(inplace);
  13065. if (op1 == op2) {
  13066. return 0;
  13067. }
  13068. #if CYTHON_USE_PYLONG_INTERNALS
  13069. if (likely(PyLong_CheckExact(op1))) {
  13070. int unequal;
  13071. unsigned long uintval;
  13072. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13073. const digit* digits = __Pyx_PyLong_Digits(op1);
  13074. if (intval == 0) {
  13075. return (__Pyx_PyLong_IsZero(op1) != 1);
  13076. } else if (intval < 0) {
  13077. if (__Pyx_PyLong_IsNonNeg(op1))
  13078. return 1;
  13079. intval = -intval;
  13080. } else {
  13081. if (__Pyx_PyLong_IsNeg(op1))
  13082. return 1;
  13083. }
  13084. uintval = (unsigned long) intval;
  13085. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  13086. if (uintval >> (PyLong_SHIFT * 4)) {
  13087. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13088. | (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));
  13089. } else
  13090. #endif
  13091. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  13092. if (uintval >> (PyLong_SHIFT * 3)) {
  13093. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13094. | (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));
  13095. } else
  13096. #endif
  13097. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  13098. if (uintval >> (PyLong_SHIFT * 2)) {
  13099. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13100. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13101. } else
  13102. #endif
  13103. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  13104. if (uintval >> (PyLong_SHIFT * 1)) {
  13105. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13106. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13107. } else
  13108. #endif
  13109. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  13110. return (unequal != 0);
  13111. }
  13112. #endif
  13113. if (PyFloat_CheckExact(op1)) {
  13114. const long b = intval;
  13115. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  13116. return ((double)a != (double)b);
  13117. }
  13118. return __Pyx_PyObject_IsTrueAndDecref(
  13119. PyObject_RichCompare(op1, op2, Py_NE));
  13120. }
  13121. /* SliceObject */
  13122. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  13123. Py_ssize_t cstart, Py_ssize_t cstop,
  13124. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  13125. int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
  13126. __Pyx_TypeName obj_type_name;
  13127. #if CYTHON_USE_TYPE_SLOTS
  13128. PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
  13129. if (likely(mp && mp->mp_subscript))
  13130. #endif
  13131. {
  13132. PyObject* result;
  13133. PyObject *py_slice, *py_start, *py_stop;
  13134. if (_py_slice) {
  13135. py_slice = *_py_slice;
  13136. } else {
  13137. PyObject* owned_start = NULL;
  13138. PyObject* owned_stop = NULL;
  13139. if (_py_start) {
  13140. py_start = *_py_start;
  13141. } else {
  13142. if (has_cstart) {
  13143. owned_start = py_start = PyLong_FromSsize_t(cstart);
  13144. if (unlikely(!py_start)) goto bad;
  13145. } else
  13146. py_start = Py_None;
  13147. }
  13148. if (_py_stop) {
  13149. py_stop = *_py_stop;
  13150. } else {
  13151. if (has_cstop) {
  13152. owned_stop = py_stop = PyLong_FromSsize_t(cstop);
  13153. if (unlikely(!py_stop)) {
  13154. Py_XDECREF(owned_start);
  13155. goto bad;
  13156. }
  13157. } else
  13158. py_stop = Py_None;
  13159. }
  13160. py_slice = PySlice_New(py_start, py_stop, Py_None);
  13161. Py_XDECREF(owned_start);
  13162. Py_XDECREF(owned_stop);
  13163. if (unlikely(!py_slice)) goto bad;
  13164. }
  13165. #if CYTHON_USE_TYPE_SLOTS
  13166. result = mp->mp_subscript(obj, py_slice);
  13167. #else
  13168. result = PyObject_GetItem(obj, py_slice);
  13169. #endif
  13170. if (!_py_slice) {
  13171. Py_DECREF(py_slice);
  13172. }
  13173. return result;
  13174. }
  13175. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13176. PyErr_Format(PyExc_TypeError,
  13177. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  13178. __Pyx_DECREF_TypeName(obj_type_name);
  13179. bad:
  13180. return NULL;
  13181. }
  13182. /* ObjectGetItem */
  13183. #if CYTHON_USE_TYPE_SLOTS
  13184. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  13185. PyObject *runerr = NULL;
  13186. Py_ssize_t key_value;
  13187. key_value = __Pyx_PyIndex_AsSsize_t(index);
  13188. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  13189. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
  13190. }
  13191. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  13192. __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
  13193. PyErr_Clear();
  13194. PyErr_Format(PyExc_IndexError,
  13195. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  13196. __Pyx_DECREF_TypeName(index_type_name);
  13197. }
  13198. return NULL;
  13199. }
  13200. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  13201. __Pyx_TypeName obj_type_name;
  13202. if (likely(PyType_Check(obj))) {
  13203. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
  13204. if (!meth) {
  13205. PyErr_Clear();
  13206. } else {
  13207. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  13208. Py_DECREF(meth);
  13209. return result;
  13210. }
  13211. }
  13212. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13213. PyErr_Format(PyExc_TypeError,
  13214. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  13215. __Pyx_DECREF_TypeName(obj_type_name);
  13216. return NULL;
  13217. }
  13218. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  13219. PyTypeObject *tp = Py_TYPE(obj);
  13220. PyMappingMethods *mm = tp->tp_as_mapping;
  13221. PySequenceMethods *sm = tp->tp_as_sequence;
  13222. if (likely(mm && mm->mp_subscript)) {
  13223. return mm->mp_subscript(obj, key);
  13224. }
  13225. if (likely(sm && sm->sq_item)) {
  13226. return __Pyx_PyObject_GetIndex(obj, key);
  13227. }
  13228. return __Pyx_PyObject_GetItem_Slow(obj, key);
  13229. }
  13230. #endif
  13231. /* PyLongBinop */
  13232. #if !CYTHON_COMPILING_IN_PYPY
  13233. static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
  13234. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  13235. }
  13236. #if CYTHON_USE_PYLONG_INTERNALS
  13237. static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13238. CYTHON_MAYBE_UNUSED_VAR(inplace);
  13239. CYTHON_UNUSED_VAR(zerodivision_check);
  13240. const long b = intval;
  13241. long a;
  13242. const PY_LONG_LONG llb = intval;
  13243. PY_LONG_LONG lla;
  13244. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  13245. return PyLong_FromLong(-intval);
  13246. }
  13247. const int is_positive = __Pyx_PyLong_IsPos(op1);
  13248. const digit* digits = __Pyx_PyLong_Digits(op1);
  13249. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13250. if (likely(size == 1)) {
  13251. a = (long) digits[0];
  13252. if (!is_positive) a *= -1;
  13253. } else {
  13254. switch (size) {
  13255. case 2:
  13256. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  13257. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13258. if (!is_positive) a *= -1;
  13259. goto calculate_long;
  13260. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  13261. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  13262. if (!is_positive) lla *= -1;
  13263. goto calculate_long_long;
  13264. }
  13265. break;
  13266. case 3:
  13267. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  13268. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13269. if (!is_positive) a *= -1;
  13270. goto calculate_long;
  13271. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  13272. 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]));
  13273. if (!is_positive) lla *= -1;
  13274. goto calculate_long_long;
  13275. }
  13276. break;
  13277. case 4:
  13278. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  13279. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13280. if (!is_positive) a *= -1;
  13281. goto calculate_long;
  13282. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  13283. 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]));
  13284. if (!is_positive) lla *= -1;
  13285. goto calculate_long_long;
  13286. }
  13287. break;
  13288. }
  13289. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  13290. }
  13291. calculate_long:
  13292. {
  13293. long x;
  13294. x = a - b;
  13295. return PyLong_FromLong(x);
  13296. }
  13297. calculate_long_long:
  13298. {
  13299. PY_LONG_LONG llx;
  13300. llx = lla - llb;
  13301. return PyLong_FromLongLong(llx);
  13302. }
  13303. }
  13304. #endif
  13305. static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(PyObject *float_val, long intval, int zerodivision_check) {
  13306. CYTHON_UNUSED_VAR(zerodivision_check);
  13307. const long b = intval;
  13308. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  13309. double result;
  13310. result = ((double)a) - (double)b;
  13311. return PyFloat_FromDouble(result);
  13312. }
  13313. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13314. CYTHON_MAYBE_UNUSED_VAR(intval);
  13315. CYTHON_UNUSED_VAR(zerodivision_check);
  13316. #if CYTHON_USE_PYLONG_INTERNALS
  13317. if (likely(PyLong_CheckExact(op1))) {
  13318. return __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
  13319. }
  13320. #endif
  13321. if (PyFloat_CheckExact(op1)) {
  13322. return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
  13323. }
  13324. return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
  13325. }
  13326. #endif
  13327. /* PyDictVersioning (used by GetModuleGlobalName) */
  13328. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  13329. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  13330. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13331. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  13332. }
  13333. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  13334. PyObject **dictptr = NULL;
  13335. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  13336. if (offset) {
  13337. #if CYTHON_COMPILING_IN_CPYTHON
  13338. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  13339. #else
  13340. dictptr = _PyObject_GetDictPtr(obj);
  13341. #endif
  13342. }
  13343. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  13344. }
  13345. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  13346. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13347. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  13348. return 0;
  13349. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  13350. }
  13351. #endif
  13352. /* GetModuleGlobalName */
  13353. #if CYTHON_USE_DICT_VERSIONS
  13354. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  13355. #else
  13356. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  13357. #endif
  13358. {
  13359. PyObject *result;
  13360. #if CYTHON_COMPILING_IN_LIMITED_API
  13361. if (unlikely(!__pyx_m)) {
  13362. if (!PyErr_Occurred())
  13363. PyErr_SetNone(PyExc_NameError);
  13364. return NULL;
  13365. }
  13366. result = PyObject_GetAttr(__pyx_m, name);
  13367. if (likely(result)) {
  13368. return result;
  13369. }
  13370. PyErr_Clear();
  13371. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  13372. if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
  13373. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  13374. if (likely(result)) {
  13375. return result;
  13376. }
  13377. #else
  13378. result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
  13379. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  13380. if (likely(result)) {
  13381. return __Pyx_NewRef(result);
  13382. }
  13383. PyErr_Clear();
  13384. #endif
  13385. return __Pyx_GetBuiltinName(name);
  13386. }
  13387. /* RaiseUnboundLocalError */
  13388. static void __Pyx_RaiseUnboundLocalError(const char *varname) {
  13389. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  13390. }
  13391. /* RaiseTooManyValuesToUnpack */
  13392. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  13393. PyErr_Format(PyExc_ValueError,
  13394. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  13395. }
  13396. /* RaiseNeedMoreValuesToUnpack */
  13397. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  13398. PyErr_Format(PyExc_ValueError,
  13399. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  13400. index, (index == 1) ? "" : "s");
  13401. }
  13402. /* IterFinish */
  13403. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  13404. PyObject* exc_type;
  13405. __Pyx_PyThreadState_declare
  13406. __Pyx_PyThreadState_assign
  13407. exc_type = __Pyx_PyErr_CurrentExceptionType();
  13408. if (unlikely(exc_type)) {
  13409. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  13410. return -1;
  13411. __Pyx_PyErr_Clear();
  13412. return 0;
  13413. }
  13414. return 0;
  13415. }
  13416. /* UnpackItemEndCheck */
  13417. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  13418. if (unlikely(retval)) {
  13419. Py_DECREF(retval);
  13420. __Pyx_RaiseTooManyValuesError(expected);
  13421. return -1;
  13422. }
  13423. return __Pyx_IterFinish();
  13424. }
  13425. /* py_abs */
  13426. #if CYTHON_USE_PYLONG_INTERNALS
  13427. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  13428. #if PY_VERSION_HEX >= 0x030C00A7
  13429. if (likely(__Pyx_PyLong_IsCompact(n))) {
  13430. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  13431. }
  13432. #else
  13433. if (likely(Py_SIZE(n) == -1)) {
  13434. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  13435. }
  13436. #endif
  13437. #if CYTHON_COMPILING_IN_CPYTHON
  13438. {
  13439. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  13440. if (likely(copy)) {
  13441. #if PY_VERSION_HEX >= 0x030C00A7
  13442. ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
  13443. #else
  13444. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  13445. #endif
  13446. }
  13447. return copy;
  13448. }
  13449. #else
  13450. return PyNumber_Negative(n);
  13451. #endif
  13452. }
  13453. #endif
  13454. /* RaiseClosureNameError */
  13455. static void __Pyx_RaiseClosureNameError(const char *varname) {
  13456. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  13457. }
  13458. /* GetException (used by pep479) */
  13459. #if CYTHON_FAST_THREAD_STATE
  13460. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  13461. #else
  13462. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  13463. #endif
  13464. {
  13465. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  13466. #if CYTHON_FAST_THREAD_STATE
  13467. PyObject *tmp_type, *tmp_value, *tmp_tb;
  13468. #if PY_VERSION_HEX >= 0x030C0000
  13469. local_value = tstate->current_exception;
  13470. tstate->current_exception = 0;
  13471. #else
  13472. local_type = tstate->curexc_type;
  13473. local_value = tstate->curexc_value;
  13474. local_tb = tstate->curexc_traceback;
  13475. tstate->curexc_type = 0;
  13476. tstate->curexc_value = 0;
  13477. tstate->curexc_traceback = 0;
  13478. #endif
  13479. #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13480. local_value = PyErr_GetRaisedException();
  13481. #else
  13482. PyErr_Fetch(&local_type, &local_value, &local_tb);
  13483. #endif
  13484. #if __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13485. if (likely(local_value)) {
  13486. local_type = (PyObject*) Py_TYPE(local_value);
  13487. Py_INCREF(local_type);
  13488. local_tb = PyException_GetTraceback(local_value);
  13489. }
  13490. #else
  13491. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  13492. #if CYTHON_FAST_THREAD_STATE
  13493. if (unlikely(tstate->curexc_type))
  13494. #else
  13495. if (unlikely(PyErr_Occurred()))
  13496. #endif
  13497. goto bad;
  13498. if (local_tb) {
  13499. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  13500. goto bad;
  13501. }
  13502. #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
  13503. Py_XINCREF(local_tb);
  13504. Py_XINCREF(local_type);
  13505. Py_XINCREF(local_value);
  13506. *type = local_type;
  13507. *value = local_value;
  13508. *tb = local_tb;
  13509. #if CYTHON_FAST_THREAD_STATE
  13510. #if CYTHON_USE_EXC_INFO_STACK
  13511. {
  13512. _PyErr_StackItem *exc_info = tstate->exc_info;
  13513. #if PY_VERSION_HEX >= 0x030B00a4
  13514. tmp_value = exc_info->exc_value;
  13515. exc_info->exc_value = local_value;
  13516. tmp_type = NULL;
  13517. tmp_tb = NULL;
  13518. Py_XDECREF(local_type);
  13519. Py_XDECREF(local_tb);
  13520. #else
  13521. tmp_type = exc_info->exc_type;
  13522. tmp_value = exc_info->exc_value;
  13523. tmp_tb = exc_info->exc_traceback;
  13524. exc_info->exc_type = local_type;
  13525. exc_info->exc_value = local_value;
  13526. exc_info->exc_traceback = local_tb;
  13527. #endif
  13528. }
  13529. #else
  13530. tmp_type = tstate->exc_type;
  13531. tmp_value = tstate->exc_value;
  13532. tmp_tb = tstate->exc_traceback;
  13533. tstate->exc_type = local_type;
  13534. tstate->exc_value = local_value;
  13535. tstate->exc_traceback = local_tb;
  13536. #endif
  13537. Py_XDECREF(tmp_type);
  13538. Py_XDECREF(tmp_value);
  13539. Py_XDECREF(tmp_tb);
  13540. #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  13541. PyErr_SetHandledException(local_value);
  13542. Py_XDECREF(local_value);
  13543. Py_XDECREF(local_type);
  13544. Py_XDECREF(local_tb);
  13545. #else
  13546. PyErr_SetExcInfo(local_type, local_value, local_tb);
  13547. #endif
  13548. return 0;
  13549. #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
  13550. bad:
  13551. *type = 0;
  13552. *value = 0;
  13553. *tb = 0;
  13554. Py_XDECREF(local_type);
  13555. Py_XDECREF(local_value);
  13556. Py_XDECREF(local_tb);
  13557. return -1;
  13558. #endif
  13559. }
  13560. /* pep479 */
  13561. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  13562. PyObject *exc, *val, *tb, *cur_exc, *new_exc;
  13563. __Pyx_PyThreadState_declare
  13564. int is_async_stopiteration = 0;
  13565. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  13566. __Pyx_PyThreadState_assign
  13567. cur_exc = __Pyx_PyErr_CurrentExceptionType();
  13568. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  13569. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
  13570. is_async_stopiteration = 1;
  13571. } else {
  13572. return;
  13573. }
  13574. }
  13575. __Pyx_GetException(&exc, &val, &tb);
  13576. Py_XDECREF(exc);
  13577. Py_XDECREF(tb);
  13578. new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
  13579. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  13580. in_async_gen ? "async generator raised StopIteration" :
  13581. "generator raised StopIteration");
  13582. if (!new_exc) {
  13583. Py_XDECREF(val);
  13584. return;
  13585. }
  13586. PyException_SetCause(new_exc, val); // steals ref to val
  13587. PyErr_SetObject(PyExc_RuntimeError, new_exc);
  13588. }
  13589. /* ArgTypeTestFunc (used by ArgTypeTest) */
  13590. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  13591. {
  13592. __Pyx_TypeName type_name;
  13593. __Pyx_TypeName obj_type_name;
  13594. PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode;
  13595. int from_annotation_subclass = 0;
  13596. if (unlikely(!type)) {
  13597. PyErr_SetString(PyExc_SystemError, "Missing type object");
  13598. return 0;
  13599. }
  13600. else if (!exact) {
  13601. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  13602. } else if (exact == 2) {
  13603. if (__Pyx_TypeCheck(obj, type)) {
  13604. from_annotation_subclass = 1;
  13605. extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately;
  13606. }
  13607. }
  13608. type_name = __Pyx_PyType_GetFullyQualifiedName(type);
  13609. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13610. PyErr_Format(PyExc_TypeError,
  13611. "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
  13612. ", got " __Pyx_FMT_TYPENAME ")"
  13613. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  13614. "%s%U"
  13615. #endif
  13616. , name, type_name, obj_type_name
  13617. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  13618. , (from_annotation_subclass ? ". " : ""), extra_info
  13619. #endif
  13620. );
  13621. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  13622. if (exact == 2 && from_annotation_subclass) {
  13623. PyObject *res;
  13624. PyObject *vargs[2];
  13625. vargs[0] = PyErr_GetRaisedException();
  13626. vargs[1] = extra_info;
  13627. res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL);
  13628. Py_XDECREF(res);
  13629. PyErr_SetRaisedException(vargs[0]);
  13630. }
  13631. #endif
  13632. __Pyx_DECREF_TypeName(type_name);
  13633. __Pyx_DECREF_TypeName(obj_type_name);
  13634. return 0;
  13635. }
  13636. /* DictGetItem */
  13637. #if !CYTHON_COMPILING_IN_PYPY
  13638. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  13639. PyObject *value;
  13640. if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
  13641. if (unlikely(PyTuple_Check(key))) {
  13642. PyObject* args = PyTuple_Pack(1, key);
  13643. if (likely(args)) {
  13644. PyErr_SetObject(PyExc_KeyError, args);
  13645. Py_DECREF(args);
  13646. }
  13647. } else {
  13648. PyErr_SetObject(PyExc_KeyError, key);
  13649. }
  13650. }
  13651. return value;
  13652. }
  13653. #endif
  13654. /* PyObjectCallNoArg (used by pyfrozenset_new) */
  13655. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  13656. PyObject *arg[2] = {NULL, NULL};
  13657. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  13658. }
  13659. /* pyfrozenset_new (used by PySetContains) */
  13660. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  13661. if (it) {
  13662. PyObject* result;
  13663. #if CYTHON_COMPILING_IN_PYPY
  13664. PyObject* args;
  13665. args = PyTuple_Pack(1, it);
  13666. if (unlikely(!args))
  13667. return NULL;
  13668. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  13669. Py_DECREF(args);
  13670. return result;
  13671. #else
  13672. if (PyFrozenSet_CheckExact(it)) {
  13673. Py_INCREF(it);
  13674. return it;
  13675. }
  13676. result = PyFrozenSet_New(it);
  13677. if (unlikely(!result))
  13678. return NULL;
  13679. if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  13680. #if CYTHON_COMPILING_IN_LIMITED_API
  13681. || __Pyx_get_runtime_version() >= 0x030A0000
  13682. #endif
  13683. )
  13684. return result;
  13685. {
  13686. Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
  13687. if (likely(size > 0))
  13688. return result;
  13689. #if !CYTHON_ASSUME_SAFE_SIZE
  13690. if (unlikely(size < 0)) {
  13691. Py_DECREF(result);
  13692. return NULL;
  13693. }
  13694. #endif
  13695. }
  13696. Py_DECREF(result);
  13697. #endif
  13698. }
  13699. return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
  13700. }
  13701. /* PySetContains */
  13702. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  13703. int result = -1;
  13704. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  13705. PyObject *tmpkey;
  13706. PyErr_Clear();
  13707. tmpkey = __Pyx_PyFrozenSet_New(key);
  13708. if (tmpkey != NULL) {
  13709. result = PySet_Contains(set, tmpkey);
  13710. Py_DECREF(tmpkey);
  13711. }
  13712. }
  13713. return result;
  13714. }
  13715. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  13716. int result = PySet_Contains(set, key);
  13717. if (unlikely(result < 0)) {
  13718. result = __Pyx_PySet_ContainsUnhashable(set, key);
  13719. }
  13720. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  13721. }
  13722. /* pybuiltin_invalid (used by pyint_simplify) */
  13723. static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) {
  13724. __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  13725. if (argname) {
  13726. PyErr_Format(PyExc_TypeError,
  13727. "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")",
  13728. argname, type_name, obj_type_name
  13729. );
  13730. } else {
  13731. PyErr_Format(PyExc_TypeError,
  13732. "Expected %.200s, got " __Pyx_FMT_TYPENAME,
  13733. type_name, obj_type_name
  13734. );
  13735. }
  13736. __Pyx_DECREF_TypeName(obj_type_name);
  13737. }
  13738. /* pyint_simplify */
  13739. static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) {
  13740. PyObject *number = *number_var;
  13741. if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) {
  13742. return 0;
  13743. }
  13744. PyObject *int_object;
  13745. if (likely(PyNumber_Check(number))) {
  13746. int_object = PyNumber_Long(number);
  13747. if (unlikely(!int_object)) goto bad;
  13748. } else {
  13749. __Pyx_PyBuiltin_Invalid(number, "int", argname);
  13750. goto bad;
  13751. }
  13752. *number_var = int_object;
  13753. Py_DECREF(number);
  13754. return 0;
  13755. bad:
  13756. *number_var = NULL;
  13757. Py_DECREF(number);
  13758. return -1;
  13759. }
  13760. /* SliceTupleAndList */
  13761. #if CYTHON_COMPILING_IN_CPYTHON
  13762. static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
  13763. Py_ssize_t start = *_start, stop = *_stop, length = *_length;
  13764. if (start < 0) {
  13765. start += length;
  13766. if (start < 0)
  13767. start = 0;
  13768. }
  13769. if (stop < 0)
  13770. stop += length;
  13771. else if (stop > length)
  13772. stop = length;
  13773. *_length = stop - start;
  13774. *_start = start;
  13775. *_stop = stop;
  13776. }
  13777. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
  13778. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13779. Py_ssize_t length = PyTuple_GET_SIZE(src);
  13780. __Pyx_crop_slice(&start, &stop, &length);
  13781. return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
  13782. }
  13783. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked(
  13784. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13785. Py_ssize_t length = PyList_GET_SIZE(src);
  13786. __Pyx_crop_slice(&start, &stop, &length);
  13787. if (length <= 0) {
  13788. return PyList_New(0);
  13789. }
  13790. return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
  13791. }
  13792. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
  13793. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13794. PyObject *result;
  13795. __Pyx_BEGIN_CRITICAL_SECTION(src);
  13796. result = __Pyx_PyList_GetSlice_locked(src, start, stop);
  13797. __Pyx_END_CRITICAL_SECTION();
  13798. return result;
  13799. }
  13800. #endif // CYTHON_COMPILING_IN_CPYTHON
  13801. /* set_iter */
  13802. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  13803. Py_ssize_t* p_orig_length, int* p_source_is_set) {
  13804. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13805. is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
  13806. *p_source_is_set = is_set;
  13807. if (likely(is_set)) {
  13808. *p_orig_length = PySet_Size(iterable);
  13809. Py_INCREF(iterable);
  13810. return iterable;
  13811. }
  13812. #else
  13813. CYTHON_UNUSED_VAR(is_set);
  13814. *p_source_is_set = 0;
  13815. #endif
  13816. *p_orig_length = 0;
  13817. return PyObject_GetIter(iterable);
  13818. }
  13819. static CYTHON_INLINE int __Pyx_set_iter_next(
  13820. PyObject* iter_obj, Py_ssize_t orig_length,
  13821. Py_ssize_t* ppos, PyObject **value,
  13822. int source_is_set) {
  13823. if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
  13824. *value = PyIter_Next(iter_obj);
  13825. if (unlikely(!*value)) {
  13826. return __Pyx_IterFinish();
  13827. }
  13828. CYTHON_UNUSED_VAR(orig_length);
  13829. CYTHON_UNUSED_VAR(ppos);
  13830. return 1;
  13831. }
  13832. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13833. if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
  13834. PyErr_SetString(
  13835. PyExc_RuntimeError,
  13836. "set changed size during iteration");
  13837. return -1;
  13838. }
  13839. {
  13840. Py_hash_t hash;
  13841. int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
  13842. assert (ret != -1);
  13843. if (likely(ret)) {
  13844. Py_INCREF(*value);
  13845. return 1;
  13846. }
  13847. }
  13848. #endif
  13849. return 0;
  13850. }
  13851. /* PyLongCompare */
  13852. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  13853. CYTHON_MAYBE_UNUSED_VAR(intval);
  13854. CYTHON_UNUSED_VAR(inplace);
  13855. if (op1 == op2) {
  13856. return 1;
  13857. }
  13858. #if CYTHON_USE_PYLONG_INTERNALS
  13859. if (likely(PyLong_CheckExact(op1))) {
  13860. int unequal;
  13861. unsigned long uintval;
  13862. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13863. const digit* digits = __Pyx_PyLong_Digits(op1);
  13864. if (intval == 0) {
  13865. return (__Pyx_PyLong_IsZero(op1) == 1);
  13866. } else if (intval < 0) {
  13867. if (__Pyx_PyLong_IsNonNeg(op1))
  13868. return 0;
  13869. intval = -intval;
  13870. } else {
  13871. if (__Pyx_PyLong_IsNeg(op1))
  13872. return 0;
  13873. }
  13874. uintval = (unsigned long) intval;
  13875. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  13876. if (uintval >> (PyLong_SHIFT * 4)) {
  13877. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13878. | (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));
  13879. } else
  13880. #endif
  13881. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  13882. if (uintval >> (PyLong_SHIFT * 3)) {
  13883. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13884. | (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));
  13885. } else
  13886. #endif
  13887. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  13888. if (uintval >> (PyLong_SHIFT * 2)) {
  13889. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13890. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13891. } else
  13892. #endif
  13893. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  13894. if (uintval >> (PyLong_SHIFT * 1)) {
  13895. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13896. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13897. } else
  13898. #endif
  13899. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  13900. return (unequal == 0);
  13901. }
  13902. #endif
  13903. if (PyFloat_CheckExact(op1)) {
  13904. const long b = intval;
  13905. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  13906. return ((double)a == (double)b);
  13907. }
  13908. return __Pyx_PyObject_IsTrueAndDecref(
  13909. PyObject_RichCompare(op1, op2, Py_EQ));
  13910. }
  13911. /* py_set_discard_unhashable (used by py_set_remove) */
  13912. static int __Pyx_PySet_DiscardUnhashable(PyObject *set, PyObject *key) {
  13913. PyObject *tmpkey;
  13914. int rv;
  13915. if (likely(!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)))
  13916. return -1;
  13917. PyErr_Clear();
  13918. tmpkey = __Pyx_PyFrozenSet_New(key);
  13919. if (tmpkey == NULL)
  13920. return -1;
  13921. rv = PySet_Discard(set, tmpkey);
  13922. Py_DECREF(tmpkey);
  13923. return rv;
  13924. }
  13925. /* py_set_remove */
  13926. static int __Pyx_PySet_RemoveNotFound(PyObject *set, PyObject *key, int found) {
  13927. if (unlikely(found < 0)) {
  13928. found = __Pyx_PySet_DiscardUnhashable(set, key);
  13929. }
  13930. if (likely(found == 0)) {
  13931. PyObject *tup;
  13932. tup = PyTuple_Pack(1, key);
  13933. if (!tup)
  13934. return -1;
  13935. PyErr_SetObject(PyExc_KeyError, tup);
  13936. Py_DECREF(tup);
  13937. return -1;
  13938. }
  13939. return found;
  13940. }
  13941. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key) {
  13942. int found = PySet_Discard(set, key);
  13943. if (unlikely(found != 1)) {
  13944. return __Pyx_PySet_RemoveNotFound(set, key, found);
  13945. }
  13946. return 0;
  13947. }
  13948. /* AllocateExtensionType */
  13949. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
  13950. if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
  13951. allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
  13952. return alloc_func(t, 0);
  13953. } else {
  13954. newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
  13955. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  13956. if (!tp_new) {
  13957. PyObject *new_str = PyUnicode_FromString("__new__");
  13958. if (likely(new_str)) {
  13959. PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
  13960. Py_DECREF(new_str);
  13961. return o;
  13962. } else
  13963. return NULL;
  13964. } else
  13965. #endif
  13966. return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  13967. }
  13968. }
  13969. /* CallTypeTraverse */
  13970. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  13971. #else
  13972. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
  13973. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
  13974. if (__Pyx_get_runtime_version() < 0x03090000) return 0;
  13975. #endif
  13976. if (!always_call) {
  13977. PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
  13978. unsigned long flags = PyType_GetFlags(base);
  13979. if (flags & Py_TPFLAGS_HEAPTYPE) {
  13980. return 0;
  13981. }
  13982. }
  13983. Py_VISIT((PyObject*)Py_TYPE(o));
  13984. return 0;
  13985. }
  13986. #endif
  13987. /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
  13988. #if CYTHON_COMPILING_IN_LIMITED_API
  13989. static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
  13990. PyObject *tp_dictoffset_o;
  13991. Py_ssize_t tp_dictoffset;
  13992. tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
  13993. if (unlikely(!tp_dictoffset_o)) return -1;
  13994. tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
  13995. Py_DECREF(tp_dictoffset_o);
  13996. if (unlikely(tp_dictoffset == 0)) {
  13997. PyErr_SetString(
  13998. PyExc_TypeError,
  13999. "'type' doesn't have a dictoffset");
  14000. return -1;
  14001. } else if (unlikely(tp_dictoffset < 0)) {
  14002. PyErr_SetString(
  14003. PyExc_TypeError,
  14004. "'type' has an unexpected negative dictoffset. "
  14005. "Please report this as Cython bug");
  14006. return -1;
  14007. }
  14008. return tp_dictoffset;
  14009. }
  14010. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
  14011. static Py_ssize_t tp_dictoffset = 0;
  14012. if (unlikely(tp_dictoffset == 0)) {
  14013. tp_dictoffset = __Pyx_GetTypeDictOffset();
  14014. if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
  14015. tp_dictoffset = 0; // try again next time?
  14016. return NULL;
  14017. }
  14018. }
  14019. return *(PyObject**)((char*)tp + tp_dictoffset);
  14020. }
  14021. #endif
  14022. /* SetItemOnTypeDict (used by FixUpExtensionType) */
  14023. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
  14024. int result;
  14025. PyObject *tp_dict;
  14026. #if CYTHON_COMPILING_IN_LIMITED_API
  14027. tp_dict = __Pyx_GetTypeDict(tp);
  14028. if (unlikely(!tp_dict)) return -1;
  14029. #else
  14030. tp_dict = tp->tp_dict;
  14031. #endif
  14032. result = PyDict_SetItem(tp_dict, k, v);
  14033. if (likely(!result)) {
  14034. PyType_Modified(tp);
  14035. if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
  14036. PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL);
  14037. if (!setNameResult) return -1;
  14038. Py_DECREF(setNameResult);
  14039. }
  14040. }
  14041. return result;
  14042. }
  14043. /* FixUpExtensionType */
  14044. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  14045. #if __PYX_LIMITED_VERSION_HEX > 0x030900B1
  14046. CYTHON_UNUSED_VAR(spec);
  14047. CYTHON_UNUSED_VAR(type);
  14048. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14049. #else
  14050. const PyType_Slot *slot = spec->slots;
  14051. int changed = 0;
  14052. #if !CYTHON_COMPILING_IN_LIMITED_API
  14053. while (slot && slot->slot && slot->slot != Py_tp_members)
  14054. slot++;
  14055. if (slot && slot->slot == Py_tp_members) {
  14056. #if !CYTHON_COMPILING_IN_CPYTHON
  14057. const
  14058. #endif // !CYTHON_COMPILING_IN_CPYTHON)
  14059. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  14060. while (memb && memb->name) {
  14061. if (memb->name[0] == '_' && memb->name[1] == '_') {
  14062. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  14063. assert(memb->type == T_PYSSIZET);
  14064. assert(memb->flags == READONLY);
  14065. type->tp_weaklistoffset = memb->offset;
  14066. changed = 1;
  14067. }
  14068. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  14069. assert(memb->type == T_PYSSIZET);
  14070. assert(memb->flags == READONLY);
  14071. type->tp_dictoffset = memb->offset;
  14072. changed = 1;
  14073. }
  14074. #if CYTHON_METH_FASTCALL
  14075. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  14076. assert(memb->type == T_PYSSIZET);
  14077. assert(memb->flags == READONLY);
  14078. type->tp_vectorcall_offset = memb->offset;
  14079. changed = 1;
  14080. }
  14081. #endif // CYTHON_METH_FASTCALL
  14082. #if !CYTHON_COMPILING_IN_PYPY
  14083. else if (strcmp(memb->name, "__module__") == 0) {
  14084. PyObject *descr;
  14085. assert(memb->type == T_OBJECT);
  14086. assert(memb->flags == 0 || memb->flags == READONLY);
  14087. descr = PyDescr_NewMember(type, memb);
  14088. if (unlikely(!descr))
  14089. return -1;
  14090. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  14091. Py_DECREF(descr);
  14092. if (unlikely(set_item_result < 0)) {
  14093. return -1;
  14094. }
  14095. changed = 1;
  14096. }
  14097. #endif // !CYTHON_COMPILING_IN_PYPY
  14098. }
  14099. memb++;
  14100. }
  14101. }
  14102. #endif // !CYTHON_COMPILING_IN_LIMITED_API
  14103. #if !CYTHON_COMPILING_IN_PYPY
  14104. slot = spec->slots;
  14105. while (slot && slot->slot && slot->slot != Py_tp_getset)
  14106. slot++;
  14107. if (slot && slot->slot == Py_tp_getset) {
  14108. PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
  14109. while (getset && getset->name) {
  14110. if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
  14111. PyObject *descr = PyDescr_NewGetSet(type, getset);
  14112. if (unlikely(!descr))
  14113. return -1;
  14114. #if CYTHON_COMPILING_IN_LIMITED_API
  14115. PyObject *pyname = PyUnicode_FromString(getset->name);
  14116. if (unlikely(!pyname)) {
  14117. Py_DECREF(descr);
  14118. return -1;
  14119. }
  14120. int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
  14121. Py_DECREF(pyname);
  14122. #else
  14123. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14124. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  14125. #endif
  14126. Py_DECREF(descr);
  14127. if (unlikely(set_item_result < 0)) {
  14128. return -1;
  14129. }
  14130. changed = 1;
  14131. }
  14132. ++getset;
  14133. }
  14134. }
  14135. #else
  14136. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  14137. #endif // !CYTHON_COMPILING_IN_PYPY
  14138. if (changed)
  14139. PyType_Modified(type);
  14140. #endif // PY_VERSION_HEX > 0x030900B1
  14141. return 0;
  14142. }
  14143. /* PyObjectGetMethod (used by PyObjectCallMethod0) */
  14144. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  14145. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  14146. PyObject *attr;
  14147. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  14148. __Pyx_TypeName type_name;
  14149. PyTypeObject *tp = Py_TYPE(obj);
  14150. PyObject *descr;
  14151. descrgetfunc f = NULL;
  14152. PyObject **dictptr, *dict;
  14153. int meth_found = 0;
  14154. assert (*method == NULL);
  14155. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  14156. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14157. goto try_unpack;
  14158. }
  14159. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  14160. return 0;
  14161. }
  14162. descr = _PyType_Lookup(tp, name);
  14163. if (likely(descr != NULL)) {
  14164. Py_INCREF(descr);
  14165. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  14166. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  14167. #else
  14168. #ifdef __Pyx_CyFunction_USED
  14169. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  14170. #else
  14171. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  14172. #endif
  14173. #endif
  14174. {
  14175. meth_found = 1;
  14176. } else {
  14177. f = Py_TYPE(descr)->tp_descr_get;
  14178. if (f != NULL && PyDescr_IsData(descr)) {
  14179. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14180. Py_DECREF(descr);
  14181. goto try_unpack;
  14182. }
  14183. }
  14184. }
  14185. dictptr = _PyObject_GetDictPtr(obj);
  14186. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  14187. Py_INCREF(dict);
  14188. attr = __Pyx_PyDict_GetItemStr(dict, name);
  14189. if (attr != NULL) {
  14190. Py_INCREF(attr);
  14191. Py_DECREF(dict);
  14192. Py_XDECREF(descr);
  14193. goto try_unpack;
  14194. }
  14195. Py_DECREF(dict);
  14196. }
  14197. if (meth_found) {
  14198. *method = descr;
  14199. return 1;
  14200. }
  14201. if (f != NULL) {
  14202. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14203. Py_DECREF(descr);
  14204. goto try_unpack;
  14205. }
  14206. if (likely(descr != NULL)) {
  14207. *method = descr;
  14208. return 0;
  14209. }
  14210. type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
  14211. PyErr_Format(PyExc_AttributeError,
  14212. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  14213. type_name, name);
  14214. __Pyx_DECREF_TypeName(type_name);
  14215. return 0;
  14216. #else
  14217. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14218. goto try_unpack;
  14219. #endif
  14220. try_unpack:
  14221. #if CYTHON_UNPACK_METHODS
  14222. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  14223. PyObject *function = PyMethod_GET_FUNCTION(attr);
  14224. Py_INCREF(function);
  14225. Py_DECREF(attr);
  14226. *method = function;
  14227. return 1;
  14228. }
  14229. #endif
  14230. *method = attr;
  14231. return 0;
  14232. }
  14233. #endif
  14234. /* PyObjectCallMethod0 (used by PyType_Ready) */
  14235. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  14236. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  14237. PyObject *args[1] = {obj};
  14238. (void) __Pyx_PyObject_CallOneArg;
  14239. (void) __Pyx_PyObject_CallNoArg;
  14240. return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  14241. #else
  14242. PyObject *method = NULL, *result = NULL;
  14243. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  14244. if (likely(is_method)) {
  14245. result = __Pyx_PyObject_CallOneArg(method, obj);
  14246. Py_DECREF(method);
  14247. return result;
  14248. }
  14249. if (unlikely(!method)) goto bad;
  14250. result = __Pyx_PyObject_CallNoArg(method);
  14251. Py_DECREF(method);
  14252. bad:
  14253. return result;
  14254. #endif
  14255. }
  14256. /* ValidateBasesTuple (used by PyType_Ready) */
  14257. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  14258. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  14259. Py_ssize_t i, n;
  14260. #if CYTHON_ASSUME_SAFE_SIZE
  14261. n = PyTuple_GET_SIZE(bases);
  14262. #else
  14263. n = PyTuple_Size(bases);
  14264. if (unlikely(n < 0)) return -1;
  14265. #endif
  14266. for (i = 1; i < n; i++)
  14267. {
  14268. PyTypeObject *b;
  14269. #if CYTHON_AVOID_BORROWED_REFS
  14270. PyObject *b0 = PySequence_GetItem(bases, i);
  14271. if (!b0) return -1;
  14272. #elif CYTHON_ASSUME_SAFE_MACROS
  14273. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  14274. #else
  14275. PyObject *b0 = PyTuple_GetItem(bases, i);
  14276. if (!b0) return -1;
  14277. #endif
  14278. b = (PyTypeObject*) b0;
  14279. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  14280. {
  14281. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  14282. PyErr_Format(PyExc_TypeError,
  14283. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  14284. __Pyx_DECREF_TypeName(b_name);
  14285. #if CYTHON_AVOID_BORROWED_REFS
  14286. Py_DECREF(b0);
  14287. #endif
  14288. return -1;
  14289. }
  14290. if (dictoffset == 0)
  14291. {
  14292. Py_ssize_t b_dictoffset = 0;
  14293. #if CYTHON_USE_TYPE_SLOTS
  14294. b_dictoffset = b->tp_dictoffset;
  14295. #else
  14296. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  14297. if (!py_b_dictoffset) goto dictoffset_return;
  14298. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  14299. Py_DECREF(py_b_dictoffset);
  14300. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  14301. #endif
  14302. if (b_dictoffset) {
  14303. {
  14304. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  14305. PyErr_Format(PyExc_TypeError,
  14306. "extension type '%.200s' has no __dict__ slot, "
  14307. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  14308. "either add 'cdef dict __dict__' to the extension type "
  14309. "or add '__slots__ = [...]' to the base type",
  14310. type_name, b_name);
  14311. __Pyx_DECREF_TypeName(b_name);
  14312. }
  14313. #if !CYTHON_USE_TYPE_SLOTS
  14314. dictoffset_return:
  14315. #endif
  14316. #if CYTHON_AVOID_BORROWED_REFS
  14317. Py_DECREF(b0);
  14318. #endif
  14319. return -1;
  14320. }
  14321. }
  14322. #if CYTHON_AVOID_BORROWED_REFS
  14323. Py_DECREF(b0);
  14324. #endif
  14325. }
  14326. return 0;
  14327. }
  14328. #endif
  14329. /* PyType_Ready */
  14330. CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
  14331. while (t) {
  14332. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  14333. if (bases) {
  14334. return 1;
  14335. }
  14336. t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
  14337. }
  14338. return 0;
  14339. }
  14340. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  14341. #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
  14342. (void)__Pyx_PyObject_CallMethod0;
  14343. #if CYTHON_USE_TYPE_SPECS
  14344. (void)__Pyx_validate_bases_tuple;
  14345. #endif
  14346. return PyType_Ready(t);
  14347. #else
  14348. int r;
  14349. if (!__Pyx_PyType_HasMultipleInheritance(t)) {
  14350. return PyType_Ready(t);
  14351. }
  14352. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  14353. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  14354. return -1;
  14355. #if !defined(PYSTON_MAJOR_VERSION)
  14356. {
  14357. int gc_was_enabled;
  14358. #if PY_VERSION_HEX >= 0x030A00b1
  14359. gc_was_enabled = PyGC_Disable();
  14360. (void)__Pyx_PyObject_CallMethod0;
  14361. #else
  14362. PyObject *ret, *py_status;
  14363. PyObject *gc = NULL;
  14364. #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
  14365. !CYTHON_COMPILING_IN_GRAAL
  14366. gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
  14367. #endif
  14368. if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
  14369. if (unlikely(!gc)) return -1;
  14370. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
  14371. if (unlikely(!py_status)) {
  14372. Py_DECREF(gc);
  14373. return -1;
  14374. }
  14375. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  14376. Py_DECREF(py_status);
  14377. if (gc_was_enabled > 0) {
  14378. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
  14379. if (unlikely(!ret)) {
  14380. Py_DECREF(gc);
  14381. return -1;
  14382. }
  14383. Py_DECREF(ret);
  14384. } else if (unlikely(gc_was_enabled == -1)) {
  14385. Py_DECREF(gc);
  14386. return -1;
  14387. }
  14388. #endif
  14389. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  14390. #if PY_VERSION_HEX >= 0x030A0000
  14391. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  14392. #endif
  14393. #else
  14394. (void)__Pyx_PyObject_CallMethod0;
  14395. #endif
  14396. r = PyType_Ready(t);
  14397. #if !defined(PYSTON_MAJOR_VERSION)
  14398. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  14399. #if PY_VERSION_HEX >= 0x030A00b1
  14400. if (gc_was_enabled)
  14401. PyGC_Enable();
  14402. #else
  14403. if (gc_was_enabled) {
  14404. PyObject *tp, *v, *tb;
  14405. PyErr_Fetch(&tp, &v, &tb);
  14406. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
  14407. if (likely(ret || r == -1)) {
  14408. Py_XDECREF(ret);
  14409. PyErr_Restore(tp, v, tb);
  14410. } else {
  14411. Py_XDECREF(tp);
  14412. Py_XDECREF(v);
  14413. Py_XDECREF(tb);
  14414. r = -1;
  14415. }
  14416. }
  14417. Py_DECREF(gc);
  14418. #endif
  14419. }
  14420. #endif
  14421. return r;
  14422. #endif
  14423. }
  14424. /* HasAttr (used by ImportImpl) */
  14425. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  14426. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  14427. PyObject *r;
  14428. if (unlikely(!PyUnicode_Check(n))) {
  14429. PyErr_SetString(PyExc_TypeError,
  14430. "hasattr(): attribute name must be string");
  14431. return -1;
  14432. }
  14433. r = __Pyx_PyObject_GetAttrStrNoError(o, n);
  14434. if (!r) {
  14435. return (unlikely(PyErr_Occurred())) ? -1 : 0;
  14436. } else {
  14437. Py_DECREF(r);
  14438. return 1;
  14439. }
  14440. }
  14441. #endif
  14442. /* ImportImpl (used by Import) */
  14443. static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
  14444. PyObject *imported_module = PyImport_GetModule(qualname);
  14445. if (unlikely(!imported_module)) {
  14446. *module = NULL;
  14447. if (PyErr_Occurred()) {
  14448. return -1;
  14449. }
  14450. return 0;
  14451. }
  14452. *module = imported_module;
  14453. return 1;
  14454. }
  14455. static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
  14456. PyObject *imported_module;
  14457. PyObject *top_level_package_name;
  14458. Py_ssize_t i;
  14459. int status, module_found;
  14460. Py_ssize_t dot_index;
  14461. module_found = __Pyx__Import_GetModule(qualname, &imported_module);
  14462. if (unlikely(!module_found || module_found == -1)) {
  14463. *module = NULL;
  14464. return module_found;
  14465. }
  14466. if (imported_names) {
  14467. for (i = 0; i < len_imported_names; i++) {
  14468. PyObject *imported_name = imported_names[i];
  14469. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  14470. int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
  14471. #else
  14472. int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
  14473. if (unlikely(has_imported_attribute == -1)) goto error;
  14474. #endif
  14475. if (!has_imported_attribute) {
  14476. goto not_found;
  14477. }
  14478. }
  14479. *module = imported_module;
  14480. return 1;
  14481. }
  14482. dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
  14483. if (dot_index == -1) {
  14484. *module = imported_module;
  14485. return 1;
  14486. }
  14487. if (unlikely(dot_index == -2)) goto error;
  14488. top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
  14489. if (unlikely(!top_level_package_name)) goto error;
  14490. Py_DECREF(imported_module);
  14491. status = __Pyx__Import_GetModule(top_level_package_name, module);
  14492. Py_DECREF(top_level_package_name);
  14493. return status;
  14494. error:
  14495. Py_DECREF(imported_module);
  14496. *module = NULL;
  14497. return -1;
  14498. not_found:
  14499. Py_DECREF(imported_module);
  14500. *module = NULL;
  14501. return 0;
  14502. }
  14503. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
  14504. PyObject *module = 0;
  14505. PyObject *empty_dict = 0;
  14506. PyObject *from_list = 0;
  14507. int module_found;
  14508. if (!qualname) {
  14509. qualname = name;
  14510. }
  14511. module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
  14512. if (likely(module_found == 1)) {
  14513. return module;
  14514. } else if (unlikely(module_found == -1)) {
  14515. return NULL;
  14516. }
  14517. empty_dict = PyDict_New();
  14518. if (unlikely(!empty_dict))
  14519. goto bad;
  14520. if (imported_names) {
  14521. #if CYTHON_COMPILING_IN_CPYTHON
  14522. from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
  14523. if (unlikely(!from_list))
  14524. goto bad;
  14525. #else
  14526. from_list = PyList_New(len_imported_names);
  14527. if (unlikely(!from_list)) goto bad;
  14528. for (Py_ssize_t i=0; i<len_imported_names; ++i) {
  14529. if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
  14530. }
  14531. #endif
  14532. }
  14533. if (level == -1) {
  14534. const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
  14535. if (package_sep != (0)) {
  14536. module = PyImport_ImportModuleLevelObject(
  14537. name, moddict, empty_dict, from_list, 1);
  14538. if (unlikely(!module)) {
  14539. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  14540. goto bad;
  14541. PyErr_Clear();
  14542. }
  14543. }
  14544. level = 0;
  14545. }
  14546. if (!module) {
  14547. module = PyImport_ImportModuleLevelObject(
  14548. name, moddict, empty_dict, from_list, level);
  14549. }
  14550. bad:
  14551. Py_XDECREF(from_list);
  14552. Py_XDECREF(empty_dict);
  14553. return module;
  14554. }
  14555. /* Import */
  14556. static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
  14557. return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
  14558. }
  14559. /* ImportFrom */
  14560. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  14561. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  14562. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  14563. const char* module_name_str = 0;
  14564. PyObject* module_name = 0;
  14565. PyObject* module_dot = 0;
  14566. PyObject* full_name = 0;
  14567. PyErr_Clear();
  14568. module_name_str = PyModule_GetName(module);
  14569. if (unlikely(!module_name_str)) { goto modbad; }
  14570. module_name = PyUnicode_FromString(module_name_str);
  14571. if (unlikely(!module_name)) { goto modbad; }
  14572. module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_);
  14573. if (unlikely(!module_dot)) { goto modbad; }
  14574. full_name = PyUnicode_Concat(module_dot, name);
  14575. if (unlikely(!full_name)) { goto modbad; }
  14576. #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\
  14577. CYTHON_COMPILING_IN_GRAAL
  14578. {
  14579. PyObject *modules = PyImport_GetModuleDict();
  14580. if (unlikely(!modules))
  14581. goto modbad;
  14582. value = PyObject_GetItem(modules, full_name);
  14583. }
  14584. #else
  14585. value = PyImport_GetModule(full_name);
  14586. #endif
  14587. modbad:
  14588. Py_XDECREF(full_name);
  14589. Py_XDECREF(module_dot);
  14590. Py_XDECREF(module_name);
  14591. }
  14592. if (unlikely(!value)) {
  14593. PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
  14594. }
  14595. return value;
  14596. }
  14597. /* dict_setdefault (used by FetchCommonType) */
  14598. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
  14599. PyObject* value;
  14600. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  14601. PyObject *args[] = {d, key, default_value};
  14602. value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  14603. #elif CYTHON_COMPILING_IN_LIMITED_API
  14604. value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
  14605. #elif PY_VERSION_HEX >= 0x030d0000
  14606. PyDict_SetDefaultRef(d, key, default_value, &value);
  14607. #else
  14608. value = PyDict_SetDefault(d, key, default_value);
  14609. if (unlikely(!value)) return NULL;
  14610. Py_INCREF(value);
  14611. #endif
  14612. return value;
  14613. }
  14614. /* AddModuleRef (used by FetchSharedCythonModule) */
  14615. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  14616. static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
  14617. PyObject *module_dict = PyImport_GetModuleDict();
  14618. PyObject *m;
  14619. if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
  14620. return NULL;
  14621. }
  14622. if (m != NULL && PyModule_Check(m)) {
  14623. return m;
  14624. }
  14625. Py_XDECREF(m);
  14626. m = PyModule_NewObject(name);
  14627. if (m == NULL)
  14628. return NULL;
  14629. if (PyDict_CheckExact(module_dict)) {
  14630. PyObject *new_m;
  14631. (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
  14632. Py_DECREF(m);
  14633. return new_m;
  14634. } else {
  14635. if (PyObject_SetItem(module_dict, name, m) != 0) {
  14636. Py_DECREF(m);
  14637. return NULL;
  14638. }
  14639. return m;
  14640. }
  14641. }
  14642. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  14643. PyObject *py_name = PyUnicode_FromString(name);
  14644. if (!py_name) return NULL;
  14645. PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
  14646. Py_DECREF(py_name);
  14647. return module;
  14648. }
  14649. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  14650. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  14651. #else
  14652. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  14653. PyObject *module = PyImport_AddModule(name);
  14654. Py_XINCREF(module);
  14655. return module;
  14656. }
  14657. #endif
  14658. /* FetchSharedCythonModule (used by FetchCommonType) */
  14659. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  14660. return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
  14661. }
  14662. /* FetchCommonType (used by CommonTypesMetaclass) */
  14663. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  14664. static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  14665. PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
  14666. if (result && metaclass) {
  14667. PyObject *old_tp = (PyObject*)Py_TYPE(result);
  14668. Py_INCREF((PyObject*)metaclass);
  14669. #if __PYX_LIMITED_VERSION_HEX >= 0x03090000
  14670. Py_SET_TYPE(result, metaclass);
  14671. #else
  14672. result->ob_type = metaclass;
  14673. #endif
  14674. Py_DECREF(old_tp);
  14675. }
  14676. return result;
  14677. }
  14678. #else
  14679. #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
  14680. #endif
  14681. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  14682. const char *name,
  14683. Py_ssize_t expected_basicsize) {
  14684. Py_ssize_t basicsize;
  14685. if (!PyType_Check(cached_type)) {
  14686. PyErr_Format(PyExc_TypeError,
  14687. "Shared Cython type %.200s is not a type object", name);
  14688. return -1;
  14689. }
  14690. if (expected_basicsize == 0) {
  14691. return 0; // size is inherited, nothing useful to check
  14692. }
  14693. #if CYTHON_COMPILING_IN_LIMITED_API
  14694. PyObject *py_basicsize;
  14695. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  14696. if (unlikely(!py_basicsize)) return -1;
  14697. basicsize = PyLong_AsSsize_t(py_basicsize);
  14698. Py_DECREF(py_basicsize);
  14699. py_basicsize = NULL;
  14700. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
  14701. #else
  14702. basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
  14703. #endif
  14704. if (basicsize != expected_basicsize) {
  14705. PyErr_Format(PyExc_TypeError,
  14706. "Shared Cython type %.200s has the wrong size, try recompiling",
  14707. name);
  14708. return -1;
  14709. }
  14710. return 0;
  14711. }
  14712. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  14713. PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
  14714. int get_item_ref_result;
  14715. const char* object_name = strrchr(spec->name, '.');
  14716. object_name = object_name ? object_name+1 : spec->name;
  14717. py_object_name = PyUnicode_FromString(object_name);
  14718. if (!py_object_name) return NULL;
  14719. abi_module = __Pyx_FetchSharedCythonABIModule();
  14720. if (!abi_module) goto done;
  14721. abi_module_dict = PyModule_GetDict(abi_module);
  14722. if (!abi_module_dict) goto done;
  14723. get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
  14724. if (get_item_ref_result == 1) {
  14725. if (__Pyx_VerifyCachedType(
  14726. cached_type,
  14727. object_name,
  14728. spec->basicsize) < 0) {
  14729. goto bad;
  14730. }
  14731. goto done;
  14732. } else if (unlikely(get_item_ref_result == -1)) {
  14733. goto bad;
  14734. }
  14735. cached_type = __Pyx_PyType_FromMetaclass(
  14736. metaclass,
  14737. CYTHON_USE_MODULE_STATE ? module : abi_module,
  14738. spec, bases);
  14739. if (unlikely(!cached_type)) goto bad;
  14740. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  14741. new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
  14742. if (unlikely(new_cached_type != cached_type)) {
  14743. if (unlikely(!new_cached_type)) goto bad;
  14744. Py_DECREF(cached_type);
  14745. cached_type = new_cached_type;
  14746. if (__Pyx_VerifyCachedType(
  14747. cached_type,
  14748. object_name,
  14749. spec->basicsize) < 0) {
  14750. goto bad;
  14751. }
  14752. goto done;
  14753. } else {
  14754. Py_DECREF(new_cached_type);
  14755. }
  14756. done:
  14757. Py_XDECREF(abi_module);
  14758. Py_DECREF(py_object_name);
  14759. assert(cached_type == NULL || PyType_Check(cached_type));
  14760. return (PyTypeObject *) cached_type;
  14761. bad:
  14762. Py_XDECREF(cached_type);
  14763. cached_type = NULL;
  14764. goto done;
  14765. }
  14766. /* CommonTypesMetaclass (used by CythonFunctionShared) */
  14767. static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
  14768. return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
  14769. }
  14770. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  14771. static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
  14772. PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
  14773. return NULL;
  14774. }
  14775. static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
  14776. PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
  14777. return -1;
  14778. }
  14779. #endif
  14780. static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
  14781. {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
  14782. {0, 0, 0, 0, 0}
  14783. };
  14784. static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
  14785. {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
  14786. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  14787. {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
  14788. {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
  14789. {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
  14790. #endif
  14791. {0, 0}
  14792. };
  14793. static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
  14794. __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
  14795. 0,
  14796. 0,
  14797. Py_TPFLAGS_IMMUTABLETYPE |
  14798. Py_TPFLAGS_DISALLOW_INSTANTIATION |
  14799. Py_TPFLAGS_DEFAULT,
  14800. __pyx_CommonTypesMetaclass_slots
  14801. };
  14802. static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
  14803. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  14804. PyObject *bases = PyTuple_Pack(1, &PyType_Type);
  14805. if (unlikely(!bases)) {
  14806. return -1;
  14807. }
  14808. mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
  14809. Py_DECREF(bases);
  14810. if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
  14811. return -1;
  14812. }
  14813. return 0;
  14814. }
  14815. /* PyMethodNew (used by CythonFunctionShared) */
  14816. #if CYTHON_COMPILING_IN_LIMITED_API
  14817. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  14818. PyObject *result;
  14819. CYTHON_UNUSED_VAR(typ);
  14820. if (!self)
  14821. return __Pyx_NewRef(func);
  14822. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  14823. {
  14824. PyObject *args[] = {func, self};
  14825. result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
  14826. }
  14827. #else
  14828. result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
  14829. #endif
  14830. return result;
  14831. }
  14832. #else
  14833. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  14834. CYTHON_UNUSED_VAR(typ);
  14835. if (!self)
  14836. return __Pyx_NewRef(func);
  14837. return PyMethod_New(func, self);
  14838. }
  14839. #endif
  14840. /* PyVectorcallFastCallDict (used by CythonFunctionShared) */
  14841. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  14842. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14843. {
  14844. PyObject *res = NULL;
  14845. PyObject *kwnames;
  14846. PyObject **newargs;
  14847. PyObject **kwvalues;
  14848. Py_ssize_t i;
  14849. #if CYTHON_AVOID_BORROWED_REFS
  14850. PyObject *pos;
  14851. #else
  14852. Py_ssize_t pos;
  14853. #endif
  14854. size_t j;
  14855. PyObject *key, *value;
  14856. unsigned long keys_are_strings;
  14857. #if !CYTHON_ASSUME_SAFE_SIZE
  14858. Py_ssize_t nkw = PyDict_Size(kw);
  14859. if (unlikely(nkw == -1)) return NULL;
  14860. #else
  14861. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  14862. #endif
  14863. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  14864. if (unlikely(newargs == NULL)) {
  14865. PyErr_NoMemory();
  14866. return NULL;
  14867. }
  14868. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  14869. kwnames = PyTuple_New(nkw);
  14870. if (unlikely(kwnames == NULL)) {
  14871. PyMem_Free(newargs);
  14872. return NULL;
  14873. }
  14874. kwvalues = newargs + nargs;
  14875. pos = 0;
  14876. i = 0;
  14877. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  14878. while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
  14879. keys_are_strings &=
  14880. #if CYTHON_COMPILING_IN_LIMITED_API
  14881. PyType_GetFlags(Py_TYPE(key));
  14882. #else
  14883. Py_TYPE(key)->tp_flags;
  14884. #endif
  14885. #if !CYTHON_ASSUME_SAFE_MACROS
  14886. if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
  14887. #else
  14888. PyTuple_SET_ITEM(kwnames, i, key);
  14889. #endif
  14890. kwvalues[i] = value;
  14891. i++;
  14892. }
  14893. if (unlikely(!keys_are_strings)) {
  14894. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  14895. goto cleanup;
  14896. }
  14897. res = vc(func, newargs, nargs, kwnames);
  14898. cleanup:
  14899. #if CYTHON_AVOID_BORROWED_REFS
  14900. Py_DECREF(pos);
  14901. #endif
  14902. Py_DECREF(kwnames);
  14903. for (i = 0; i < nkw; i++)
  14904. Py_DECREF(kwvalues[i]);
  14905. PyMem_Free(newargs);
  14906. return res;
  14907. }
  14908. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14909. {
  14910. Py_ssize_t kw_size =
  14911. likely(kw == NULL) ?
  14912. 0 :
  14913. #if !CYTHON_ASSUME_SAFE_SIZE
  14914. PyDict_Size(kw);
  14915. #else
  14916. PyDict_GET_SIZE(kw);
  14917. #endif
  14918. if (kw_size == 0) {
  14919. return vc(func, args, nargs, NULL);
  14920. }
  14921. #if !CYTHON_ASSUME_SAFE_SIZE
  14922. else if (unlikely(kw_size == -1)) {
  14923. return NULL;
  14924. }
  14925. #endif
  14926. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  14927. }
  14928. #endif
  14929. /* CythonFunctionShared (used by CythonFunction) */
  14930. #if CYTHON_COMPILING_IN_LIMITED_API
  14931. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
  14932. if (__Pyx_CyFunction_Check(func)) {
  14933. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  14934. } else if (PyCFunction_Check(func)) {
  14935. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  14936. }
  14937. return 0;
  14938. }
  14939. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  14940. if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
  14941. int result;
  14942. PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
  14943. if (unlikely(!newFunc)) {
  14944. PyErr_Clear(); // It's only an optimization, so don't throw an error
  14945. return 0;
  14946. }
  14947. result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
  14948. Py_DECREF(newFunc);
  14949. return result;
  14950. }
  14951. return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
  14952. }
  14953. #else
  14954. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  14955. if (PyMethod_Check(func)) {
  14956. func = PyMethod_GET_FUNCTION(func);
  14957. }
  14958. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  14959. }
  14960. #endif
  14961. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  14962. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  14963. __Pyx_Py_XDECREF_SET(
  14964. __Pyx_CyFunction_GetClassObj(f),
  14965. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  14966. #else
  14967. __Pyx_Py_XDECREF_SET(
  14968. ((PyCMethodObject *) (f))->mm_class,
  14969. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  14970. #endif
  14971. }
  14972. static PyObject *
  14973. __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
  14974. {
  14975. if (unlikely(op->func_doc == NULL)) {
  14976. #if CYTHON_COMPILING_IN_LIMITED_API
  14977. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  14978. if (unlikely(!op->func_doc)) return NULL;
  14979. #else
  14980. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  14981. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  14982. if (unlikely(op->func_doc == NULL))
  14983. return NULL;
  14984. } else {
  14985. Py_INCREF(Py_None);
  14986. return Py_None;
  14987. }
  14988. #endif
  14989. }
  14990. Py_INCREF(op->func_doc);
  14991. return op->func_doc;
  14992. }
  14993. static PyObject *
  14994. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
  14995. PyObject *result;
  14996. CYTHON_UNUSED_VAR(closure);
  14997. __Pyx_BEGIN_CRITICAL_SECTION(op);
  14998. result = __Pyx_CyFunction_get_doc_locked(op);
  14999. __Pyx_END_CRITICAL_SECTION();
  15000. return result;
  15001. }
  15002. static int
  15003. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15004. {
  15005. CYTHON_UNUSED_VAR(context);
  15006. if (value == NULL) {
  15007. value = Py_None;
  15008. }
  15009. Py_INCREF(value);
  15010. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15011. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  15012. __Pyx_END_CRITICAL_SECTION();
  15013. return 0;
  15014. }
  15015. static PyObject *
  15016. __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
  15017. {
  15018. if (unlikely(op->func_name == NULL)) {
  15019. #if CYTHON_COMPILING_IN_LIMITED_API
  15020. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  15021. #else
  15022. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  15023. #endif
  15024. if (unlikely(op->func_name == NULL))
  15025. return NULL;
  15026. }
  15027. Py_INCREF(op->func_name);
  15028. return op->func_name;
  15029. }
  15030. static PyObject *
  15031. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  15032. {
  15033. PyObject *result = NULL;
  15034. CYTHON_UNUSED_VAR(context);
  15035. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15036. result = __Pyx_CyFunction_get_name_locked(op);
  15037. __Pyx_END_CRITICAL_SECTION();
  15038. return result;
  15039. }
  15040. static int
  15041. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15042. {
  15043. CYTHON_UNUSED_VAR(context);
  15044. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  15045. PyErr_SetString(PyExc_TypeError,
  15046. "__name__ must be set to a string object");
  15047. return -1;
  15048. }
  15049. Py_INCREF(value);
  15050. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15051. __Pyx_Py_XDECREF_SET(op->func_name, value);
  15052. __Pyx_END_CRITICAL_SECTION();
  15053. return 0;
  15054. }
  15055. static PyObject *
  15056. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  15057. {
  15058. CYTHON_UNUSED_VAR(context);
  15059. PyObject *result;
  15060. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15061. Py_INCREF(op->func_qualname);
  15062. result = op->func_qualname;
  15063. __Pyx_END_CRITICAL_SECTION();
  15064. return result;
  15065. }
  15066. static int
  15067. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15068. {
  15069. CYTHON_UNUSED_VAR(context);
  15070. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  15071. PyErr_SetString(PyExc_TypeError,
  15072. "__qualname__ must be set to a string object");
  15073. return -1;
  15074. }
  15075. Py_INCREF(value);
  15076. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15077. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  15078. __Pyx_END_CRITICAL_SECTION();
  15079. return 0;
  15080. }
  15081. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15082. static PyObject *
  15083. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  15084. {
  15085. CYTHON_UNUSED_VAR(context);
  15086. if (unlikely(op->func_dict == NULL)) {
  15087. op->func_dict = PyDict_New();
  15088. if (unlikely(op->func_dict == NULL))
  15089. return NULL;
  15090. }
  15091. Py_INCREF(op->func_dict);
  15092. return op->func_dict;
  15093. }
  15094. #endif
  15095. static PyObject *
  15096. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  15097. {
  15098. CYTHON_UNUSED_VAR(context);
  15099. Py_INCREF(op->func_globals);
  15100. return op->func_globals;
  15101. }
  15102. static PyObject *
  15103. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  15104. {
  15105. CYTHON_UNUSED_VAR(op);
  15106. CYTHON_UNUSED_VAR(context);
  15107. Py_INCREF(Py_None);
  15108. return Py_None;
  15109. }
  15110. static PyObject *
  15111. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  15112. {
  15113. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  15114. CYTHON_UNUSED_VAR(context);
  15115. Py_INCREF(result);
  15116. return result;
  15117. }
  15118. static int
  15119. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  15120. int result = 0;
  15121. PyObject *res = op->defaults_getter((PyObject *) op);
  15122. if (unlikely(!res))
  15123. return -1;
  15124. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15125. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  15126. Py_INCREF(op->defaults_tuple);
  15127. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  15128. Py_INCREF(op->defaults_kwdict);
  15129. #else
  15130. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  15131. if (unlikely(!op->defaults_tuple)) result = -1;
  15132. else {
  15133. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  15134. if (unlikely(!op->defaults_kwdict)) result = -1;
  15135. }
  15136. #endif
  15137. Py_DECREF(res);
  15138. return result;
  15139. }
  15140. static int
  15141. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15142. CYTHON_UNUSED_VAR(context);
  15143. if (!value) {
  15144. value = Py_None;
  15145. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  15146. PyErr_SetString(PyExc_TypeError,
  15147. "__defaults__ must be set to a tuple object");
  15148. return -1;
  15149. }
  15150. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  15151. "currently affect the values used in function calls", 1);
  15152. Py_INCREF(value);
  15153. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15154. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  15155. __Pyx_END_CRITICAL_SECTION();
  15156. return 0;
  15157. }
  15158. static PyObject *
  15159. __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
  15160. PyObject* result = op->defaults_tuple;
  15161. if (unlikely(!result)) {
  15162. if (op->defaults_getter) {
  15163. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15164. result = op->defaults_tuple;
  15165. } else {
  15166. result = Py_None;
  15167. }
  15168. }
  15169. Py_INCREF(result);
  15170. return result;
  15171. }
  15172. static PyObject *
  15173. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  15174. PyObject* result = NULL;
  15175. CYTHON_UNUSED_VAR(context);
  15176. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15177. result = __Pyx_CyFunction_get_defaults_locked(op);
  15178. __Pyx_END_CRITICAL_SECTION();
  15179. return result;
  15180. }
  15181. static int
  15182. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15183. CYTHON_UNUSED_VAR(context);
  15184. if (!value) {
  15185. value = Py_None;
  15186. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  15187. PyErr_SetString(PyExc_TypeError,
  15188. "__kwdefaults__ must be set to a dict object");
  15189. return -1;
  15190. }
  15191. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  15192. "currently affect the values used in function calls", 1);
  15193. Py_INCREF(value);
  15194. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15195. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  15196. __Pyx_END_CRITICAL_SECTION();
  15197. return 0;
  15198. }
  15199. static PyObject *
  15200. __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
  15201. PyObject* result = op->defaults_kwdict;
  15202. if (unlikely(!result)) {
  15203. if (op->defaults_getter) {
  15204. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15205. result = op->defaults_kwdict;
  15206. } else {
  15207. result = Py_None;
  15208. }
  15209. }
  15210. Py_INCREF(result);
  15211. return result;
  15212. }
  15213. static PyObject *
  15214. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  15215. PyObject* result;
  15216. CYTHON_UNUSED_VAR(context);
  15217. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15218. result = __Pyx_CyFunction_get_kwdefaults_locked(op);
  15219. __Pyx_END_CRITICAL_SECTION();
  15220. return result;
  15221. }
  15222. static int
  15223. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15224. CYTHON_UNUSED_VAR(context);
  15225. if (!value || value == Py_None) {
  15226. value = NULL;
  15227. } else if (unlikely(!PyDict_Check(value))) {
  15228. PyErr_SetString(PyExc_TypeError,
  15229. "__annotations__ must be set to a dict object");
  15230. return -1;
  15231. }
  15232. Py_XINCREF(value);
  15233. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15234. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  15235. __Pyx_END_CRITICAL_SECTION();
  15236. return 0;
  15237. }
  15238. static PyObject *
  15239. __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
  15240. PyObject* result = op->func_annotations;
  15241. if (unlikely(!result)) {
  15242. result = PyDict_New();
  15243. if (unlikely(!result)) return NULL;
  15244. op->func_annotations = result;
  15245. }
  15246. Py_INCREF(result);
  15247. return result;
  15248. }
  15249. static PyObject *
  15250. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  15251. PyObject *result;
  15252. CYTHON_UNUSED_VAR(context);
  15253. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15254. result = __Pyx_CyFunction_get_annotations_locked(op);
  15255. __Pyx_END_CRITICAL_SECTION();
  15256. return result;
  15257. }
  15258. static PyObject *
  15259. __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
  15260. int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  15261. if (is_coroutine) {
  15262. PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
  15263. fromlist = PyList_New(1);
  15264. if (unlikely(!fromlist)) return NULL;
  15265. Py_INCREF(marker);
  15266. #if CYTHON_ASSUME_SAFE_MACROS
  15267. PyList_SET_ITEM(fromlist, 0, marker);
  15268. #else
  15269. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  15270. Py_DECREF(marker);
  15271. Py_DECREF(fromlist);
  15272. return NULL;
  15273. }
  15274. #endif
  15275. module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
  15276. Py_DECREF(fromlist);
  15277. if (unlikely(!module)) goto ignore;
  15278. is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
  15279. Py_DECREF(module);
  15280. if (likely(is_coroutine_value)) {
  15281. return is_coroutine_value;
  15282. }
  15283. ignore:
  15284. PyErr_Clear();
  15285. }
  15286. return __Pyx_PyBool_FromLong(is_coroutine);
  15287. }
  15288. static PyObject *
  15289. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  15290. PyObject *result;
  15291. CYTHON_UNUSED_VAR(context);
  15292. if (op->func_is_coroutine) {
  15293. return __Pyx_NewRef(op->func_is_coroutine);
  15294. }
  15295. result = __Pyx_CyFunction_get_is_coroutine_value(op);
  15296. if (unlikely(!result))
  15297. return NULL;
  15298. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15299. if (op->func_is_coroutine) {
  15300. Py_DECREF(result);
  15301. result = __Pyx_NewRef(op->func_is_coroutine);
  15302. } else {
  15303. op->func_is_coroutine = __Pyx_NewRef(result);
  15304. }
  15305. __Pyx_END_CRITICAL_SECTION();
  15306. return result;
  15307. }
  15308. static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
  15309. #if CYTHON_COMPILING_IN_LIMITED_API
  15310. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  15311. if (!py_name) return;
  15312. PyErr_Format(PyExc_TypeError,
  15313. "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15314. py_name, message, size);
  15315. Py_DECREF(py_name);
  15316. #else
  15317. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  15318. PyErr_Format(PyExc_TypeError,
  15319. "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15320. name, message, size);
  15321. #endif
  15322. }
  15323. static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
  15324. #if CYTHON_COMPILING_IN_LIMITED_API
  15325. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  15326. if (!py_name) return;
  15327. PyErr_Format(PyExc_TypeError,
  15328. "%.200S() %s",
  15329. py_name, message);
  15330. Py_DECREF(py_name);
  15331. #else
  15332. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  15333. PyErr_Format(PyExc_TypeError,
  15334. "%.200s() %s",
  15335. name, message);
  15336. #endif
  15337. }
  15338. #if CYTHON_COMPILING_IN_LIMITED_API
  15339. static PyObject *
  15340. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  15341. CYTHON_UNUSED_VAR(context);
  15342. return PyObject_GetAttrString(op->func, "__module__");
  15343. }
  15344. static int
  15345. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15346. CYTHON_UNUSED_VAR(context);
  15347. return PyObject_SetAttrString(op->func, "__module__", value);
  15348. }
  15349. #endif
  15350. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  15351. {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15352. {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15353. {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15354. {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15355. {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  15356. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15357. {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  15358. {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  15359. #else
  15360. {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  15361. {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  15362. #endif
  15363. {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15364. {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15365. {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15366. {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15367. {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15368. {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15369. {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15370. {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15371. {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  15372. {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  15373. {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  15374. #if CYTHON_COMPILING_IN_LIMITED_API
  15375. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  15376. #endif
  15377. {0, 0, 0, 0, 0}
  15378. };
  15379. static PyMemberDef __pyx_CyFunction_members[] = {
  15380. #if !CYTHON_COMPILING_IN_LIMITED_API
  15381. {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  15382. #endif
  15383. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15384. {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  15385. #endif
  15386. #if CYTHON_METH_FASTCALL
  15387. #if CYTHON_COMPILING_IN_LIMITED_API
  15388. {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  15389. #else
  15390. {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  15391. #endif
  15392. #if CYTHON_COMPILING_IN_LIMITED_API
  15393. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  15394. #else
  15395. {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  15396. #endif
  15397. #endif
  15398. {0, 0, 0, 0, 0}
  15399. };
  15400. static PyObject *
  15401. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  15402. {
  15403. PyObject *result = NULL;
  15404. CYTHON_UNUSED_VAR(args);
  15405. __Pyx_BEGIN_CRITICAL_SECTION(m);
  15406. Py_INCREF(m->func_qualname);
  15407. result = m->func_qualname;
  15408. __Pyx_END_CRITICAL_SECTION();
  15409. return result;
  15410. }
  15411. static PyMethodDef __pyx_CyFunction_methods[] = {
  15412. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  15413. {0, 0, 0, 0}
  15414. };
  15415. #if CYTHON_COMPILING_IN_LIMITED_API
  15416. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  15417. #else
  15418. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  15419. #endif
  15420. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  15421. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  15422. #if !CYTHON_COMPILING_IN_LIMITED_API
  15423. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  15424. #endif
  15425. if (unlikely(op == NULL))
  15426. return NULL;
  15427. #if CYTHON_COMPILING_IN_LIMITED_API
  15428. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  15429. if (unlikely(!op->func)) return NULL;
  15430. #endif
  15431. op->flags = flags;
  15432. __Pyx_CyFunction_weakreflist(op) = NULL;
  15433. #if !CYTHON_COMPILING_IN_LIMITED_API
  15434. cf->m_ml = ml;
  15435. cf->m_self = (PyObject *) op;
  15436. #endif
  15437. Py_XINCREF(closure);
  15438. op->func_closure = closure;
  15439. #if !CYTHON_COMPILING_IN_LIMITED_API
  15440. Py_XINCREF(module);
  15441. cf->m_module = module;
  15442. #endif
  15443. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15444. op->func_dict = NULL;
  15445. #endif
  15446. op->func_name = NULL;
  15447. Py_INCREF(qualname);
  15448. op->func_qualname = qualname;
  15449. op->func_doc = NULL;
  15450. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  15451. op->func_classobj = NULL;
  15452. #else
  15453. ((PyCMethodObject*)op)->mm_class = NULL;
  15454. #endif
  15455. op->func_globals = globals;
  15456. Py_INCREF(op->func_globals);
  15457. Py_XINCREF(code);
  15458. op->func_code = code;
  15459. op->defaults = NULL;
  15460. op->defaults_tuple = NULL;
  15461. op->defaults_kwdict = NULL;
  15462. op->defaults_getter = NULL;
  15463. op->func_annotations = NULL;
  15464. op->func_is_coroutine = NULL;
  15465. #if CYTHON_METH_FASTCALL
  15466. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  15467. case METH_NOARGS:
  15468. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  15469. break;
  15470. case METH_O:
  15471. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  15472. break;
  15473. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  15474. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  15475. break;
  15476. case METH_FASTCALL | METH_KEYWORDS:
  15477. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  15478. break;
  15479. case METH_VARARGS | METH_KEYWORDS:
  15480. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  15481. break;
  15482. default:
  15483. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15484. Py_DECREF(op);
  15485. return NULL;
  15486. }
  15487. #endif
  15488. return (PyObject *) op;
  15489. }
  15490. static int
  15491. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  15492. {
  15493. Py_CLEAR(m->func_closure);
  15494. #if CYTHON_COMPILING_IN_LIMITED_API
  15495. Py_CLEAR(m->func);
  15496. #else
  15497. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  15498. #endif
  15499. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15500. Py_CLEAR(m->func_dict);
  15501. #elif PY_VERSION_HEX < 0x030d0000
  15502. _PyObject_ClearManagedDict((PyObject*)m);
  15503. #else
  15504. PyObject_ClearManagedDict((PyObject*)m);
  15505. #endif
  15506. Py_CLEAR(m->func_name);
  15507. Py_CLEAR(m->func_qualname);
  15508. Py_CLEAR(m->func_doc);
  15509. Py_CLEAR(m->func_globals);
  15510. Py_CLEAR(m->func_code);
  15511. #if !CYTHON_COMPILING_IN_LIMITED_API
  15512. #if PY_VERSION_HEX < 0x030900B1
  15513. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  15514. #else
  15515. {
  15516. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  15517. ((PyCMethodObject *) (m))->mm_class = NULL;
  15518. Py_XDECREF(cls);
  15519. }
  15520. #endif
  15521. #endif
  15522. Py_CLEAR(m->defaults_tuple);
  15523. Py_CLEAR(m->defaults_kwdict);
  15524. Py_CLEAR(m->func_annotations);
  15525. Py_CLEAR(m->func_is_coroutine);
  15526. Py_CLEAR(m->defaults);
  15527. return 0;
  15528. }
  15529. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15530. {
  15531. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  15532. PyObject_ClearWeakRefs((PyObject *) m);
  15533. __Pyx_CyFunction_clear(m);
  15534. __Pyx_PyHeapTypeObject_GC_Del(m);
  15535. }
  15536. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15537. {
  15538. PyObject_GC_UnTrack(m);
  15539. __Pyx__CyFunction_dealloc(m);
  15540. }
  15541. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  15542. {
  15543. {
  15544. int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
  15545. if (e) return e;
  15546. }
  15547. Py_VISIT(m->func_closure);
  15548. #if CYTHON_COMPILING_IN_LIMITED_API
  15549. Py_VISIT(m->func);
  15550. #else
  15551. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  15552. #endif
  15553. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  15554. Py_VISIT(m->func_dict);
  15555. #else
  15556. {
  15557. int e =
  15558. #if PY_VERSION_HEX < 0x030d0000
  15559. _PyObject_VisitManagedDict
  15560. #else
  15561. PyObject_VisitManagedDict
  15562. #endif
  15563. ((PyObject*)m, visit, arg);
  15564. if (e != 0) return e;
  15565. }
  15566. #endif
  15567. __Pyx_VISIT_CONST(m->func_name);
  15568. __Pyx_VISIT_CONST(m->func_qualname);
  15569. Py_VISIT(m->func_doc);
  15570. Py_VISIT(m->func_globals);
  15571. __Pyx_VISIT_CONST(m->func_code);
  15572. #if !CYTHON_COMPILING_IN_LIMITED_API
  15573. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  15574. #endif
  15575. Py_VISIT(m->defaults_tuple);
  15576. Py_VISIT(m->defaults_kwdict);
  15577. Py_VISIT(m->func_is_coroutine);
  15578. Py_VISIT(m->defaults);
  15579. return 0;
  15580. }
  15581. static PyObject*
  15582. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  15583. {
  15584. PyObject *repr;
  15585. __Pyx_BEGIN_CRITICAL_SECTION(op);
  15586. repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
  15587. op->func_qualname, (void *)op);
  15588. __Pyx_END_CRITICAL_SECTION();
  15589. return repr;
  15590. }
  15591. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  15592. #if CYTHON_COMPILING_IN_LIMITED_API
  15593. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  15594. PyCFunction meth;
  15595. int flags;
  15596. meth = PyCFunction_GetFunction(f);
  15597. if (unlikely(!meth)) return NULL;
  15598. flags = PyCFunction_GetFlags(f);
  15599. if (unlikely(flags < 0)) return NULL;
  15600. #else
  15601. PyCFunctionObject* f = (PyCFunctionObject*)func;
  15602. PyCFunction meth = f->m_ml->ml_meth;
  15603. int flags = f->m_ml->ml_flags;
  15604. #endif
  15605. Py_ssize_t size;
  15606. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  15607. case METH_VARARGS:
  15608. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  15609. return (*meth)(self, arg);
  15610. break;
  15611. case METH_VARARGS | METH_KEYWORDS:
  15612. return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
  15613. case METH_NOARGS:
  15614. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15615. #if CYTHON_ASSUME_SAFE_SIZE
  15616. size = PyTuple_GET_SIZE(arg);
  15617. #else
  15618. size = PyTuple_Size(arg);
  15619. if (unlikely(size < 0)) return NULL;
  15620. #endif
  15621. if (likely(size == 0))
  15622. return (*meth)(self, NULL);
  15623. __Pyx_CyFunction_raise_argument_count_error(
  15624. (__pyx_CyFunctionObject*)func,
  15625. "takes no arguments", size);
  15626. return NULL;
  15627. }
  15628. break;
  15629. case METH_O:
  15630. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15631. #if CYTHON_ASSUME_SAFE_SIZE
  15632. size = PyTuple_GET_SIZE(arg);
  15633. #else
  15634. size = PyTuple_Size(arg);
  15635. if (unlikely(size < 0)) return NULL;
  15636. #endif
  15637. if (likely(size == 1)) {
  15638. PyObject *result, *arg0;
  15639. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15640. arg0 = PyTuple_GET_ITEM(arg, 0);
  15641. #else
  15642. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  15643. #endif
  15644. result = (*meth)(self, arg0);
  15645. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  15646. Py_DECREF(arg0);
  15647. #endif
  15648. return result;
  15649. }
  15650. __Pyx_CyFunction_raise_argument_count_error(
  15651. (__pyx_CyFunctionObject*)func,
  15652. "takes exactly one argument", size);
  15653. return NULL;
  15654. }
  15655. break;
  15656. default:
  15657. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15658. return NULL;
  15659. }
  15660. __Pyx_CyFunction_raise_type_error(
  15661. (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
  15662. return NULL;
  15663. }
  15664. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  15665. PyObject *self, *result;
  15666. #if CYTHON_COMPILING_IN_LIMITED_API
  15667. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  15668. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15669. #else
  15670. self = ((PyCFunctionObject*)func)->m_self;
  15671. #endif
  15672. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  15673. return result;
  15674. }
  15675. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  15676. PyObject *result;
  15677. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  15678. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  15679. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  15680. if (vc) {
  15681. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  15682. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  15683. #else
  15684. (void) &__Pyx_PyVectorcall_FastCallDict;
  15685. return PyVectorcall_Call(func, args, kw);
  15686. #endif
  15687. }
  15688. #endif
  15689. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15690. Py_ssize_t argc;
  15691. PyObject *new_args;
  15692. PyObject *self;
  15693. #if CYTHON_ASSUME_SAFE_SIZE
  15694. argc = PyTuple_GET_SIZE(args);
  15695. #else
  15696. argc = PyTuple_Size(args);
  15697. if (unlikely(argc < 0)) return NULL;
  15698. #endif
  15699. new_args = PyTuple_GetSlice(args, 1, argc);
  15700. if (unlikely(!new_args))
  15701. return NULL;
  15702. self = PyTuple_GetItem(args, 0);
  15703. if (unlikely(!self)) {
  15704. Py_DECREF(new_args);
  15705. PyErr_Format(PyExc_TypeError,
  15706. "unbound method %.200S() needs an argument",
  15707. cyfunc->func_qualname);
  15708. return NULL;
  15709. }
  15710. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  15711. Py_DECREF(new_args);
  15712. } else {
  15713. result = __Pyx_CyFunction_Call(func, args, kw);
  15714. }
  15715. return result;
  15716. }
  15717. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  15718. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  15719. {
  15720. int ret = 0;
  15721. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15722. if (unlikely(nargs < 1)) {
  15723. __Pyx_CyFunction_raise_type_error(
  15724. cyfunc, "needs an argument");
  15725. return -1;
  15726. }
  15727. ret = 1;
  15728. }
  15729. if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
  15730. __Pyx_CyFunction_raise_type_error(
  15731. cyfunc, "takes no keyword arguments");
  15732. return -1;
  15733. }
  15734. return ret;
  15735. }
  15736. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15737. {
  15738. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15739. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15740. PyObject *self;
  15741. #if CYTHON_COMPILING_IN_LIMITED_API
  15742. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15743. if (unlikely(!meth)) return NULL;
  15744. #else
  15745. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15746. #endif
  15747. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15748. case 1:
  15749. self = args[0];
  15750. args += 1;
  15751. nargs -= 1;
  15752. break;
  15753. case 0:
  15754. #if CYTHON_COMPILING_IN_LIMITED_API
  15755. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15756. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15757. #else
  15758. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15759. #endif
  15760. break;
  15761. default:
  15762. return NULL;
  15763. }
  15764. if (unlikely(nargs != 0)) {
  15765. __Pyx_CyFunction_raise_argument_count_error(
  15766. cyfunc, "takes no arguments", nargs);
  15767. return NULL;
  15768. }
  15769. return meth(self, NULL);
  15770. }
  15771. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15772. {
  15773. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15774. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15775. PyObject *self;
  15776. #if CYTHON_COMPILING_IN_LIMITED_API
  15777. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15778. if (unlikely(!meth)) return NULL;
  15779. #else
  15780. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15781. #endif
  15782. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15783. case 1:
  15784. self = args[0];
  15785. args += 1;
  15786. nargs -= 1;
  15787. break;
  15788. case 0:
  15789. #if CYTHON_COMPILING_IN_LIMITED_API
  15790. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15791. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15792. #else
  15793. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15794. #endif
  15795. break;
  15796. default:
  15797. return NULL;
  15798. }
  15799. if (unlikely(nargs != 1)) {
  15800. __Pyx_CyFunction_raise_argument_count_error(
  15801. cyfunc, "takes exactly one argument", nargs);
  15802. return NULL;
  15803. }
  15804. return meth(self, args[0]);
  15805. }
  15806. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15807. {
  15808. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15809. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15810. PyObject *self;
  15811. #if CYTHON_COMPILING_IN_LIMITED_API
  15812. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15813. if (unlikely(!meth)) return NULL;
  15814. #else
  15815. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15816. #endif
  15817. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15818. case 1:
  15819. self = args[0];
  15820. args += 1;
  15821. nargs -= 1;
  15822. break;
  15823. case 0:
  15824. #if CYTHON_COMPILING_IN_LIMITED_API
  15825. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15826. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15827. #else
  15828. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15829. #endif
  15830. break;
  15831. default:
  15832. return NULL;
  15833. }
  15834. return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
  15835. }
  15836. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15837. {
  15838. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15839. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  15840. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15841. PyObject *self;
  15842. #if CYTHON_COMPILING_IN_LIMITED_API
  15843. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  15844. if (unlikely(!meth)) return NULL;
  15845. #else
  15846. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  15847. #endif
  15848. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15849. case 1:
  15850. self = args[0];
  15851. args += 1;
  15852. nargs -= 1;
  15853. break;
  15854. case 0:
  15855. #if CYTHON_COMPILING_IN_LIMITED_API
  15856. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  15857. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15858. #else
  15859. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15860. #endif
  15861. break;
  15862. default:
  15863. return NULL;
  15864. }
  15865. #if PY_VERSION_HEX < 0x030e00A6
  15866. size_t nargs_value = (size_t) nargs;
  15867. #else
  15868. Py_ssize_t nargs_value = nargs;
  15869. #endif
  15870. return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
  15871. }
  15872. #endif
  15873. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  15874. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  15875. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  15876. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  15877. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  15878. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  15879. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  15880. {Py_tp_members, (void *)__pyx_CyFunction_members},
  15881. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  15882. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  15883. {0, 0},
  15884. };
  15885. static PyType_Spec __pyx_CyFunctionType_spec = {
  15886. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  15887. sizeof(__pyx_CyFunctionObject),
  15888. 0,
  15889. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  15890. Py_TPFLAGS_METHOD_DESCRIPTOR |
  15891. #endif
  15892. #if CYTHON_METH_FASTCALL
  15893. #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
  15894. Py_TPFLAGS_HAVE_VECTORCALL |
  15895. #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
  15896. _Py_TPFLAGS_HAVE_VECTORCALL |
  15897. #endif
  15898. #endif // CYTHON_METH_FASTCALL
  15899. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  15900. Py_TPFLAGS_MANAGED_DICT |
  15901. #endif
  15902. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  15903. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  15904. __pyx_CyFunctionType_slots
  15905. };
  15906. static int __pyx_CyFunction_init(PyObject *module) {
  15907. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  15908. mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
  15909. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
  15910. if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
  15911. return -1;
  15912. }
  15913. return 0;
  15914. }
  15915. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
  15916. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15917. m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
  15918. if (unlikely(!m->defaults))
  15919. return NULL;
  15920. return m->defaults;
  15921. }
  15922. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  15923. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15924. m->defaults_tuple = tuple;
  15925. Py_INCREF(tuple);
  15926. }
  15927. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  15928. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15929. m->defaults_kwdict = dict;
  15930. Py_INCREF(dict);
  15931. }
  15932. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  15933. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15934. m->func_annotations = dict;
  15935. Py_INCREF(dict);
  15936. }
  15937. /* CythonFunction */
  15938. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  15939. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  15940. PyObject *op = __Pyx_CyFunction_Init(
  15941. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
  15942. ml, flags, qualname, closure, module, globals, code
  15943. );
  15944. if (likely(op)) {
  15945. PyObject_GC_Track(op);
  15946. }
  15947. return op;
  15948. }
  15949. /* CLineInTraceback (used by AddTraceback) */
  15950. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  15951. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  15952. #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  15953. #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  15954. #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  15955. #else
  15956. PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
  15957. PyObject **dict_ptr = _PyObject_GetDictPtr(o);
  15958. return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  15959. }
  15960. #endif
  15961. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  15962. PyObject *use_cline = NULL;
  15963. PyObject *ptype, *pvalue, *ptraceback;
  15964. PyObject *cython_runtime_dict;
  15965. CYTHON_MAYBE_UNUSED_VAR(tstate);
  15966. if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
  15967. return c_line;
  15968. }
  15969. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  15970. cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
  15971. if (likely(cython_runtime_dict)) {
  15972. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  15973. use_cline, cython_runtime_dict,
  15974. __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
  15975. }
  15976. if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  15977. c_line = 0;
  15978. }
  15979. Py_XDECREF(use_cline);
  15980. Py_XDECREF(cython_runtime_dict);
  15981. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  15982. return c_line;
  15983. }
  15984. #endif
  15985. /* CodeObjectCache (used by AddTraceback) */
  15986. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  15987. int start = 0, mid = 0, end = count - 1;
  15988. if (end >= 0 && code_line > entries[end].code_line) {
  15989. return count;
  15990. }
  15991. while (start < end) {
  15992. mid = start + (end - start) / 2;
  15993. if (code_line < entries[mid].code_line) {
  15994. end = mid;
  15995. } else if (code_line > entries[mid].code_line) {
  15996. start = mid + 1;
  15997. } else {
  15998. return mid;
  15999. }
  16000. }
  16001. if (code_line <= entries[mid].code_line) {
  16002. return mid;
  16003. } else {
  16004. return mid + 1;
  16005. }
  16006. }
  16007. static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
  16008. __Pyx_CachedCodeObjectType* code_object;
  16009. int pos;
  16010. if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
  16011. return NULL;
  16012. }
  16013. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  16014. if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
  16015. return NULL;
  16016. }
  16017. code_object = code_cache->entries[pos].code_object;
  16018. Py_INCREF(code_object);
  16019. return code_object;
  16020. }
  16021. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  16022. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  16023. (void)__pyx__find_code_object;
  16024. return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  16025. #else
  16026. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  16027. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16028. __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
  16029. if (old_count < 0) {
  16030. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  16031. return NULL;
  16032. }
  16033. #endif
  16034. __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  16035. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16036. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  16037. #endif
  16038. return result;
  16039. #endif
  16040. }
  16041. static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  16042. {
  16043. int pos, i;
  16044. __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
  16045. if (unlikely(!code_line)) {
  16046. return;
  16047. }
  16048. if (unlikely(!entries)) {
  16049. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  16050. if (likely(entries)) {
  16051. code_cache->entries = entries;
  16052. code_cache->max_count = 64;
  16053. code_cache->count = 1;
  16054. entries[0].code_line = code_line;
  16055. entries[0].code_object = code_object;
  16056. Py_INCREF(code_object);
  16057. }
  16058. return;
  16059. }
  16060. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  16061. if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
  16062. __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
  16063. entries[pos].code_object = code_object;
  16064. Py_INCREF(code_object);
  16065. Py_DECREF(tmp);
  16066. return;
  16067. }
  16068. if (code_cache->count == code_cache->max_count) {
  16069. int new_max = code_cache->max_count + 64;
  16070. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  16071. code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  16072. if (unlikely(!entries)) {
  16073. return;
  16074. }
  16075. code_cache->entries = entries;
  16076. code_cache->max_count = new_max;
  16077. }
  16078. for (i=code_cache->count; i>pos; i--) {
  16079. entries[i] = entries[i-1];
  16080. }
  16081. entries[pos].code_line = code_line;
  16082. entries[pos].code_object = code_object;
  16083. code_cache->count++;
  16084. Py_INCREF(code_object);
  16085. }
  16086. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  16087. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  16088. (void)__pyx__insert_code_object;
  16089. return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  16090. #else
  16091. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  16092. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16093. __pyx_nonatomic_int_type expected = 0;
  16094. if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
  16095. return;
  16096. }
  16097. #endif
  16098. __pyx__insert_code_object(code_cache, code_line, code_object);
  16099. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  16100. __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  16101. #endif
  16102. #endif
  16103. }
  16104. /* AddTraceback */
  16105. #include "compile.h"
  16106. #include "frameobject.h"
  16107. #include "traceback.h"
  16108. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  16109. #ifndef Py_BUILD_CORE
  16110. #define Py_BUILD_CORE 1
  16111. #endif
  16112. #include "internal/pycore_frame.h"
  16113. #endif
  16114. #if CYTHON_COMPILING_IN_LIMITED_API
  16115. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  16116. PyObject *firstlineno, PyObject *name) {
  16117. PyObject *replace = NULL;
  16118. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  16119. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  16120. replace = PyObject_GetAttrString(code, "replace");
  16121. if (likely(replace)) {
  16122. PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
  16123. Py_DECREF(replace);
  16124. return result;
  16125. }
  16126. PyErr_Clear();
  16127. return NULL;
  16128. }
  16129. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16130. int py_line, const char *filename) {
  16131. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  16132. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  16133. PyObject *exc_type, *exc_value, *exc_traceback;
  16134. int success = 0;
  16135. if (c_line) {
  16136. c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  16137. }
  16138. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  16139. code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
  16140. if (!code_object) {
  16141. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  16142. if (unlikely(!code_object)) goto bad;
  16143. py_py_line = PyLong_FromLong(py_line);
  16144. if (unlikely(!py_py_line)) goto bad;
  16145. if (c_line) {
  16146. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16147. } else {
  16148. py_funcname = PyUnicode_FromString(funcname);
  16149. }
  16150. if (unlikely(!py_funcname)) goto bad;
  16151. dict = PyDict_New();
  16152. if (unlikely(!dict)) goto bad;
  16153. {
  16154. PyObject *old_code_object = code_object;
  16155. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  16156. Py_DECREF(old_code_object);
  16157. }
  16158. if (unlikely(!code_object)) goto bad;
  16159. __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
  16160. } else {
  16161. dict = PyDict_New();
  16162. }
  16163. getframe = PySys_GetObject("_getframe");
  16164. if (unlikely(!getframe)) goto bad;
  16165. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  16166. frame = PyEval_EvalCode(code_object, dict, dict);
  16167. if (unlikely(!frame) || frame == Py_None) goto bad;
  16168. success = 1;
  16169. bad:
  16170. PyErr_Restore(exc_type, exc_value, exc_traceback);
  16171. Py_XDECREF(code_object);
  16172. Py_XDECREF(py_py_line);
  16173. Py_XDECREF(py_funcname);
  16174. Py_XDECREF(dict);
  16175. Py_XDECREF(replace);
  16176. if (success) {
  16177. PyTraceBack_Here(
  16178. (struct _frame*)frame);
  16179. }
  16180. Py_XDECREF(frame);
  16181. }
  16182. #else
  16183. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  16184. const char *funcname, int c_line,
  16185. int py_line, const char *filename) {
  16186. PyCodeObject *py_code = NULL;
  16187. PyObject *py_funcname = NULL;
  16188. if (c_line) {
  16189. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16190. if (!py_funcname) goto bad;
  16191. funcname = PyUnicode_AsUTF8(py_funcname);
  16192. if (!funcname) goto bad;
  16193. }
  16194. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  16195. Py_XDECREF(py_funcname);
  16196. return py_code;
  16197. bad:
  16198. Py_XDECREF(py_funcname);
  16199. return NULL;
  16200. }
  16201. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16202. int py_line, const char *filename) {
  16203. PyCodeObject *py_code = 0;
  16204. PyFrameObject *py_frame = 0;
  16205. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  16206. PyObject *ptype, *pvalue, *ptraceback;
  16207. if (c_line) {
  16208. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  16209. }
  16210. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  16211. if (!py_code) {
  16212. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  16213. py_code = __Pyx_CreateCodeObjectForTraceback(
  16214. funcname, c_line, py_line, filename);
  16215. if (!py_code) {
  16216. /* If the code object creation fails, then we should clear the
  16217. fetched exception references and propagate the new exception */
  16218. Py_XDECREF(ptype);
  16219. Py_XDECREF(pvalue);
  16220. Py_XDECREF(ptraceback);
  16221. goto bad;
  16222. }
  16223. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  16224. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  16225. }
  16226. py_frame = PyFrame_New(
  16227. tstate, /*PyThreadState *tstate,*/
  16228. py_code, /*PyCodeObject *code,*/
  16229. __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/
  16230. 0 /*PyObject *locals*/
  16231. );
  16232. if (!py_frame) goto bad;
  16233. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  16234. PyTraceBack_Here(py_frame);
  16235. bad:
  16236. Py_XDECREF(py_code);
  16237. Py_XDECREF(py_frame);
  16238. }
  16239. #endif
  16240. /* CIntFromPyVerify */
  16241. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  16242. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  16243. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  16244. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  16245. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  16246. {\
  16247. func_type value = func_value;\
  16248. if (sizeof(target_type) < sizeof(func_type)) {\
  16249. if (unlikely(value != (func_type) (target_type) value)) {\
  16250. func_type zero = 0;\
  16251. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  16252. return (target_type) -1;\
  16253. if (is_unsigned && unlikely(value < zero))\
  16254. goto raise_neg_overflow;\
  16255. else\
  16256. goto raise_overflow;\
  16257. }\
  16258. }\
  16259. return (target_type) value;\
  16260. }
  16261. /* CIntFromPy */
  16262. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  16263. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16264. #pragma GCC diagnostic push
  16265. #pragma GCC diagnostic ignored "-Wconversion"
  16266. #endif
  16267. const int neg_one = (int) -1, const_zero = (int) 0;
  16268. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16269. #pragma GCC diagnostic pop
  16270. #endif
  16271. const int is_unsigned = neg_one > const_zero;
  16272. if (unlikely(!PyLong_Check(x))) {
  16273. int val;
  16274. PyObject *tmp = __Pyx_PyNumber_Long(x);
  16275. if (!tmp) return (int) -1;
  16276. val = __Pyx_PyLong_As_int(tmp);
  16277. Py_DECREF(tmp);
  16278. return val;
  16279. }
  16280. if (is_unsigned) {
  16281. #if CYTHON_USE_PYLONG_INTERNALS
  16282. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16283. goto raise_neg_overflow;
  16284. } else if (__Pyx_PyLong_IsCompact(x)) {
  16285. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16286. } else {
  16287. const digit* digits = __Pyx_PyLong_Digits(x);
  16288. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16289. switch (__Pyx_PyLong_DigitCount(x)) {
  16290. case 2:
  16291. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16292. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16293. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16294. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  16295. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16296. }
  16297. }
  16298. break;
  16299. case 3:
  16300. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16301. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16302. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16303. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  16304. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16305. }
  16306. }
  16307. break;
  16308. case 4:
  16309. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16310. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16311. __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])))
  16312. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  16313. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16314. }
  16315. }
  16316. break;
  16317. }
  16318. }
  16319. #endif
  16320. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16321. if (unlikely(Py_SIZE(x) < 0)) {
  16322. goto raise_neg_overflow;
  16323. }
  16324. #else
  16325. {
  16326. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16327. if (unlikely(result < 0))
  16328. return (int) -1;
  16329. if (unlikely(result == 1))
  16330. goto raise_neg_overflow;
  16331. }
  16332. #endif
  16333. if ((sizeof(int) <= sizeof(unsigned long))) {
  16334. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  16335. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  16336. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16337. }
  16338. } else {
  16339. #if CYTHON_USE_PYLONG_INTERNALS
  16340. if (__Pyx_PyLong_IsCompact(x)) {
  16341. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16342. } else {
  16343. const digit* digits = __Pyx_PyLong_Digits(x);
  16344. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16345. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16346. case -2:
  16347. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  16348. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16349. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16350. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16351. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16352. }
  16353. }
  16354. break;
  16355. case 2:
  16356. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16357. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16358. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16359. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16360. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16361. }
  16362. }
  16363. break;
  16364. case -3:
  16365. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16366. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16367. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16368. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16369. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16370. }
  16371. }
  16372. break;
  16373. case 3:
  16374. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16375. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16376. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16377. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16378. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16379. }
  16380. }
  16381. break;
  16382. case -4:
  16383. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16384. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16385. __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])))
  16386. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16387. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16388. }
  16389. }
  16390. break;
  16391. case 4:
  16392. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16393. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16394. __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])))
  16395. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16396. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16397. }
  16398. }
  16399. break;
  16400. }
  16401. }
  16402. #endif
  16403. if ((sizeof(int) <= sizeof(long))) {
  16404. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  16405. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  16406. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  16407. }
  16408. }
  16409. {
  16410. int val;
  16411. int ret = -1;
  16412. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  16413. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  16414. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  16415. if (unlikely(bytes_copied == -1)) {
  16416. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  16417. goto raise_overflow;
  16418. } else {
  16419. ret = 0;
  16420. }
  16421. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16422. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16423. unsigned char *bytes = (unsigned char *)&val;
  16424. ret = _PyLong_AsByteArray((PyLongObject *)x,
  16425. bytes, sizeof(val),
  16426. is_little, !is_unsigned);
  16427. #else
  16428. PyObject *v;
  16429. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16430. int bits, remaining_bits, is_negative = 0;
  16431. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16432. if (likely(PyLong_CheckExact(x))) {
  16433. v = __Pyx_NewRef(x);
  16434. } else {
  16435. v = PyNumber_Long(x);
  16436. if (unlikely(!v)) return (int) -1;
  16437. assert(PyLong_CheckExact(v));
  16438. }
  16439. {
  16440. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  16441. if (unlikely(result < 0)) {
  16442. Py_DECREF(v);
  16443. return (int) -1;
  16444. }
  16445. is_negative = result == 1;
  16446. }
  16447. if (is_unsigned && unlikely(is_negative)) {
  16448. Py_DECREF(v);
  16449. goto raise_neg_overflow;
  16450. } else if (is_negative) {
  16451. stepval = PyNumber_Invert(v);
  16452. Py_DECREF(v);
  16453. if (unlikely(!stepval))
  16454. return (int) -1;
  16455. } else {
  16456. stepval = v;
  16457. }
  16458. v = NULL;
  16459. val = (int) 0;
  16460. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16461. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16462. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  16463. PyObject *tmp, *digit;
  16464. long idigit;
  16465. digit = PyNumber_And(stepval, mask);
  16466. if (unlikely(!digit)) goto done;
  16467. idigit = PyLong_AsLong(digit);
  16468. Py_DECREF(digit);
  16469. if (unlikely(idigit < 0)) goto done;
  16470. val |= ((int) idigit) << bits;
  16471. tmp = PyNumber_Rshift(stepval, shift);
  16472. if (unlikely(!tmp)) goto done;
  16473. Py_DECREF(stepval); stepval = tmp;
  16474. }
  16475. Py_DECREF(shift); shift = NULL;
  16476. Py_DECREF(mask); mask = NULL;
  16477. {
  16478. long idigit = PyLong_AsLong(stepval);
  16479. if (unlikely(idigit < 0)) goto done;
  16480. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  16481. if (unlikely(idigit >= (1L << remaining_bits)))
  16482. goto raise_overflow;
  16483. val |= ((int) idigit) << bits;
  16484. }
  16485. if (!is_unsigned) {
  16486. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  16487. goto raise_overflow;
  16488. if (is_negative)
  16489. val = ~val;
  16490. }
  16491. ret = 0;
  16492. done:
  16493. Py_XDECREF(shift);
  16494. Py_XDECREF(mask);
  16495. Py_XDECREF(stepval);
  16496. #endif
  16497. if (unlikely(ret))
  16498. return (int) -1;
  16499. return val;
  16500. }
  16501. raise_overflow:
  16502. PyErr_SetString(PyExc_OverflowError,
  16503. "value too large to convert to int");
  16504. return (int) -1;
  16505. raise_neg_overflow:
  16506. PyErr_SetString(PyExc_OverflowError,
  16507. "can't convert negative value to int");
  16508. return (int) -1;
  16509. }
  16510. /* PyObjectVectorCallKwBuilder (used by CIntToPy) */
  16511. #if CYTHON_VECTORCALL
  16512. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16513. (void)__Pyx_PyObject_FastCallDict;
  16514. if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
  16515. Py_INCREF(key);
  16516. args[n] = value;
  16517. return 0;
  16518. }
  16519. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16520. (void)__Pyx_VectorcallBuilder_AddArgStr;
  16521. if (unlikely(!PyUnicode_Check(key))) {
  16522. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  16523. return -1;
  16524. }
  16525. return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
  16526. }
  16527. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  16528. PyObject *pyKey = PyUnicode_FromString(key);
  16529. if (!pyKey) return -1;
  16530. return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
  16531. }
  16532. #else // CYTHON_VECTORCALL
  16533. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
  16534. if (unlikely(!PyUnicode_Check(key))) {
  16535. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  16536. return -1;
  16537. }
  16538. return PyDict_SetItem(builder, key, value);
  16539. }
  16540. #endif
  16541. /* CIntToPy */
  16542. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
  16543. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16544. #pragma GCC diagnostic push
  16545. #pragma GCC diagnostic ignored "-Wconversion"
  16546. #endif
  16547. const int neg_one = (int) -1, const_zero = (int) 0;
  16548. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16549. #pragma GCC diagnostic pop
  16550. #endif
  16551. const int is_unsigned = neg_one > const_zero;
  16552. if (is_unsigned) {
  16553. if (sizeof(int) < sizeof(long)) {
  16554. return PyLong_FromLong((long) value);
  16555. } else if (sizeof(int) <= sizeof(unsigned long)) {
  16556. return PyLong_FromUnsignedLong((unsigned long) value);
  16557. #if !CYTHON_COMPILING_IN_PYPY
  16558. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  16559. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16560. #endif
  16561. }
  16562. } else {
  16563. if (sizeof(int) <= sizeof(long)) {
  16564. return PyLong_FromLong((long) value);
  16565. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  16566. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16567. }
  16568. }
  16569. {
  16570. unsigned char *bytes = (unsigned char *)&value;
  16571. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  16572. if (is_unsigned) {
  16573. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  16574. } else {
  16575. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  16576. }
  16577. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16578. int one = 1; int little = (int)*(unsigned char *)&one;
  16579. return _PyLong_FromByteArray(bytes, sizeof(int),
  16580. little, !is_unsigned);
  16581. #else
  16582. int one = 1; int little = (int)*(unsigned char *)&one;
  16583. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  16584. PyObject *py_bytes = NULL, *order_str = NULL;
  16585. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16586. if (!from_bytes) return NULL;
  16587. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
  16588. if (!py_bytes) goto limited_bad;
  16589. order_str = PyUnicode_FromString(little ? "little" : "big");
  16590. if (!order_str) goto limited_bad;
  16591. {
  16592. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  16593. if (!is_unsigned) {
  16594. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  16595. if (!kwds) goto limited_bad;
  16596. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  16597. }
  16598. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  16599. }
  16600. limited_bad:
  16601. Py_XDECREF(kwds);
  16602. Py_XDECREF(order_str);
  16603. Py_XDECREF(py_bytes);
  16604. Py_XDECREF(from_bytes);
  16605. return result;
  16606. #endif
  16607. }
  16608. }
  16609. /* CIntToPy */
  16610. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  16611. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16612. #pragma GCC diagnostic push
  16613. #pragma GCC diagnostic ignored "-Wconversion"
  16614. #endif
  16615. const long neg_one = (long) -1, const_zero = (long) 0;
  16616. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16617. #pragma GCC diagnostic pop
  16618. #endif
  16619. const int is_unsigned = neg_one > const_zero;
  16620. if (is_unsigned) {
  16621. if (sizeof(long) < sizeof(long)) {
  16622. return PyLong_FromLong((long) value);
  16623. } else if (sizeof(long) <= sizeof(unsigned long)) {
  16624. return PyLong_FromUnsignedLong((unsigned long) value);
  16625. #if !CYTHON_COMPILING_IN_PYPY
  16626. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  16627. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16628. #endif
  16629. }
  16630. } else {
  16631. if (sizeof(long) <= sizeof(long)) {
  16632. return PyLong_FromLong((long) value);
  16633. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  16634. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16635. }
  16636. }
  16637. {
  16638. unsigned char *bytes = (unsigned char *)&value;
  16639. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  16640. if (is_unsigned) {
  16641. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  16642. } else {
  16643. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  16644. }
  16645. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16646. int one = 1; int little = (int)*(unsigned char *)&one;
  16647. return _PyLong_FromByteArray(bytes, sizeof(long),
  16648. little, !is_unsigned);
  16649. #else
  16650. int one = 1; int little = (int)*(unsigned char *)&one;
  16651. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  16652. PyObject *py_bytes = NULL, *order_str = NULL;
  16653. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16654. if (!from_bytes) return NULL;
  16655. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  16656. if (!py_bytes) goto limited_bad;
  16657. order_str = PyUnicode_FromString(little ? "little" : "big");
  16658. if (!order_str) goto limited_bad;
  16659. {
  16660. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  16661. if (!is_unsigned) {
  16662. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  16663. if (!kwds) goto limited_bad;
  16664. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  16665. }
  16666. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  16667. }
  16668. limited_bad:
  16669. Py_XDECREF(kwds);
  16670. Py_XDECREF(order_str);
  16671. Py_XDECREF(py_bytes);
  16672. Py_XDECREF(from_bytes);
  16673. return result;
  16674. #endif
  16675. }
  16676. }
  16677. /* CIntFromPy */
  16678. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
  16679. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16680. #pragma GCC diagnostic push
  16681. #pragma GCC diagnostic ignored "-Wconversion"
  16682. #endif
  16683. const long neg_one = (long) -1, const_zero = (long) 0;
  16684. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16685. #pragma GCC diagnostic pop
  16686. #endif
  16687. const int is_unsigned = neg_one > const_zero;
  16688. if (unlikely(!PyLong_Check(x))) {
  16689. long val;
  16690. PyObject *tmp = __Pyx_PyNumber_Long(x);
  16691. if (!tmp) return (long) -1;
  16692. val = __Pyx_PyLong_As_long(tmp);
  16693. Py_DECREF(tmp);
  16694. return val;
  16695. }
  16696. if (is_unsigned) {
  16697. #if CYTHON_USE_PYLONG_INTERNALS
  16698. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16699. goto raise_neg_overflow;
  16700. } else if (__Pyx_PyLong_IsCompact(x)) {
  16701. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16702. } else {
  16703. const digit* digits = __Pyx_PyLong_Digits(x);
  16704. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16705. switch (__Pyx_PyLong_DigitCount(x)) {
  16706. case 2:
  16707. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16708. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16709. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16710. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  16711. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16712. }
  16713. }
  16714. break;
  16715. case 3:
  16716. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16717. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16718. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16719. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  16720. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16721. }
  16722. }
  16723. break;
  16724. case 4:
  16725. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16726. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16727. __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])))
  16728. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  16729. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16730. }
  16731. }
  16732. break;
  16733. }
  16734. }
  16735. #endif
  16736. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16737. if (unlikely(Py_SIZE(x) < 0)) {
  16738. goto raise_neg_overflow;
  16739. }
  16740. #else
  16741. {
  16742. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16743. if (unlikely(result < 0))
  16744. return (long) -1;
  16745. if (unlikely(result == 1))
  16746. goto raise_neg_overflow;
  16747. }
  16748. #endif
  16749. if ((sizeof(long) <= sizeof(unsigned long))) {
  16750. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  16751. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  16752. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16753. }
  16754. } else {
  16755. #if CYTHON_USE_PYLONG_INTERNALS
  16756. if (__Pyx_PyLong_IsCompact(x)) {
  16757. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16758. } else {
  16759. const digit* digits = __Pyx_PyLong_Digits(x);
  16760. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16761. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16762. case -2:
  16763. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  16764. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16765. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16766. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16767. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16768. }
  16769. }
  16770. break;
  16771. case 2:
  16772. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16773. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16774. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16775. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16776. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16777. }
  16778. }
  16779. break;
  16780. case -3:
  16781. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16782. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16783. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16784. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16785. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16786. }
  16787. }
  16788. break;
  16789. case 3:
  16790. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16791. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16792. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16793. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16794. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16795. }
  16796. }
  16797. break;
  16798. case -4:
  16799. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16800. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16801. __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])))
  16802. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16803. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16804. }
  16805. }
  16806. break;
  16807. case 4:
  16808. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16809. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16810. __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])))
  16811. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16812. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16813. }
  16814. }
  16815. break;
  16816. }
  16817. }
  16818. #endif
  16819. if ((sizeof(long) <= sizeof(long))) {
  16820. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  16821. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  16822. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  16823. }
  16824. }
  16825. {
  16826. long val;
  16827. int ret = -1;
  16828. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  16829. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  16830. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  16831. if (unlikely(bytes_copied == -1)) {
  16832. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  16833. goto raise_overflow;
  16834. } else {
  16835. ret = 0;
  16836. }
  16837. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16838. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16839. unsigned char *bytes = (unsigned char *)&val;
  16840. ret = _PyLong_AsByteArray((PyLongObject *)x,
  16841. bytes, sizeof(val),
  16842. is_little, !is_unsigned);
  16843. #else
  16844. PyObject *v;
  16845. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16846. int bits, remaining_bits, is_negative = 0;
  16847. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16848. if (likely(PyLong_CheckExact(x))) {
  16849. v = __Pyx_NewRef(x);
  16850. } else {
  16851. v = PyNumber_Long(x);
  16852. if (unlikely(!v)) return (long) -1;
  16853. assert(PyLong_CheckExact(v));
  16854. }
  16855. {
  16856. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  16857. if (unlikely(result < 0)) {
  16858. Py_DECREF(v);
  16859. return (long) -1;
  16860. }
  16861. is_negative = result == 1;
  16862. }
  16863. if (is_unsigned && unlikely(is_negative)) {
  16864. Py_DECREF(v);
  16865. goto raise_neg_overflow;
  16866. } else if (is_negative) {
  16867. stepval = PyNumber_Invert(v);
  16868. Py_DECREF(v);
  16869. if (unlikely(!stepval))
  16870. return (long) -1;
  16871. } else {
  16872. stepval = v;
  16873. }
  16874. v = NULL;
  16875. val = (long) 0;
  16876. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16877. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16878. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  16879. PyObject *tmp, *digit;
  16880. long idigit;
  16881. digit = PyNumber_And(stepval, mask);
  16882. if (unlikely(!digit)) goto done;
  16883. idigit = PyLong_AsLong(digit);
  16884. Py_DECREF(digit);
  16885. if (unlikely(idigit < 0)) goto done;
  16886. val |= ((long) idigit) << bits;
  16887. tmp = PyNumber_Rshift(stepval, shift);
  16888. if (unlikely(!tmp)) goto done;
  16889. Py_DECREF(stepval); stepval = tmp;
  16890. }
  16891. Py_DECREF(shift); shift = NULL;
  16892. Py_DECREF(mask); mask = NULL;
  16893. {
  16894. long idigit = PyLong_AsLong(stepval);
  16895. if (unlikely(idigit < 0)) goto done;
  16896. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  16897. if (unlikely(idigit >= (1L << remaining_bits)))
  16898. goto raise_overflow;
  16899. val |= ((long) idigit) << bits;
  16900. }
  16901. if (!is_unsigned) {
  16902. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  16903. goto raise_overflow;
  16904. if (is_negative)
  16905. val = ~val;
  16906. }
  16907. ret = 0;
  16908. done:
  16909. Py_XDECREF(shift);
  16910. Py_XDECREF(mask);
  16911. Py_XDECREF(stepval);
  16912. #endif
  16913. if (unlikely(ret))
  16914. return (long) -1;
  16915. return val;
  16916. }
  16917. raise_overflow:
  16918. PyErr_SetString(PyExc_OverflowError,
  16919. "value too large to convert to long");
  16920. return (long) -1;
  16921. raise_neg_overflow:
  16922. PyErr_SetString(PyExc_OverflowError,
  16923. "can't convert negative value to long");
  16924. return (long) -1;
  16925. }
  16926. /* FormatTypeName */
  16927. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  16928. static __Pyx_TypeName
  16929. __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  16930. {
  16931. PyObject *module = NULL, *name = NULL, *result = NULL;
  16932. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  16933. name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  16934. __pyx_mstate_global->__pyx_n_u_qualname);
  16935. #else
  16936. name = PyType_GetQualName(tp);
  16937. #endif
  16938. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
  16939. module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  16940. __pyx_mstate_global->__pyx_n_u_module);
  16941. if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
  16942. if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
  16943. result = name;
  16944. name = NULL;
  16945. goto done;
  16946. }
  16947. result = PyUnicode_FromFormat("%U.%U", module, name);
  16948. if (unlikely(result == NULL)) goto bad;
  16949. done:
  16950. Py_XDECREF(name);
  16951. Py_XDECREF(module);
  16952. return result;
  16953. bad:
  16954. PyErr_Clear();
  16955. if (name) {
  16956. result = name;
  16957. name = NULL;
  16958. } else {
  16959. result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2);
  16960. }
  16961. goto done;
  16962. }
  16963. #endif
  16964. /* FastTypeChecks */
  16965. #if CYTHON_COMPILING_IN_CPYTHON
  16966. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  16967. while (a) {
  16968. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  16969. if (a == b)
  16970. return 1;
  16971. }
  16972. return b == &PyBaseObject_Type;
  16973. }
  16974. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  16975. PyObject *mro;
  16976. if (a == b) return 1;
  16977. mro = a->tp_mro;
  16978. if (likely(mro)) {
  16979. Py_ssize_t i, n;
  16980. n = PyTuple_GET_SIZE(mro);
  16981. for (i = 0; i < n; i++) {
  16982. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  16983. return 1;
  16984. }
  16985. return 0;
  16986. }
  16987. return __Pyx_InBases(a, b);
  16988. }
  16989. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  16990. PyObject *mro;
  16991. if (cls == a || cls == b) return 1;
  16992. mro = cls->tp_mro;
  16993. if (likely(mro)) {
  16994. Py_ssize_t i, n;
  16995. n = PyTuple_GET_SIZE(mro);
  16996. for (i = 0; i < n; i++) {
  16997. PyObject *base = PyTuple_GET_ITEM(mro, i);
  16998. if (base == (PyObject *)a || base == (PyObject *)b)
  16999. return 1;
  17000. }
  17001. return 0;
  17002. }
  17003. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  17004. }
  17005. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  17006. if (exc_type1) {
  17007. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  17008. } else {
  17009. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  17010. }
  17011. }
  17012. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  17013. Py_ssize_t i, n;
  17014. assert(PyExceptionClass_Check(exc_type));
  17015. n = PyTuple_GET_SIZE(tuple);
  17016. for (i=0; i<n; i++) {
  17017. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  17018. }
  17019. for (i=0; i<n; i++) {
  17020. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  17021. if (likely(PyExceptionClass_Check(t))) {
  17022. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  17023. } else {
  17024. }
  17025. }
  17026. return 0;
  17027. }
  17028. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  17029. if (likely(err == exc_type)) return 1;
  17030. if (likely(PyExceptionClass_Check(err))) {
  17031. if (likely(PyExceptionClass_Check(exc_type))) {
  17032. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  17033. } else if (likely(PyTuple_Check(exc_type))) {
  17034. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  17035. } else {
  17036. }
  17037. }
  17038. return PyErr_GivenExceptionMatches(err, exc_type);
  17039. }
  17040. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  17041. assert(PyExceptionClass_Check(exc_type1));
  17042. assert(PyExceptionClass_Check(exc_type2));
  17043. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  17044. if (likely(PyExceptionClass_Check(err))) {
  17045. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  17046. }
  17047. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  17048. }
  17049. #endif
  17050. /* GetRuntimeVersion */
  17051. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  17052. void __Pyx_init_runtime_version(void) {
  17053. if (__Pyx_cached_runtime_version == 0) {
  17054. const char* rt_version = Py_GetVersion();
  17055. unsigned long version = 0;
  17056. unsigned long factor = 0x01000000UL;
  17057. unsigned int digit = 0;
  17058. int i = 0;
  17059. while (factor) {
  17060. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  17061. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  17062. ++i;
  17063. }
  17064. version += factor * digit;
  17065. if (rt_version[i] != '.')
  17066. break;
  17067. digit = 0;
  17068. factor >>= 8;
  17069. ++i;
  17070. }
  17071. __Pyx_cached_runtime_version = version;
  17072. }
  17073. }
  17074. #endif
  17075. static unsigned long __Pyx_get_runtime_version(void) {
  17076. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  17077. return Py_Version & ~0xFFUL;
  17078. #else
  17079. return __Pyx_cached_runtime_version;
  17080. #endif
  17081. }
  17082. /* GetTopmostException (used by SaveResetException) */
  17083. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  17084. static _PyErr_StackItem *
  17085. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  17086. {
  17087. _PyErr_StackItem *exc_info = tstate->exc_info;
  17088. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  17089. exc_info->previous_item != NULL)
  17090. {
  17091. exc_info = exc_info->previous_item;
  17092. }
  17093. return exc_info;
  17094. }
  17095. #endif
  17096. /* SaveResetException (used by CoroutineBase) */
  17097. #if CYTHON_FAST_THREAD_STATE
  17098. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17099. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17100. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  17101. PyObject *exc_value = exc_info->exc_value;
  17102. if (exc_value == NULL || exc_value == Py_None) {
  17103. *value = NULL;
  17104. *type = NULL;
  17105. *tb = NULL;
  17106. } else {
  17107. *value = exc_value;
  17108. Py_INCREF(*value);
  17109. *type = (PyObject*) Py_TYPE(exc_value);
  17110. Py_INCREF(*type);
  17111. *tb = PyException_GetTraceback(exc_value);
  17112. }
  17113. #elif CYTHON_USE_EXC_INFO_STACK
  17114. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  17115. *type = exc_info->exc_type;
  17116. *value = exc_info->exc_value;
  17117. *tb = exc_info->exc_traceback;
  17118. Py_XINCREF(*type);
  17119. Py_XINCREF(*value);
  17120. Py_XINCREF(*tb);
  17121. #else
  17122. *type = tstate->exc_type;
  17123. *value = tstate->exc_value;
  17124. *tb = tstate->exc_traceback;
  17125. Py_XINCREF(*type);
  17126. Py_XINCREF(*value);
  17127. Py_XINCREF(*tb);
  17128. #endif
  17129. }
  17130. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  17131. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17132. _PyErr_StackItem *exc_info = tstate->exc_info;
  17133. PyObject *tmp_value = exc_info->exc_value;
  17134. exc_info->exc_value = value;
  17135. Py_XDECREF(tmp_value);
  17136. Py_XDECREF(type);
  17137. Py_XDECREF(tb);
  17138. #else
  17139. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17140. #if CYTHON_USE_EXC_INFO_STACK
  17141. _PyErr_StackItem *exc_info = tstate->exc_info;
  17142. tmp_type = exc_info->exc_type;
  17143. tmp_value = exc_info->exc_value;
  17144. tmp_tb = exc_info->exc_traceback;
  17145. exc_info->exc_type = type;
  17146. exc_info->exc_value = value;
  17147. exc_info->exc_traceback = tb;
  17148. #else
  17149. tmp_type = tstate->exc_type;
  17150. tmp_value = tstate->exc_value;
  17151. tmp_tb = tstate->exc_traceback;
  17152. tstate->exc_type = type;
  17153. tstate->exc_value = value;
  17154. tstate->exc_traceback = tb;
  17155. #endif
  17156. Py_XDECREF(tmp_type);
  17157. Py_XDECREF(tmp_value);
  17158. Py_XDECREF(tmp_tb);
  17159. #endif
  17160. }
  17161. #endif
  17162. /* SwapException (used by CoroutineBase) */
  17163. #if CYTHON_FAST_THREAD_STATE
  17164. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17165. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17166. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17167. _PyErr_StackItem *exc_info = tstate->exc_info;
  17168. tmp_value = exc_info->exc_value;
  17169. exc_info->exc_value = *value;
  17170. if (tmp_value == NULL || tmp_value == Py_None) {
  17171. Py_XDECREF(tmp_value);
  17172. tmp_value = NULL;
  17173. tmp_type = NULL;
  17174. tmp_tb = NULL;
  17175. } else {
  17176. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  17177. Py_INCREF(tmp_type);
  17178. #if CYTHON_COMPILING_IN_CPYTHON
  17179. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  17180. Py_XINCREF(tmp_tb);
  17181. #else
  17182. tmp_tb = PyException_GetTraceback(tmp_value);
  17183. #endif
  17184. }
  17185. #elif CYTHON_USE_EXC_INFO_STACK
  17186. _PyErr_StackItem *exc_info = tstate->exc_info;
  17187. tmp_type = exc_info->exc_type;
  17188. tmp_value = exc_info->exc_value;
  17189. tmp_tb = exc_info->exc_traceback;
  17190. exc_info->exc_type = *type;
  17191. exc_info->exc_value = *value;
  17192. exc_info->exc_traceback = *tb;
  17193. #else
  17194. tmp_type = tstate->exc_type;
  17195. tmp_value = tstate->exc_value;
  17196. tmp_tb = tstate->exc_traceback;
  17197. tstate->exc_type = *type;
  17198. tstate->exc_value = *value;
  17199. tstate->exc_traceback = *tb;
  17200. #endif
  17201. *type = tmp_type;
  17202. *value = tmp_value;
  17203. *tb = tmp_tb;
  17204. }
  17205. #else
  17206. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  17207. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17208. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  17209. PyErr_SetExcInfo(*type, *value, *tb);
  17210. *type = tmp_type;
  17211. *value = tmp_value;
  17212. *tb = tmp_tb;
  17213. }
  17214. #endif
  17215. /* PyObjectCall2Args (used by PyObjectCallMethod1) */
  17216. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  17217. PyObject *args[3] = {NULL, arg1, arg2};
  17218. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17219. }
  17220. /* PyObjectCallMethod1 (used by CoroutineBase) */
  17221. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  17222. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  17223. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  17224. Py_DECREF(method);
  17225. return result;
  17226. }
  17227. #endif
  17228. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  17229. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  17230. PyObject *args[2] = {obj, arg};
  17231. (void) __Pyx_PyObject_CallOneArg;
  17232. (void) __Pyx_PyObject_Call2Args;
  17233. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  17234. #else
  17235. PyObject *method = NULL, *result;
  17236. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  17237. if (likely(is_method)) {
  17238. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  17239. Py_DECREF(method);
  17240. return result;
  17241. }
  17242. if (unlikely(!method)) return NULL;
  17243. return __Pyx__PyObject_CallMethod1(method, arg);
  17244. #endif
  17245. }
  17246. /* ReturnWithStopIteration (used by CoroutineBase) */
  17247. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
  17248. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
  17249. if (value == Py_None) {
  17250. if (async || !iternext)
  17251. PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
  17252. return;
  17253. }
  17254. __Pyx__ReturnWithStopIteration(value, async);
  17255. }
  17256. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
  17257. #if CYTHON_COMPILING_IN_CPYTHON
  17258. __Pyx_PyThreadState_declare
  17259. #endif
  17260. PyObject *exc;
  17261. PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
  17262. #if CYTHON_COMPILING_IN_CPYTHON
  17263. if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
  17264. if (PY_VERSION_HEX >= (0x030e00A1)) {
  17265. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  17266. } else {
  17267. PyObject *args_tuple = PyTuple_New(1);
  17268. if (unlikely(!args_tuple)) return;
  17269. Py_INCREF(value);
  17270. PyTuple_SET_ITEM(args_tuple, 0, value);
  17271. exc = PyObject_Call(exc_type, args_tuple, NULL);
  17272. Py_DECREF(args_tuple);
  17273. }
  17274. if (unlikely(!exc)) return;
  17275. } else {
  17276. Py_INCREF(value);
  17277. exc = value;
  17278. }
  17279. #if CYTHON_FAST_THREAD_STATE
  17280. __Pyx_PyThreadState_assign
  17281. #if CYTHON_USE_EXC_INFO_STACK
  17282. if (!__pyx_tstate->exc_info->exc_value)
  17283. #else
  17284. if (!__pyx_tstate->exc_type)
  17285. #endif
  17286. {
  17287. Py_INCREF(exc_type);
  17288. __Pyx_ErrRestore(exc_type, exc, NULL);
  17289. return;
  17290. }
  17291. #endif
  17292. #else
  17293. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  17294. if (unlikely(!exc)) return;
  17295. #endif
  17296. PyErr_SetObject(exc_type, exc);
  17297. Py_DECREF(exc);
  17298. }
  17299. /* CoroutineBase (used by Generator) */
  17300. #if !CYTHON_COMPILING_IN_LIMITED_API
  17301. #include <frameobject.h>
  17302. #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  17303. #ifndef Py_BUILD_CORE
  17304. #define Py_BUILD_CORE 1
  17305. #endif
  17306. #include "internal/pycore_frame.h"
  17307. #endif
  17308. #endif // CYTHON_COMPILING_IN_LIMITED_API
  17309. static CYTHON_INLINE void
  17310. __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
  17311. #if CYTHON_USE_AM_SEND
  17312. gen->yieldfrom_am_send = NULL;
  17313. #endif
  17314. Py_CLEAR(gen->yieldfrom);
  17315. }
  17316. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  17317. PyObject *et, *ev, *tb;
  17318. PyObject *value = NULL;
  17319. CYTHON_UNUSED_VAR(__pyx_tstate);
  17320. __Pyx_ErrFetch(&et, &ev, &tb);
  17321. if (!et) {
  17322. Py_XDECREF(tb);
  17323. Py_XDECREF(ev);
  17324. Py_INCREF(Py_None);
  17325. *pvalue = Py_None;
  17326. return 0;
  17327. }
  17328. if (likely(et == PyExc_StopIteration)) {
  17329. if (!ev) {
  17330. Py_INCREF(Py_None);
  17331. value = Py_None;
  17332. }
  17333. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17334. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  17335. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  17336. if (unlikely(!value)) goto limited_api_failure;
  17337. #else
  17338. value = ((PyStopIterationObject *)ev)->value;
  17339. Py_INCREF(value);
  17340. #endif
  17341. Py_DECREF(ev);
  17342. }
  17343. else if (unlikely(PyTuple_Check(ev))) {
  17344. Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
  17345. #if !CYTHON_ASSUME_SAFE_SIZE
  17346. if (unlikely(tuple_size < 0)) {
  17347. Py_XDECREF(tb);
  17348. Py_DECREF(ev);
  17349. Py_DECREF(et);
  17350. return -1;
  17351. }
  17352. #endif
  17353. if (tuple_size >= 1) {
  17354. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17355. value = PyTuple_GET_ITEM(ev, 0);
  17356. Py_INCREF(value);
  17357. #elif CYTHON_ASSUME_SAFE_MACROS
  17358. value = PySequence_ITEM(ev, 0);
  17359. #else
  17360. value = PySequence_GetItem(ev, 0);
  17361. if (!value) goto limited_api_failure;
  17362. #endif
  17363. } else {
  17364. Py_INCREF(Py_None);
  17365. value = Py_None;
  17366. }
  17367. Py_DECREF(ev);
  17368. }
  17369. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  17370. value = ev;
  17371. }
  17372. if (likely(value)) {
  17373. Py_XDECREF(tb);
  17374. Py_DECREF(et);
  17375. *pvalue = value;
  17376. return 0;
  17377. }
  17378. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  17379. __Pyx_ErrRestore(et, ev, tb);
  17380. return -1;
  17381. }
  17382. PyErr_NormalizeException(&et, &ev, &tb);
  17383. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17384. __Pyx_ErrRestore(et, ev, tb);
  17385. return -1;
  17386. }
  17387. Py_XDECREF(tb);
  17388. Py_DECREF(et);
  17389. #if CYTHON_COMPILING_IN_LIMITED_API
  17390. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  17391. #else
  17392. value = ((PyStopIterationObject *)ev)->value;
  17393. Py_INCREF(value);
  17394. #endif
  17395. Py_DECREF(ev);
  17396. #if CYTHON_COMPILING_IN_LIMITED_API
  17397. if (unlikely(!value)) return -1;
  17398. #endif
  17399. *pvalue = value;
  17400. return 0;
  17401. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  17402. limited_api_failure:
  17403. Py_XDECREF(et);
  17404. Py_XDECREF(tb);
  17405. Py_XDECREF(ev);
  17406. return -1;
  17407. #endif
  17408. }
  17409. static CYTHON_INLINE
  17410. __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
  17411. if (*retval) {
  17412. return PYGEN_NEXT;
  17413. } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
  17414. return PYGEN_RETURN;
  17415. } else {
  17416. return PYGEN_ERROR;
  17417. }
  17418. }
  17419. static CYTHON_INLINE
  17420. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  17421. #if PY_VERSION_HEX >= 0x030B00a4
  17422. Py_CLEAR(exc_state->exc_value);
  17423. #else
  17424. PyObject *t, *v, *tb;
  17425. t = exc_state->exc_type;
  17426. v = exc_state->exc_value;
  17427. tb = exc_state->exc_traceback;
  17428. exc_state->exc_type = NULL;
  17429. exc_state->exc_value = NULL;
  17430. exc_state->exc_traceback = NULL;
  17431. Py_XDECREF(t);
  17432. Py_XDECREF(v);
  17433. Py_XDECREF(tb);
  17434. #endif
  17435. }
  17436. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  17437. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  17438. const char *msg;
  17439. CYTHON_MAYBE_UNUSED_VAR(gen);
  17440. if ((0)) {
  17441. #ifdef __Pyx_Coroutine_USED
  17442. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  17443. msg = "coroutine already executing";
  17444. #endif
  17445. #ifdef __Pyx_AsyncGen_USED
  17446. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  17447. msg = "async generator already executing";
  17448. #endif
  17449. } else {
  17450. msg = "generator already executing";
  17451. }
  17452. PyErr_SetString(PyExc_ValueError, msg);
  17453. }
  17454. static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  17455. CYTHON_MAYBE_UNUSED_VAR(gen);
  17456. CYTHON_MAYBE_UNUSED_VAR(closing);
  17457. #ifdef __Pyx_Coroutine_USED
  17458. if (!closing && __Pyx_Coroutine_Check(gen)) {
  17459. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  17460. } else
  17461. #endif
  17462. if (value) {
  17463. #ifdef __Pyx_AsyncGen_USED
  17464. if (__Pyx_AsyncGen_CheckExact(gen))
  17465. PyErr_SetNone(PyExc_StopAsyncIteration);
  17466. else
  17467. #endif
  17468. PyErr_SetNone(PyExc_StopIteration);
  17469. }
  17470. }
  17471. static
  17472. __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
  17473. __Pyx_PyThreadState_declare
  17474. PyThreadState *tstate;
  17475. __Pyx_ExcInfoStruct *exc_state;
  17476. PyObject *retval;
  17477. assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running
  17478. if (unlikely(self->resume_label == -1)) {
  17479. __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  17480. return PYGEN_ERROR;
  17481. }
  17482. #if CYTHON_FAST_THREAD_STATE
  17483. __Pyx_PyThreadState_assign
  17484. tstate = __pyx_tstate;
  17485. #else
  17486. tstate = __Pyx_PyThreadState_Current;
  17487. #endif
  17488. exc_state = &self->gi_exc_state;
  17489. if (exc_state->exc_value) {
  17490. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  17491. #else
  17492. PyObject *exc_tb;
  17493. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17494. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17495. #elif PY_VERSION_HEX >= 0x030B00a4
  17496. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  17497. #else
  17498. exc_tb = exc_state->exc_traceback;
  17499. #endif
  17500. if (exc_tb) {
  17501. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17502. PyFrameObject *f = tb->tb_frame;
  17503. assert(f->f_back == NULL);
  17504. #if PY_VERSION_HEX >= 0x030B00A1
  17505. f->f_back = PyThreadState_GetFrame(tstate);
  17506. #else
  17507. Py_XINCREF(tstate->frame);
  17508. f->f_back = tstate->frame;
  17509. #endif
  17510. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17511. Py_DECREF(exc_tb);
  17512. #endif
  17513. }
  17514. #endif
  17515. }
  17516. #if CYTHON_USE_EXC_INFO_STACK
  17517. exc_state->previous_item = tstate->exc_info;
  17518. tstate->exc_info = exc_state;
  17519. #else
  17520. if (exc_state->exc_type) {
  17521. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17522. } else {
  17523. __Pyx_Coroutine_ExceptionClear(exc_state);
  17524. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17525. }
  17526. #endif
  17527. retval = self->body(self, tstate, value);
  17528. #if CYTHON_USE_EXC_INFO_STACK
  17529. exc_state = &self->gi_exc_state;
  17530. tstate->exc_info = exc_state->previous_item;
  17531. exc_state->previous_item = NULL;
  17532. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  17533. #endif
  17534. *result = retval;
  17535. if (self->resume_label == -1) {
  17536. return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
  17537. }
  17538. return PYGEN_NEXT;
  17539. }
  17540. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  17541. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  17542. CYTHON_UNUSED_VAR(exc_state);
  17543. #else
  17544. PyObject *exc_tb;
  17545. #if PY_VERSION_HEX >= 0x030B00a4
  17546. if (!exc_state->exc_value) return;
  17547. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17548. #else
  17549. exc_tb = exc_state->exc_traceback;
  17550. #endif
  17551. if (likely(exc_tb)) {
  17552. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17553. PyFrameObject *f = tb->tb_frame;
  17554. Py_CLEAR(f->f_back);
  17555. #if PY_VERSION_HEX >= 0x030B00a4
  17556. Py_DECREF(exc_tb);
  17557. #endif
  17558. }
  17559. #endif
  17560. }
  17561. #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
  17562. ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
  17563. static PyObject *
  17564. __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
  17565. CYTHON_MAYBE_UNUSED_VAR(gen);
  17566. if (likely(result == PYGEN_RETURN)) {
  17567. int is_async = 0;
  17568. #ifdef __Pyx_AsyncGen_USED
  17569. is_async = __Pyx_AsyncGen_CheckExact(gen);
  17570. #endif
  17571. __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
  17572. Py_XDECREF(retval);
  17573. }
  17574. return NULL;
  17575. }
  17576. #if CYTHON_COMPILING_IN_CPYTHON
  17577. static CYTHON_INLINE
  17578. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  17579. #if PY_VERSION_HEX <= 0x030A00A1
  17580. return _PyGen_Send(gen, arg);
  17581. #else
  17582. PyObject *result;
  17583. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  17584. if (PyAsyncGen_CheckExact(gen)) {
  17585. assert(result == Py_None);
  17586. PyErr_SetNone(PyExc_StopAsyncIteration);
  17587. }
  17588. else if (result == Py_None) {
  17589. PyErr_SetNone(PyExc_StopIteration);
  17590. }
  17591. else {
  17592. #if PY_VERSION_HEX < 0x030d00A1
  17593. _PyGen_SetStopIterationValue(result);
  17594. #else
  17595. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  17596. PyErr_SetObject(PyExc_StopIteration, result);
  17597. } else {
  17598. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  17599. if (likely(exc != NULL)) {
  17600. PyErr_SetObject(PyExc_StopIteration, exc);
  17601. Py_DECREF(exc);
  17602. }
  17603. }
  17604. #endif
  17605. }
  17606. Py_DECREF(result);
  17607. result = NULL;
  17608. }
  17609. return result;
  17610. #endif
  17611. }
  17612. #endif
  17613. static CYTHON_INLINE __Pyx_PySendResult
  17614. __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
  17615. __Pyx_PySendResult result;
  17616. PyObject *val = NULL;
  17617. assert(__Pyx_Coroutine_get_is_running(gen));
  17618. __Pyx_Coroutine_Undelegate(gen);
  17619. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  17620. result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
  17621. Py_XDECREF(val);
  17622. return result;
  17623. }
  17624. #if CYTHON_USE_AM_SEND
  17625. static __Pyx_PySendResult
  17626. __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
  17627. PyObject *ret = NULL;
  17628. __Pyx_PySendResult delegate_result, result;
  17629. assert(__Pyx_Coroutine_get_is_running(gen));
  17630. delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
  17631. if (delegate_result == PYGEN_NEXT) {
  17632. assert (ret != NULL);
  17633. *retval = ret;
  17634. return PYGEN_NEXT;
  17635. }
  17636. assert (delegate_result != PYGEN_ERROR || ret == NULL);
  17637. __Pyx_Coroutine_Undelegate(gen);
  17638. result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
  17639. Py_XDECREF(ret);
  17640. return result;
  17641. }
  17642. #endif
  17643. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  17644. PyObject *retval = NULL;
  17645. __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
  17646. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  17647. }
  17648. static __Pyx_PySendResult
  17649. __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
  17650. __Pyx_PySendResult result;
  17651. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17652. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17653. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  17654. return PYGEN_ERROR;
  17655. }
  17656. #if CYTHON_USE_AM_SEND
  17657. if (gen->yieldfrom_am_send) {
  17658. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
  17659. } else
  17660. #endif
  17661. if (gen->yieldfrom) {
  17662. PyObject *yf = gen->yieldfrom;
  17663. PyObject *ret;
  17664. #if !CYTHON_USE_AM_SEND
  17665. #ifdef __Pyx_Generator_USED
  17666. if (__Pyx_Generator_CheckExact(yf)) {
  17667. ret = __Pyx_Coroutine_Send(yf, value);
  17668. } else
  17669. #endif
  17670. #ifdef __Pyx_Coroutine_USED
  17671. if (__Pyx_Coroutine_Check(yf)) {
  17672. ret = __Pyx_Coroutine_Send(yf, value);
  17673. } else
  17674. #endif
  17675. #ifdef __Pyx_AsyncGen_USED
  17676. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17677. ret = __Pyx_async_gen_asend_send(yf, value);
  17678. } else
  17679. #endif
  17680. #if CYTHON_COMPILING_IN_CPYTHON
  17681. if (PyGen_CheckExact(yf)) {
  17682. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17683. } else
  17684. if (PyCoro_CheckExact(yf)) {
  17685. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17686. } else
  17687. #endif
  17688. #endif
  17689. {
  17690. #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
  17691. if (value == Py_None && PyIter_Check(yf))
  17692. ret = __Pyx_PyIter_Next_Plain(yf);
  17693. else
  17694. #endif
  17695. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
  17696. }
  17697. if (likely(ret)) {
  17698. __Pyx_Coroutine_unset_is_running(gen);
  17699. *retval = ret;
  17700. return PYGEN_NEXT;
  17701. }
  17702. result = __Pyx_Coroutine_FinishDelegation(gen, retval);
  17703. } else {
  17704. result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
  17705. }
  17706. __Pyx_Coroutine_unset_is_running(gen);
  17707. return result;
  17708. }
  17709. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  17710. __Pyx_PySendResult result;
  17711. PyObject *retval = NULL;
  17712. CYTHON_UNUSED_VAR(gen);
  17713. assert(__Pyx_Coroutine_get_is_running(gen));
  17714. #ifdef __Pyx_Generator_USED
  17715. if (__Pyx_Generator_CheckExact(yf)) {
  17716. result = __Pyx_Coroutine_Close(yf, &retval);
  17717. } else
  17718. #endif
  17719. #ifdef __Pyx_Coroutine_USED
  17720. if (__Pyx_Coroutine_Check(yf)) {
  17721. result = __Pyx_Coroutine_Close(yf, &retval);
  17722. } else
  17723. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17724. result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
  17725. } else
  17726. #endif
  17727. #ifdef __Pyx_AsyncGen_USED
  17728. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17729. retval = __Pyx_async_gen_asend_close(yf, NULL);
  17730. result = PYGEN_RETURN;
  17731. } else
  17732. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  17733. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  17734. result = PYGEN_RETURN;
  17735. } else
  17736. #endif
  17737. {
  17738. PyObject *meth;
  17739. result = PYGEN_RETURN;
  17740. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
  17741. if (unlikely(!meth)) {
  17742. if (unlikely(PyErr_Occurred())) {
  17743. PyErr_WriteUnraisable(yf);
  17744. }
  17745. } else {
  17746. retval = __Pyx_PyObject_CallNoArg(meth);
  17747. Py_DECREF(meth);
  17748. if (unlikely(!retval)) {
  17749. result = PYGEN_ERROR;
  17750. }
  17751. }
  17752. }
  17753. Py_XDECREF(retval);
  17754. return result == PYGEN_ERROR ? -1 : 0;
  17755. }
  17756. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  17757. __Pyx_PySendResult result;
  17758. PyObject *retval = NULL;
  17759. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17760. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17761. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17762. }
  17763. #if CYTHON_USE_AM_SEND
  17764. if (gen->yieldfrom_am_send) {
  17765. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
  17766. } else
  17767. #endif
  17768. if (gen->yieldfrom) {
  17769. PyObject *yf = gen->yieldfrom;
  17770. PyObject *ret;
  17771. #ifdef __Pyx_Generator_USED
  17772. if (__Pyx_Generator_CheckExact(yf)) {
  17773. ret = __Pyx_Generator_Next(yf);
  17774. } else
  17775. #endif
  17776. #ifdef __Pyx_Coroutine_USED
  17777. if (__Pyx_Coroutine_CheckExact(yf)) {
  17778. ret = __Pyx_Coroutine_Send(yf, Py_None);
  17779. } else
  17780. #endif
  17781. #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
  17782. if (PyGen_CheckExact(yf)) {
  17783. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  17784. } else
  17785. #endif
  17786. ret = __Pyx_PyIter_Next_Plain(yf);
  17787. if (likely(ret)) {
  17788. __Pyx_Coroutine_unset_is_running(gen);
  17789. return ret;
  17790. }
  17791. result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
  17792. } else {
  17793. result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  17794. }
  17795. __Pyx_Coroutine_unset_is_running(gen);
  17796. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
  17797. }
  17798. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  17799. PyObject *retval = NULL;
  17800. __Pyx_PySendResult result;
  17801. CYTHON_UNUSED_VAR(arg);
  17802. result = __Pyx_Coroutine_Close(self, &retval);
  17803. if (unlikely(result == PYGEN_ERROR))
  17804. return NULL;
  17805. Py_XDECREF(retval);
  17806. Py_RETURN_NONE;
  17807. }
  17808. static __Pyx_PySendResult
  17809. __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
  17810. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17811. __Pyx_PySendResult result;
  17812. PyObject *yf;
  17813. int err = 0;
  17814. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  17815. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  17816. return PYGEN_ERROR;
  17817. }
  17818. yf = gen->yieldfrom;
  17819. if (yf) {
  17820. Py_INCREF(yf);
  17821. err = __Pyx_Coroutine_CloseIter(gen, yf);
  17822. __Pyx_Coroutine_Undelegate(gen);
  17823. Py_DECREF(yf);
  17824. }
  17825. if (err == 0)
  17826. PyErr_SetNone(PyExc_GeneratorExit);
  17827. result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
  17828. if (result == PYGEN_ERROR) {
  17829. __Pyx_PyThreadState_declare
  17830. __Pyx_PyThreadState_assign
  17831. __Pyx_Coroutine_unset_is_running(gen);
  17832. if (!__Pyx_PyErr_Occurred()) {
  17833. return PYGEN_RETURN;
  17834. } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
  17835. __Pyx_PyErr_Clear();
  17836. return PYGEN_RETURN;
  17837. }
  17838. return PYGEN_ERROR;
  17839. } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
  17840. __Pyx_Coroutine_unset_is_running(gen);
  17841. return PYGEN_RETURN;
  17842. } else {
  17843. const char *msg;
  17844. Py_DECREF(*retval);
  17845. *retval = NULL;
  17846. if ((0)) {
  17847. #ifdef __Pyx_Coroutine_USED
  17848. } else if (__Pyx_Coroutine_Check(self)) {
  17849. msg = "coroutine ignored GeneratorExit";
  17850. #endif
  17851. #ifdef __Pyx_AsyncGen_USED
  17852. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  17853. msg = "async generator ignored GeneratorExit";
  17854. #endif
  17855. } else {
  17856. msg = "generator ignored GeneratorExit";
  17857. }
  17858. PyErr_SetString(PyExc_RuntimeError, msg);
  17859. __Pyx_Coroutine_unset_is_running(gen);
  17860. return PYGEN_ERROR;
  17861. }
  17862. }
  17863. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  17864. PyObject *args, int close_on_genexit) {
  17865. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17866. PyObject *yf;
  17867. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
  17868. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17869. yf = gen->yieldfrom;
  17870. if (yf) {
  17871. __Pyx_PySendResult result;
  17872. PyObject *ret;
  17873. Py_INCREF(yf);
  17874. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  17875. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  17876. Py_DECREF(yf);
  17877. __Pyx_Coroutine_Undelegate(gen);
  17878. if (err < 0)
  17879. goto propagate_exception;
  17880. goto throw_here;
  17881. }
  17882. if (0
  17883. #ifdef __Pyx_Generator_USED
  17884. || __Pyx_Generator_CheckExact(yf)
  17885. #endif
  17886. #ifdef __Pyx_Coroutine_USED
  17887. || __Pyx_Coroutine_Check(yf)
  17888. #endif
  17889. ) {
  17890. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  17891. #ifdef __Pyx_Coroutine_USED
  17892. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17893. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  17894. #endif
  17895. } else {
  17896. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
  17897. if (unlikely(!meth)) {
  17898. Py_DECREF(yf);
  17899. if (unlikely(PyErr_Occurred())) {
  17900. __Pyx_Coroutine_unset_is_running(gen);
  17901. return NULL;
  17902. }
  17903. __Pyx_Coroutine_Undelegate(gen);
  17904. goto throw_here;
  17905. }
  17906. if (likely(args)) {
  17907. ret = __Pyx_PyObject_Call(meth, args, NULL);
  17908. } else {
  17909. PyObject *cargs[4] = {NULL, typ, val, tb};
  17910. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17911. }
  17912. Py_DECREF(meth);
  17913. }
  17914. Py_DECREF(yf);
  17915. if (ret) {
  17916. __Pyx_Coroutine_unset_is_running(gen);
  17917. return ret;
  17918. }
  17919. result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
  17920. __Pyx_Coroutine_unset_is_running(gen);
  17921. return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
  17922. }
  17923. throw_here:
  17924. __Pyx_Raise(typ, val, tb, NULL);
  17925. propagate_exception:
  17926. {
  17927. PyObject *retval = NULL;
  17928. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
  17929. __Pyx_Coroutine_unset_is_running(gen);
  17930. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  17931. }
  17932. }
  17933. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  17934. PyObject *typ;
  17935. PyObject *val = NULL;
  17936. PyObject *tb = NULL;
  17937. if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
  17938. return NULL;
  17939. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  17940. }
  17941. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  17942. #if PY_VERSION_HEX >= 0x030B00a4
  17943. Py_VISIT(exc_state->exc_value);
  17944. #else
  17945. Py_VISIT(exc_state->exc_type);
  17946. Py_VISIT(exc_state->exc_value);
  17947. Py_VISIT(exc_state->exc_traceback);
  17948. #endif
  17949. return 0;
  17950. }
  17951. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  17952. {
  17953. int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
  17954. if (e) return e;
  17955. }
  17956. Py_VISIT(gen->closure);
  17957. Py_VISIT(gen->classobj);
  17958. Py_VISIT(gen->yieldfrom);
  17959. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  17960. }
  17961. static int __Pyx_Coroutine_clear(PyObject *self) {
  17962. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17963. Py_CLEAR(gen->closure);
  17964. Py_CLEAR(gen->classobj);
  17965. __Pyx_Coroutine_Undelegate(gen);
  17966. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  17967. #ifdef __Pyx_AsyncGen_USED
  17968. if (__Pyx_AsyncGen_CheckExact(self)) {
  17969. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  17970. }
  17971. #endif
  17972. Py_CLEAR(gen->gi_code);
  17973. Py_CLEAR(gen->gi_frame);
  17974. Py_CLEAR(gen->gi_name);
  17975. Py_CLEAR(gen->gi_qualname);
  17976. Py_CLEAR(gen->gi_modulename);
  17977. return 0;
  17978. }
  17979. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  17980. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17981. PyObject_GC_UnTrack(gen);
  17982. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  17983. if (gen->gi_weakreflist != NULL)
  17984. #endif
  17985. PyObject_ClearWeakRefs(self);
  17986. if (gen->resume_label >= 0) {
  17987. PyObject_GC_Track(self);
  17988. #if CYTHON_USE_TP_FINALIZE
  17989. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  17990. #else
  17991. {
  17992. destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
  17993. if (del) del(self);
  17994. }
  17995. if (unlikely(Py_REFCNT(self) > 0))
  17996. #endif
  17997. {
  17998. return;
  17999. }
  18000. PyObject_GC_UnTrack(self);
  18001. }
  18002. #ifdef __Pyx_AsyncGen_USED
  18003. if (__Pyx_AsyncGen_CheckExact(self)) {
  18004. /* We have to handle this case for asynchronous generators
  18005. right here, because this code has to be between UNTRACK
  18006. and GC_Del. */
  18007. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  18008. }
  18009. #endif
  18010. __Pyx_Coroutine_clear(self);
  18011. __Pyx_PyHeapTypeObject_GC_Del(gen);
  18012. }
  18013. #if CYTHON_USE_TP_FINALIZE
  18014. static void __Pyx_Coroutine_del(PyObject *self) {
  18015. PyObject *error_type, *error_value, *error_traceback;
  18016. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  18017. __Pyx_PyThreadState_declare
  18018. if (gen->resume_label < 0) {
  18019. return;
  18020. }
  18021. __Pyx_PyThreadState_assign
  18022. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  18023. #ifdef __Pyx_AsyncGen_USED
  18024. if (__Pyx_AsyncGen_CheckExact(self)) {
  18025. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  18026. PyObject *finalizer = agen->ag_finalizer;
  18027. if (finalizer && !agen->ag_closed) {
  18028. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  18029. if (unlikely(!res)) {
  18030. PyErr_WriteUnraisable(self);
  18031. } else {
  18032. Py_DECREF(res);
  18033. }
  18034. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  18035. return;
  18036. }
  18037. }
  18038. #endif
  18039. if (unlikely(gen->resume_label == 0 && !error_value)) {
  18040. #ifdef __Pyx_Coroutine_USED
  18041. #ifdef __Pyx_Generator_USED
  18042. if (!__Pyx_Generator_CheckExact(self))
  18043. #endif
  18044. {
  18045. PyObject_GC_UnTrack(self);
  18046. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  18047. PyErr_WriteUnraisable(self);
  18048. PyObject_GC_Track(self);
  18049. }
  18050. #endif
  18051. } else {
  18052. PyObject *retval = NULL;
  18053. __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
  18054. if (result == PYGEN_ERROR) {
  18055. PyErr_WriteUnraisable(self);
  18056. } else {
  18057. Py_XDECREF(retval);
  18058. }
  18059. }
  18060. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  18061. }
  18062. #endif
  18063. static PyObject *
  18064. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  18065. {
  18066. PyObject *name = self->gi_name;
  18067. CYTHON_UNUSED_VAR(context);
  18068. if (unlikely(!name)) name = Py_None;
  18069. Py_INCREF(name);
  18070. return name;
  18071. }
  18072. static int
  18073. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  18074. {
  18075. CYTHON_UNUSED_VAR(context);
  18076. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  18077. PyErr_SetString(PyExc_TypeError,
  18078. "__name__ must be set to a string object");
  18079. return -1;
  18080. }
  18081. Py_INCREF(value);
  18082. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  18083. return 0;
  18084. }
  18085. static PyObject *
  18086. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  18087. {
  18088. PyObject *name = self->gi_qualname;
  18089. CYTHON_UNUSED_VAR(context);
  18090. if (unlikely(!name)) name = Py_None;
  18091. Py_INCREF(name);
  18092. return name;
  18093. }
  18094. static int
  18095. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  18096. {
  18097. CYTHON_UNUSED_VAR(context);
  18098. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  18099. PyErr_SetString(PyExc_TypeError,
  18100. "__qualname__ must be set to a string object");
  18101. return -1;
  18102. }
  18103. Py_INCREF(value);
  18104. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  18105. return 0;
  18106. }
  18107. static PyObject *
  18108. __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
  18109. {
  18110. #if !CYTHON_COMPILING_IN_LIMITED_API
  18111. PyObject *frame;
  18112. #if PY_VERSION_HEX >= 0x030d0000
  18113. Py_BEGIN_CRITICAL_SECTION(self);
  18114. #endif
  18115. frame = self->gi_frame;
  18116. if (!frame) {
  18117. if (unlikely(!self->gi_code)) {
  18118. Py_RETURN_NONE;
  18119. }
  18120. PyObject *globals = PyDict_New();
  18121. if (unlikely(!globals)) return NULL;
  18122. frame = (PyObject *) PyFrame_New(
  18123. PyThreadState_Get(), /*PyThreadState *tstate,*/
  18124. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  18125. globals, /*PyObject *globals,*/
  18126. 0 /*PyObject *locals*/
  18127. );
  18128. Py_DECREF(globals);
  18129. if (unlikely(!frame))
  18130. return NULL;
  18131. if (unlikely(self->gi_frame)) {
  18132. Py_DECREF(frame);
  18133. frame = self->gi_frame;
  18134. } else {
  18135. self->gi_frame = frame;
  18136. }
  18137. }
  18138. Py_INCREF(frame);
  18139. #if PY_VERSION_HEX >= 0x030d0000
  18140. Py_END_CRITICAL_SECTION();
  18141. #endif
  18142. return frame;
  18143. #else
  18144. CYTHON_UNUSED_VAR(self);
  18145. Py_RETURN_NONE;
  18146. #endif
  18147. }
  18148. static PyObject *
  18149. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
  18150. CYTHON_UNUSED_VAR(context);
  18151. PyObject *frame = self->gi_frame;
  18152. if (frame)
  18153. return __Pyx_NewRef(frame);
  18154. return __Pyx__Coroutine_get_frame(self);
  18155. }
  18156. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  18157. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  18158. PyObject *name, PyObject *qualname, PyObject *module_name) {
  18159. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  18160. if (unlikely(!gen))
  18161. return NULL;
  18162. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  18163. }
  18164. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  18165. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  18166. PyObject *name, PyObject *qualname, PyObject *module_name) {
  18167. gen->body = body;
  18168. gen->closure = closure;
  18169. Py_XINCREF(closure);
  18170. gen->is_running = 0;
  18171. gen->resume_label = 0;
  18172. gen->classobj = NULL;
  18173. gen->yieldfrom = NULL;
  18174. gen->yieldfrom_am_send = NULL;
  18175. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
  18176. gen->gi_exc_state.exc_value = NULL;
  18177. #else
  18178. gen->gi_exc_state.exc_type = NULL;
  18179. gen->gi_exc_state.exc_value = NULL;
  18180. gen->gi_exc_state.exc_traceback = NULL;
  18181. #endif
  18182. #if CYTHON_USE_EXC_INFO_STACK
  18183. gen->gi_exc_state.previous_item = NULL;
  18184. #endif
  18185. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  18186. gen->gi_weakreflist = NULL;
  18187. #endif
  18188. Py_XINCREF(qualname);
  18189. gen->gi_qualname = qualname;
  18190. Py_XINCREF(name);
  18191. gen->gi_name = name;
  18192. Py_XINCREF(module_name);
  18193. gen->gi_modulename = module_name;
  18194. Py_XINCREF(code);
  18195. gen->gi_code = code;
  18196. gen->gi_frame = NULL;
  18197. PyObject_GC_Track(gen);
  18198. return gen;
  18199. }
  18200. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
  18201. char result;
  18202. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18203. Py_BEGIN_CRITICAL_SECTION(gen);
  18204. #endif
  18205. result = gen->is_running;
  18206. gen->is_running = 1;
  18207. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18208. Py_END_CRITICAL_SECTION();
  18209. #endif
  18210. return result;
  18211. }
  18212. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
  18213. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18214. Py_BEGIN_CRITICAL_SECTION(gen);
  18215. #endif
  18216. assert(gen->is_running);
  18217. gen->is_running = 0;
  18218. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18219. Py_END_CRITICAL_SECTION();
  18220. #endif
  18221. }
  18222. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
  18223. char result;
  18224. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18225. Py_BEGIN_CRITICAL_SECTION(gen);
  18226. #endif
  18227. result = gen->is_running;
  18228. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18229. Py_END_CRITICAL_SECTION();
  18230. #endif
  18231. return result;
  18232. }
  18233. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
  18234. CYTHON_UNUSED_VAR(closure);
  18235. char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
  18236. if (result) Py_RETURN_TRUE;
  18237. else Py_RETURN_FALSE;
  18238. }
  18239. #if __PYX_HAS_PY_AM_SEND == 2
  18240. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
  18241. Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
  18242. if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
  18243. return;
  18244. }
  18245. memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
  18246. static_amsend_methods->am_send = am_send;
  18247. type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
  18248. }
  18249. #endif
  18250. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
  18251. CYTHON_UNUSED_VAR(arg);
  18252. __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
  18253. PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
  18254. self_type_name);
  18255. __Pyx_DECREF_TypeName(self_type_name);
  18256. return NULL;
  18257. }
  18258. /* Generator */
  18259. static PyMethodDef __pyx_Generator_methods[] = {
  18260. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  18261. PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  18262. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  18263. PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  18264. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  18265. PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  18266. {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
  18267. {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
  18268. {0, 0, 0, 0}
  18269. };
  18270. static PyMemberDef __pyx_Generator_memberlist[] = {
  18271. {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  18272. PyDoc_STR("object being iterated by 'yield from', or None")},
  18273. {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  18274. {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  18275. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  18276. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  18277. #endif
  18278. {0, 0, 0, 0, 0}
  18279. };
  18280. static PyGetSetDef __pyx_Generator_getsets[] = {
  18281. {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  18282. PyDoc_STR("name of the generator"), 0},
  18283. {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  18284. PyDoc_STR("qualified name of the generator"), 0},
  18285. {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  18286. PyDoc_STR("Frame of the generator"), 0},
  18287. {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
  18288. {0, 0, 0, 0, 0}
  18289. };
  18290. static PyType_Slot __pyx_GeneratorType_slots[] = {
  18291. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  18292. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  18293. {Py_tp_iter, (void *)PyObject_SelfIter},
  18294. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  18295. {Py_tp_methods, (void *)__pyx_Generator_methods},
  18296. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  18297. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  18298. {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
  18299. #if CYTHON_USE_TP_FINALIZE
  18300. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  18301. #endif
  18302. #if __PYX_HAS_PY_AM_SEND == 1
  18303. {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
  18304. #endif
  18305. {0, 0},
  18306. };
  18307. static PyType_Spec __pyx_GeneratorType_spec = {
  18308. __PYX_TYPE_MODULE_PREFIX "generator",
  18309. sizeof(__pyx_CoroutineObject),
  18310. 0,
  18311. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  18312. Py_TPFLAGS_MANAGED_WEAKREF |
  18313. #endif
  18314. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  18315. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
  18316. __pyx_GeneratorType_slots
  18317. };
  18318. #if __PYX_HAS_PY_AM_SEND == 2
  18319. static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
  18320. #endif
  18321. static int __pyx_Generator_init(PyObject *module) {
  18322. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  18323. mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
  18324. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
  18325. if (unlikely(!mstate->__pyx_GeneratorType)) {
  18326. return -1;
  18327. }
  18328. #if __PYX_HAS_PY_AM_SEND == 2
  18329. __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
  18330. #endif
  18331. return 0;
  18332. }
  18333. static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
  18334. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  18335. PyObject *retval = NULL;
  18336. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  18337. return __Pyx_Coroutine_AlreadyRunningError(gen);
  18338. }
  18339. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  18340. __Pyx_Coroutine_unset_is_running(gen);
  18341. (void) result;
  18342. assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
  18343. assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
  18344. return retval;
  18345. }
  18346. /* CheckBinaryVersion */
  18347. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  18348. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  18349. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  18350. return 0;
  18351. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  18352. return 1;
  18353. {
  18354. char message[200];
  18355. PyOS_snprintf(message, sizeof(message),
  18356. "compile time Python version %d.%d "
  18357. "of module '%.100s' "
  18358. "%s "
  18359. "runtime version %d.%d",
  18360. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  18361. __Pyx_MODULE_NAME,
  18362. (allow_newer) ? "was newer than" : "does not match",
  18363. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  18364. );
  18365. return PyErr_WarnEx(NULL, message, 1);
  18366. }
  18367. }
  18368. /* NewCodeObj */
  18369. #if CYTHON_COMPILING_IN_LIMITED_API
  18370. static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  18371. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  18372. PyObject *fv, PyObject *cell, PyObject* fn,
  18373. PyObject *name, int fline, PyObject *lnos) {
  18374. PyObject *exception_table = NULL;
  18375. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  18376. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  18377. PyObject *version_info;
  18378. PyObject *py_minor_version = NULL;
  18379. #endif
  18380. long minor_version = 0;
  18381. PyObject *type, *value, *traceback;
  18382. PyErr_Fetch(&type, &value, &traceback);
  18383. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  18384. minor_version = 11;
  18385. #else
  18386. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  18387. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  18388. minor_version = PyLong_AsLong(py_minor_version);
  18389. Py_DECREF(py_minor_version);
  18390. if (minor_version == -1 && PyErr_Occurred()) goto end;
  18391. #endif
  18392. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  18393. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  18394. if (minor_version <= 7) {
  18395. (void)p;
  18396. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
  18397. c, n, v, fn, name, fline, lnos, fv, cell);
  18398. } else if (minor_version <= 10) {
  18399. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
  18400. c, n, v, fn, name, fline, lnos, fv, cell);
  18401. } else {
  18402. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  18403. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
  18404. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  18405. }
  18406. end:
  18407. Py_XDECREF(code_type);
  18408. Py_XDECREF(exception_table);
  18409. Py_XDECREF(types_module);
  18410. if (type) {
  18411. PyErr_Restore(type, value, traceback);
  18412. }
  18413. return result;
  18414. }
  18415. #elif PY_VERSION_HEX >= 0x030B0000
  18416. static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  18417. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  18418. PyObject *fv, PyObject *cell, PyObject* fn,
  18419. PyObject *name, int fline, PyObject *lnos) {
  18420. PyCodeObject *result;
  18421. result =
  18422. #if PY_VERSION_HEX >= 0x030C0000
  18423. PyUnstable_Code_NewWithPosOnlyArgs
  18424. #else
  18425. PyCode_NewWithPosOnlyArgs
  18426. #endif
  18427. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
  18428. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
  18429. if (likely(result))
  18430. result->_co_firsttraceable = 0;
  18431. #endif
  18432. return result;
  18433. }
  18434. #elif !CYTHON_COMPILING_IN_PYPY
  18435. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  18436. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  18437. #else
  18438. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  18439. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  18440. #endif
  18441. static PyObject* __Pyx_PyCode_New(
  18442. const __Pyx_PyCode_New_function_description descr,
  18443. PyObject * const *varnames,
  18444. PyObject *filename,
  18445. PyObject *funcname,
  18446. PyObject *line_table,
  18447. PyObject *tuple_dedup_map
  18448. ) {
  18449. PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
  18450. Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
  18451. PyObject *varnames_tuple = PyTuple_New(var_count);
  18452. if (unlikely(!varnames_tuple)) return NULL;
  18453. for (Py_ssize_t i=0; i < var_count; i++) {
  18454. Py_INCREF(varnames[i]);
  18455. if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
  18456. }
  18457. #if CYTHON_COMPILING_IN_LIMITED_API
  18458. varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
  18459. if (!varnames_tuple_dedup) {
  18460. if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
  18461. varnames_tuple_dedup = varnames_tuple;
  18462. }
  18463. #else
  18464. varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
  18465. if (unlikely(!varnames_tuple_dedup)) goto done;
  18466. #endif
  18467. #if CYTHON_AVOID_BORROWED_REFS
  18468. Py_INCREF(varnames_tuple_dedup);
  18469. #endif
  18470. if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
  18471. Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
  18472. #if !CYTHON_ASSUME_SAFE_SIZE
  18473. if (unlikely(line_table_length == -1)) goto done;
  18474. #endif
  18475. Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
  18476. code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
  18477. if (unlikely(!code_bytes)) goto done;
  18478. char* c_code_bytes = PyBytes_AsString(code_bytes);
  18479. if (unlikely(!c_code_bytes)) goto done;
  18480. memset(c_code_bytes, 0, (size_t) code_len);
  18481. }
  18482. code_obj = (PyObject*) __Pyx__PyCode_New(
  18483. (int) descr.argcount,
  18484. (int) descr.num_posonly_args,
  18485. (int) descr.num_kwonly_args,
  18486. (int) descr.nlocals,
  18487. 0,
  18488. (int) descr.flags,
  18489. code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
  18490. __pyx_mstate_global->__pyx_empty_tuple,
  18491. __pyx_mstate_global->__pyx_empty_tuple,
  18492. varnames_tuple_dedup,
  18493. __pyx_mstate_global->__pyx_empty_tuple,
  18494. __pyx_mstate_global->__pyx_empty_tuple,
  18495. filename,
  18496. funcname,
  18497. (int) descr.first_line,
  18498. (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
  18499. );
  18500. done:
  18501. Py_XDECREF(code_bytes);
  18502. #if CYTHON_AVOID_BORROWED_REFS
  18503. Py_XDECREF(varnames_tuple_dedup);
  18504. #endif
  18505. Py_DECREF(varnames_tuple);
  18506. return code_obj;
  18507. }
  18508. /* DecompressString */
  18509. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
  18510. PyObject *module, *decompress, *compressed_bytes, *decompressed;
  18511. const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
  18512. PyObject *methodname = PyUnicode_FromString("decompress");
  18513. if (unlikely(!methodname)) return NULL;
  18514. #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
  18515. if (algo == 3) {
  18516. PyObject *fromlist = Py_BuildValue("[O]", methodname);
  18517. if (unlikely(!fromlist)) return NULL;
  18518. module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
  18519. Py_DECREF(fromlist);
  18520. } else
  18521. #endif
  18522. module = PyImport_ImportModule(module_name);
  18523. if (unlikely(!module)) goto import_failed;
  18524. decompress = PyObject_GetAttr(module, methodname);
  18525. if (unlikely(!decompress)) goto import_failed;
  18526. {
  18527. #ifdef __cplusplus
  18528. char *memview_bytes = const_cast<char*>(s);
  18529. #else
  18530. #if defined(__clang__)
  18531. #pragma clang diagnostic push
  18532. #pragma clang diagnostic ignored "-Wcast-qual"
  18533. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  18534. #pragma GCC diagnostic push
  18535. #pragma GCC diagnostic ignored "-Wcast-qual"
  18536. #endif
  18537. char *memview_bytes = (char*) s;
  18538. #if defined(__clang__)
  18539. #pragma clang diagnostic pop
  18540. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  18541. #pragma GCC diagnostic pop
  18542. #endif
  18543. #endif
  18544. #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
  18545. int memview_flags = 0x100;
  18546. #else
  18547. int memview_flags = PyBUF_READ;
  18548. #endif
  18549. compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
  18550. }
  18551. if (unlikely(!compressed_bytes)) {
  18552. Py_DECREF(decompress);
  18553. goto bad;
  18554. }
  18555. decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
  18556. Py_DECREF(compressed_bytes);
  18557. Py_DECREF(decompress);
  18558. Py_DECREF(module);
  18559. Py_DECREF(methodname);
  18560. return decompressed;
  18561. import_failed:
  18562. PyErr_Format(PyExc_ImportError,
  18563. "Failed to import '%.20s.decompress' - cannot initialise module strings. "
  18564. "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
  18565. module_name, algo);
  18566. bad:
  18567. Py_XDECREF(module);
  18568. Py_DECREF(methodname);
  18569. return NULL;
  18570. }
  18571. #include <string.h>
  18572. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  18573. size_t len = strlen(s);
  18574. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  18575. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  18576. return -1;
  18577. }
  18578. return (Py_ssize_t) len;
  18579. }
  18580. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  18581. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18582. if (unlikely(len < 0)) return NULL;
  18583. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  18584. }
  18585. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  18586. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18587. if (unlikely(len < 0)) return NULL;
  18588. return PyByteArray_FromStringAndSize(c_str, len);
  18589. }
  18590. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  18591. Py_ssize_t ignore;
  18592. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  18593. }
  18594. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  18595. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18596. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  18597. #if CYTHON_COMPILING_IN_LIMITED_API
  18598. {
  18599. const char* result;
  18600. Py_ssize_t unicode_length;
  18601. CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18602. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  18603. if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
  18604. #else
  18605. result = PyUnicode_AsUTF8AndSize(o, length);
  18606. #endif
  18607. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18608. unicode_length = PyUnicode_GetLength(o);
  18609. if (unlikely(unicode_length < 0)) return NULL;
  18610. if (unlikely(unicode_length != *length)) {
  18611. PyUnicode_AsASCIIString(o);
  18612. return NULL;
  18613. }
  18614. #endif
  18615. return result;
  18616. }
  18617. #else
  18618. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18619. if (likely(PyUnicode_IS_ASCII(o))) {
  18620. *length = PyUnicode_GET_LENGTH(o);
  18621. return PyUnicode_AsUTF8(o);
  18622. } else {
  18623. PyUnicode_AsASCIIString(o);
  18624. return NULL;
  18625. }
  18626. #else
  18627. return PyUnicode_AsUTF8AndSize(o, length);
  18628. #endif
  18629. #endif
  18630. }
  18631. #endif
  18632. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18633. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  18634. if (PyUnicode_Check(o)) {
  18635. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  18636. } else
  18637. #endif
  18638. if (PyByteArray_Check(o)) {
  18639. #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
  18640. *length = PyByteArray_GET_SIZE(o);
  18641. return PyByteArray_AS_STRING(o);
  18642. #else
  18643. *length = PyByteArray_Size(o);
  18644. if (*length == -1) return NULL;
  18645. return PyByteArray_AsString(o);
  18646. #endif
  18647. } else
  18648. {
  18649. char* result;
  18650. int r = PyBytes_AsStringAndSize(o, &result, length);
  18651. if (unlikely(r < 0)) {
  18652. return NULL;
  18653. } else {
  18654. return result;
  18655. }
  18656. }
  18657. }
  18658. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  18659. int is_true = x == Py_True;
  18660. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  18661. else return PyObject_IsTrue(x);
  18662. }
  18663. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  18664. int retval;
  18665. if (unlikely(!x)) return -1;
  18666. retval = __Pyx_PyObject_IsTrue(x);
  18667. Py_DECREF(x);
  18668. return retval;
  18669. }
  18670. static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
  18671. __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
  18672. if (PyLong_Check(result)) {
  18673. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  18674. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  18675. "The ability to return an instance of a strict subclass of int is deprecated, "
  18676. "and may be removed in a future version of Python.",
  18677. result_type_name)) {
  18678. __Pyx_DECREF_TypeName(result_type_name);
  18679. Py_DECREF(result);
  18680. return NULL;
  18681. }
  18682. __Pyx_DECREF_TypeName(result_type_name);
  18683. return result;
  18684. }
  18685. PyErr_Format(PyExc_TypeError,
  18686. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
  18687. result_type_name);
  18688. __Pyx_DECREF_TypeName(result_type_name);
  18689. Py_DECREF(result);
  18690. return NULL;
  18691. }
  18692. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
  18693. #if CYTHON_USE_TYPE_SLOTS
  18694. PyNumberMethods *m;
  18695. #endif
  18696. PyObject *res = NULL;
  18697. if (likely(PyLong_Check(x)))
  18698. return __Pyx_NewRef(x);
  18699. #if CYTHON_USE_TYPE_SLOTS
  18700. m = Py_TYPE(x)->tp_as_number;
  18701. if (likely(m && m->nb_int)) {
  18702. res = m->nb_int(x);
  18703. }
  18704. #else
  18705. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  18706. res = PyNumber_Long(x);
  18707. }
  18708. #endif
  18709. if (likely(res)) {
  18710. if (unlikely(!PyLong_CheckExact(res))) {
  18711. return __Pyx_PyNumber_LongWrongResultType(res);
  18712. }
  18713. }
  18714. else if (!PyErr_Occurred()) {
  18715. PyErr_SetString(PyExc_TypeError,
  18716. "an integer is required");
  18717. }
  18718. return res;
  18719. }
  18720. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  18721. Py_ssize_t ival;
  18722. PyObject *x;
  18723. if (likely(PyLong_CheckExact(b))) {
  18724. #if CYTHON_USE_PYLONG_INTERNALS
  18725. if (likely(__Pyx_PyLong_IsCompact(b))) {
  18726. return __Pyx_PyLong_CompactValue(b);
  18727. } else {
  18728. const digit* digits = __Pyx_PyLong_Digits(b);
  18729. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  18730. switch (size) {
  18731. case 2:
  18732. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18733. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18734. }
  18735. break;
  18736. case -2:
  18737. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18738. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18739. }
  18740. break;
  18741. case 3:
  18742. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18743. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18744. }
  18745. break;
  18746. case -3:
  18747. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18748. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18749. }
  18750. break;
  18751. case 4:
  18752. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18753. 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]));
  18754. }
  18755. break;
  18756. case -4:
  18757. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18758. 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]));
  18759. }
  18760. break;
  18761. }
  18762. }
  18763. #endif
  18764. return PyLong_AsSsize_t(b);
  18765. }
  18766. x = PyNumber_Index(b);
  18767. if (!x) return -1;
  18768. ival = PyLong_AsSsize_t(x);
  18769. Py_DECREF(x);
  18770. return ival;
  18771. }
  18772. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  18773. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  18774. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  18775. } else {
  18776. Py_ssize_t ival;
  18777. PyObject *x;
  18778. x = PyNumber_Index(o);
  18779. if (!x) return -1;
  18780. ival = PyLong_AsLong(x);
  18781. Py_DECREF(x);
  18782. return ival;
  18783. }
  18784. }
  18785. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
  18786. CYTHON_UNUSED_VAR(b);
  18787. return __Pyx_NewRef(Py_None);
  18788. }
  18789. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  18790. return __Pyx_NewRef(b ? Py_True: Py_False);
  18791. }
  18792. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
  18793. return PyLong_FromSize_t(ival);
  18794. }
  18795. /* MultiPhaseInitModuleState */
  18796. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  18797. #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18798. #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  18799. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  18800. #else
  18801. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  18802. #endif
  18803. #endif
  18804. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  18805. #error "Module state with PEP489 requires atomics. Currently that's one of\
  18806. C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  18807. #endif
  18808. #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18809. #define __Pyx_ModuleStateLookup_Lock()
  18810. #define __Pyx_ModuleStateLookup_Unlock()
  18811. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  18812. static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  18813. #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  18814. #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  18815. #elif defined(__cplusplus) && __cplusplus >= 201103L
  18816. #include <mutex>
  18817. static std::mutex __Pyx_ModuleStateLookup_mutex;
  18818. #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  18819. #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  18820. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  18821. #include <threads.h>
  18822. static mtx_t __Pyx_ModuleStateLookup_mutex;
  18823. static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  18824. static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
  18825. mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  18826. }
  18827. #define __Pyx_ModuleStateLookup_Lock()\
  18828. call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  18829. mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  18830. #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  18831. #elif defined(HAVE_PTHREAD_H)
  18832. #include <pthread.h>
  18833. static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  18834. #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  18835. #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  18836. #elif defined(_WIN32)
  18837. #include <Windows.h> // synchapi.h on its own doesn't work
  18838. static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  18839. #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  18840. #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  18841. #else
  18842. #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
  18843. Requires C standard >= C11, or C++ standard >= C++11,\
  18844. or pthreads, or the Windows 32 API, or Python >= 3.13."
  18845. #endif
  18846. typedef struct {
  18847. int64_t id;
  18848. PyObject *module;
  18849. } __Pyx_InterpreterIdAndModule;
  18850. typedef struct {
  18851. char interpreter_id_as_index;
  18852. Py_ssize_t count;
  18853. Py_ssize_t allocated;
  18854. __Pyx_InterpreterIdAndModule table[1];
  18855. } __Pyx_ModuleStateLookupData;
  18856. #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  18857. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18858. static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  18859. #endif
  18860. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18861. static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  18862. #else
  18863. static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  18864. #endif
  18865. static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
  18866. __Pyx_InterpreterIdAndModule* table,
  18867. Py_ssize_t count,
  18868. int64_t interpreterId) {
  18869. __Pyx_InterpreterIdAndModule* begin = table;
  18870. __Pyx_InterpreterIdAndModule* end = begin + count;
  18871. if (begin->id == interpreterId) {
  18872. return begin;
  18873. }
  18874. while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  18875. __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
  18876. if (halfway->id == interpreterId) {
  18877. return halfway;
  18878. }
  18879. if (halfway->id < interpreterId) {
  18880. begin = halfway;
  18881. } else {
  18882. end = halfway;
  18883. }
  18884. }
  18885. for (; begin < end; ++begin) {
  18886. if (begin->id >= interpreterId) return begin;
  18887. }
  18888. return begin;
  18889. }
  18890. static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
  18891. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  18892. if (interpreter_id == -1) return NULL;
  18893. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18894. __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  18895. {
  18896. __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18897. if (likely(data)) {
  18898. __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
  18899. if (likely(data == new_data)) {
  18900. goto read_finished;
  18901. }
  18902. }
  18903. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18904. __Pyx_ModuleStateLookup_Lock();
  18905. __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
  18906. data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  18907. __Pyx_ModuleStateLookup_Unlock();
  18908. }
  18909. read_finished:;
  18910. #else
  18911. __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  18912. #endif
  18913. __Pyx_InterpreterIdAndModule* found = NULL;
  18914. if (unlikely(!data)) goto end;
  18915. if (data->interpreter_id_as_index) {
  18916. if (interpreter_id < data->count) {
  18917. found = data->table+interpreter_id;
  18918. }
  18919. } else {
  18920. found = __Pyx_State_FindModuleStateLookupTableLowerBound(
  18921. data->table, data->count, interpreter_id);
  18922. }
  18923. end:
  18924. {
  18925. PyObject *result=NULL;
  18926. if (found && found->id == interpreter_id) {
  18927. result = found->module;
  18928. }
  18929. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18930. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  18931. #endif
  18932. return result;
  18933. }
  18934. }
  18935. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18936. static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
  18937. while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  18938. }
  18939. #else
  18940. #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  18941. #endif
  18942. static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
  18943. Py_ssize_t to_allocate = (*old_data)->allocated;
  18944. while (to_allocate <= interpreter_id) {
  18945. if (to_allocate == 0) to_allocate = 1;
  18946. else to_allocate *= 2;
  18947. }
  18948. __Pyx_ModuleStateLookupData *new_data = *old_data;
  18949. if (to_allocate != (*old_data)->allocated) {
  18950. new_data = (__Pyx_ModuleStateLookupData *)realloc(
  18951. *old_data,
  18952. sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  18953. if (!new_data) {
  18954. PyErr_NoMemory();
  18955. return -1;
  18956. }
  18957. for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
  18958. new_data->table[i].id = i;
  18959. new_data->table[i].module = NULL;
  18960. }
  18961. new_data->allocated = to_allocate;
  18962. }
  18963. new_data->table[interpreter_id].module = module;
  18964. if (new_data->count < interpreter_id+1) {
  18965. new_data->count = interpreter_id+1;
  18966. }
  18967. *old_data = new_data;
  18968. return 0;
  18969. }
  18970. static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
  18971. __Pyx_InterpreterIdAndModule *read = data->table;
  18972. __Pyx_InterpreterIdAndModule *write = data->table;
  18973. __Pyx_InterpreterIdAndModule *end = read + data->count;
  18974. for (; read<end; ++read) {
  18975. if (read->module) {
  18976. write->id = read->id;
  18977. write->module = read->module;
  18978. ++write;
  18979. }
  18980. }
  18981. data->count = write - data->table;
  18982. for (; write<end; ++write) {
  18983. write->id = 0;
  18984. write->module = NULL;
  18985. }
  18986. data->interpreter_id_as_index = 0;
  18987. }
  18988. static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
  18989. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  18990. if (interpreter_id == -1) return -1;
  18991. int result = 0;
  18992. __Pyx_ModuleStateLookup_Lock();
  18993. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  18994. __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
  18995. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  18996. #else
  18997. __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  18998. #endif
  18999. __Pyx_ModuleStateLookupData *new_data = old_data;
  19000. if (!new_data) {
  19001. new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
  19002. if (!new_data) {
  19003. result = -1;
  19004. PyErr_NoMemory();
  19005. goto end;
  19006. }
  19007. new_data->allocated = 1;
  19008. new_data->interpreter_id_as_index = 1;
  19009. }
  19010. __Pyx_ModuleStateLookup_wait_until_no_readers();
  19011. if (new_data->interpreter_id_as_index) {
  19012. if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  19013. result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
  19014. goto end;
  19015. }
  19016. __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
  19017. }
  19018. {
  19019. Py_ssize_t insert_at = 0;
  19020. {
  19021. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  19022. new_data->table, new_data->count, interpreter_id);
  19023. assert(lower_bound);
  19024. insert_at = lower_bound - new_data->table;
  19025. if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
  19026. lower_bound->module = module;
  19027. goto end; // already in table, nothing more to do
  19028. }
  19029. }
  19030. if (new_data->count+1 >= new_data->allocated) {
  19031. Py_ssize_t to_allocate = (new_data->count+1)*2;
  19032. new_data =
  19033. (__Pyx_ModuleStateLookupData*)realloc(
  19034. new_data,
  19035. sizeof(__Pyx_ModuleStateLookupData) +
  19036. (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  19037. if (!new_data) {
  19038. result = -1;
  19039. new_data = old_data;
  19040. PyErr_NoMemory();
  19041. goto end;
  19042. }
  19043. new_data->allocated = to_allocate;
  19044. }
  19045. ++new_data->count;
  19046. int64_t last_id = interpreter_id;
  19047. PyObject *last_module = module;
  19048. for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
  19049. int64_t current_id = new_data->table[i].id;
  19050. new_data->table[i].id = last_id;
  19051. last_id = current_id;
  19052. PyObject *current_module = new_data->table[i].module;
  19053. new_data->table[i].module = last_module;
  19054. last_module = current_module;
  19055. }
  19056. }
  19057. end:
  19058. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19059. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  19060. #else
  19061. __Pyx_ModuleStateLookup_data = new_data;
  19062. #endif
  19063. __Pyx_ModuleStateLookup_Unlock();
  19064. return result;
  19065. }
  19066. static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
  19067. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  19068. if (interpreter_id == -1) return -1;
  19069. __Pyx_ModuleStateLookup_Lock();
  19070. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19071. __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
  19072. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  19073. #else
  19074. __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  19075. #endif
  19076. if (data->interpreter_id_as_index) {
  19077. if (interpreter_id < data->count) {
  19078. data->table[interpreter_id].module = NULL;
  19079. }
  19080. goto done;
  19081. }
  19082. {
  19083. __Pyx_ModuleStateLookup_wait_until_no_readers();
  19084. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  19085. data->table, data->count, interpreter_id);
  19086. if (!lower_bound) goto done;
  19087. if (lower_bound->id != interpreter_id) goto done;
  19088. __Pyx_InterpreterIdAndModule *end = data->table+data->count;
  19089. for (;lower_bound<end-1; ++lower_bound) {
  19090. lower_bound->id = (lower_bound+1)->id;
  19091. lower_bound->module = (lower_bound+1)->module;
  19092. }
  19093. }
  19094. --data->count;
  19095. if (data->count == 0) {
  19096. free(data);
  19097. data = NULL;
  19098. }
  19099. done:
  19100. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  19101. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  19102. #else
  19103. __Pyx_ModuleStateLookup_data = data;
  19104. #endif
  19105. __Pyx_ModuleStateLookup_Unlock();
  19106. return 0;
  19107. }
  19108. #endif
  19109. /* #### Code section: utility_code_pragmas_end ### */
  19110. #ifdef _MSC_VER
  19111. #pragma warning( pop )
  19112. #endif
  19113. /* #### Code section: end ### */
  19114. #endif /* Py_PYTHON_H */