iup.c 762 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184
  1. /* Generated by Cython 3.0.6 */
  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. #if defined(CYTHON_LIMITED_API) && 0
  17. #ifndef Py_LIMITED_API
  18. #if CYTHON_LIMITED_API+0 > 0x03030000
  19. #define Py_LIMITED_API CYTHON_LIMITED_API
  20. #else
  21. #define Py_LIMITED_API 0x03030000
  22. #endif
  23. #endif
  24. #endif
  25. #include "Python.h"
  26. #ifndef Py_PYTHON_H
  27. #error Python headers needed to compile C extensions, please install development version of Python.
  28. #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  29. #error Cython requires Python 2.7+ or Python 3.3+.
  30. #else
  31. #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
  32. #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
  33. #else
  34. #define __PYX_EXTRA_ABI_MODULE_NAME ""
  35. #endif
  36. #define CYTHON_ABI "3_0_6" __PYX_EXTRA_ABI_MODULE_NAME
  37. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  38. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  39. #define CYTHON_HEX_VERSION 0x030006F0
  40. #define CYTHON_FUTURE_DIVISION 1
  41. #include <stddef.h>
  42. #ifndef offsetof
  43. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  44. #endif
  45. #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  46. #ifndef __stdcall
  47. #define __stdcall
  48. #endif
  49. #ifndef __cdecl
  50. #define __cdecl
  51. #endif
  52. #ifndef __fastcall
  53. #define __fastcall
  54. #endif
  55. #endif
  56. #ifndef DL_IMPORT
  57. #define DL_IMPORT(t) t
  58. #endif
  59. #ifndef DL_EXPORT
  60. #define DL_EXPORT(t) t
  61. #endif
  62. #define __PYX_COMMA ,
  63. #ifndef HAVE_LONG_LONG
  64. #define HAVE_LONG_LONG
  65. #endif
  66. #ifndef PY_LONG_LONG
  67. #define PY_LONG_LONG LONG_LONG
  68. #endif
  69. #ifndef Py_HUGE_VAL
  70. #define Py_HUGE_VAL HUGE_VAL
  71. #endif
  72. #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
  73. #if defined(GRAALVM_PYTHON)
  74. /* For very preliminary testing purposes. Most variables are set the same as PyPy.
  75. The existence of this section does not imply that anything works or is even tested */
  76. #define CYTHON_COMPILING_IN_PYPY 0
  77. #define CYTHON_COMPILING_IN_CPYTHON 0
  78. #define CYTHON_COMPILING_IN_LIMITED_API 0
  79. #define CYTHON_COMPILING_IN_GRAAL 1
  80. #define CYTHON_COMPILING_IN_NOGIL 0
  81. #undef CYTHON_USE_TYPE_SLOTS
  82. #define CYTHON_USE_TYPE_SLOTS 0
  83. #undef CYTHON_USE_TYPE_SPECS
  84. #define CYTHON_USE_TYPE_SPECS 0
  85. #undef CYTHON_USE_PYTYPE_LOOKUP
  86. #define CYTHON_USE_PYTYPE_LOOKUP 0
  87. #if PY_VERSION_HEX < 0x03050000
  88. #undef CYTHON_USE_ASYNC_SLOTS
  89. #define CYTHON_USE_ASYNC_SLOTS 0
  90. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  91. #define CYTHON_USE_ASYNC_SLOTS 1
  92. #endif
  93. #undef CYTHON_USE_PYLIST_INTERNALS
  94. #define CYTHON_USE_PYLIST_INTERNALS 0
  95. #undef CYTHON_USE_UNICODE_INTERNALS
  96. #define CYTHON_USE_UNICODE_INTERNALS 0
  97. #undef CYTHON_USE_UNICODE_WRITER
  98. #define CYTHON_USE_UNICODE_WRITER 0
  99. #undef CYTHON_USE_PYLONG_INTERNALS
  100. #define CYTHON_USE_PYLONG_INTERNALS 0
  101. #undef CYTHON_AVOID_BORROWED_REFS
  102. #define CYTHON_AVOID_BORROWED_REFS 1
  103. #undef CYTHON_ASSUME_SAFE_MACROS
  104. #define CYTHON_ASSUME_SAFE_MACROS 0
  105. #undef CYTHON_UNPACK_METHODS
  106. #define CYTHON_UNPACK_METHODS 0
  107. #undef CYTHON_FAST_THREAD_STATE
  108. #define CYTHON_FAST_THREAD_STATE 0
  109. #undef CYTHON_FAST_GIL
  110. #define CYTHON_FAST_GIL 0
  111. #undef CYTHON_METH_FASTCALL
  112. #define CYTHON_METH_FASTCALL 0
  113. #undef CYTHON_FAST_PYCALL
  114. #define CYTHON_FAST_PYCALL 0
  115. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  116. #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  117. #endif
  118. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  119. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  120. #undef CYTHON_USE_MODULE_STATE
  121. #define CYTHON_USE_MODULE_STATE 0
  122. #undef CYTHON_USE_TP_FINALIZE
  123. #define CYTHON_USE_TP_FINALIZE 0
  124. #undef CYTHON_USE_DICT_VERSIONS
  125. #define CYTHON_USE_DICT_VERSIONS 0
  126. #undef CYTHON_USE_EXC_INFO_STACK
  127. #define CYTHON_USE_EXC_INFO_STACK 0
  128. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  129. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  130. #endif
  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_NOGIL 0
  137. #undef CYTHON_USE_TYPE_SLOTS
  138. #define CYTHON_USE_TYPE_SLOTS 0
  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. #if PY_VERSION_HEX < 0x03050000
  145. #undef CYTHON_USE_ASYNC_SLOTS
  146. #define CYTHON_USE_ASYNC_SLOTS 0
  147. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  148. #define CYTHON_USE_ASYNC_SLOTS 1
  149. #endif
  150. #undef CYTHON_USE_PYLIST_INTERNALS
  151. #define CYTHON_USE_PYLIST_INTERNALS 0
  152. #undef CYTHON_USE_UNICODE_INTERNALS
  153. #define CYTHON_USE_UNICODE_INTERNALS 0
  154. #undef CYTHON_USE_UNICODE_WRITER
  155. #define CYTHON_USE_UNICODE_WRITER 0
  156. #undef CYTHON_USE_PYLONG_INTERNALS
  157. #define CYTHON_USE_PYLONG_INTERNALS 0
  158. #undef CYTHON_AVOID_BORROWED_REFS
  159. #define CYTHON_AVOID_BORROWED_REFS 1
  160. #undef CYTHON_ASSUME_SAFE_MACROS
  161. #define CYTHON_ASSUME_SAFE_MACROS 0
  162. #undef CYTHON_UNPACK_METHODS
  163. #define CYTHON_UNPACK_METHODS 0
  164. #undef CYTHON_FAST_THREAD_STATE
  165. #define CYTHON_FAST_THREAD_STATE 0
  166. #undef CYTHON_FAST_GIL
  167. #define CYTHON_FAST_GIL 0
  168. #undef CYTHON_METH_FASTCALL
  169. #define CYTHON_METH_FASTCALL 0
  170. #undef CYTHON_FAST_PYCALL
  171. #define CYTHON_FAST_PYCALL 0
  172. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  173. #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
  174. #endif
  175. #if PY_VERSION_HEX < 0x03090000
  176. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  177. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  178. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  179. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  180. #endif
  181. #undef CYTHON_USE_MODULE_STATE
  182. #define CYTHON_USE_MODULE_STATE 0
  183. #undef CYTHON_USE_TP_FINALIZE
  184. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
  185. #undef CYTHON_USE_DICT_VERSIONS
  186. #define CYTHON_USE_DICT_VERSIONS 0
  187. #undef CYTHON_USE_EXC_INFO_STACK
  188. #define CYTHON_USE_EXC_INFO_STACK 0
  189. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  190. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  191. #endif
  192. #elif defined(CYTHON_LIMITED_API)
  193. #ifdef Py_LIMITED_API
  194. #undef __PYX_LIMITED_VERSION_HEX
  195. #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  196. #endif
  197. #define CYTHON_COMPILING_IN_PYPY 0
  198. #define CYTHON_COMPILING_IN_CPYTHON 0
  199. #define CYTHON_COMPILING_IN_LIMITED_API 1
  200. #define CYTHON_COMPILING_IN_GRAAL 0
  201. #define CYTHON_COMPILING_IN_NOGIL 0
  202. #undef CYTHON_CLINE_IN_TRACEBACK
  203. #define CYTHON_CLINE_IN_TRACEBACK 0
  204. #undef CYTHON_USE_TYPE_SLOTS
  205. #define CYTHON_USE_TYPE_SLOTS 0
  206. #undef CYTHON_USE_TYPE_SPECS
  207. #define CYTHON_USE_TYPE_SPECS 1
  208. #undef CYTHON_USE_PYTYPE_LOOKUP
  209. #define CYTHON_USE_PYTYPE_LOOKUP 0
  210. #undef CYTHON_USE_ASYNC_SLOTS
  211. #define CYTHON_USE_ASYNC_SLOTS 0
  212. #undef CYTHON_USE_PYLIST_INTERNALS
  213. #define CYTHON_USE_PYLIST_INTERNALS 0
  214. #undef CYTHON_USE_UNICODE_INTERNALS
  215. #define CYTHON_USE_UNICODE_INTERNALS 0
  216. #ifndef CYTHON_USE_UNICODE_WRITER
  217. #define CYTHON_USE_UNICODE_WRITER 0
  218. #endif
  219. #undef CYTHON_USE_PYLONG_INTERNALS
  220. #define CYTHON_USE_PYLONG_INTERNALS 0
  221. #ifndef CYTHON_AVOID_BORROWED_REFS
  222. #define CYTHON_AVOID_BORROWED_REFS 0
  223. #endif
  224. #undef CYTHON_ASSUME_SAFE_MACROS
  225. #define CYTHON_ASSUME_SAFE_MACROS 0
  226. #undef CYTHON_UNPACK_METHODS
  227. #define CYTHON_UNPACK_METHODS 0
  228. #undef CYTHON_FAST_THREAD_STATE
  229. #define CYTHON_FAST_THREAD_STATE 0
  230. #undef CYTHON_FAST_GIL
  231. #define CYTHON_FAST_GIL 0
  232. #undef CYTHON_METH_FASTCALL
  233. #define CYTHON_METH_FASTCALL 0
  234. #undef CYTHON_FAST_PYCALL
  235. #define CYTHON_FAST_PYCALL 0
  236. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  237. #define CYTHON_PEP487_INIT_SUBCLASS 1
  238. #endif
  239. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  240. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  241. #undef CYTHON_USE_MODULE_STATE
  242. #define CYTHON_USE_MODULE_STATE 1
  243. #ifndef CYTHON_USE_TP_FINALIZE
  244. #define CYTHON_USE_TP_FINALIZE 0
  245. #endif
  246. #undef CYTHON_USE_DICT_VERSIONS
  247. #define CYTHON_USE_DICT_VERSIONS 0
  248. #undef CYTHON_USE_EXC_INFO_STACK
  249. #define CYTHON_USE_EXC_INFO_STACK 0
  250. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  251. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  252. #endif
  253. #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
  254. #define CYTHON_COMPILING_IN_PYPY 0
  255. #define CYTHON_COMPILING_IN_CPYTHON 0
  256. #define CYTHON_COMPILING_IN_LIMITED_API 0
  257. #define CYTHON_COMPILING_IN_GRAAL 0
  258. #define CYTHON_COMPILING_IN_NOGIL 1
  259. #ifndef CYTHON_USE_TYPE_SLOTS
  260. #define CYTHON_USE_TYPE_SLOTS 1
  261. #endif
  262. #undef CYTHON_USE_PYTYPE_LOOKUP
  263. #define CYTHON_USE_PYTYPE_LOOKUP 0
  264. #ifndef CYTHON_USE_ASYNC_SLOTS
  265. #define CYTHON_USE_ASYNC_SLOTS 1
  266. #endif
  267. #undef CYTHON_USE_PYLIST_INTERNALS
  268. #define CYTHON_USE_PYLIST_INTERNALS 0
  269. #ifndef CYTHON_USE_UNICODE_INTERNALS
  270. #define CYTHON_USE_UNICODE_INTERNALS 1
  271. #endif
  272. #undef CYTHON_USE_UNICODE_WRITER
  273. #define CYTHON_USE_UNICODE_WRITER 0
  274. #undef CYTHON_USE_PYLONG_INTERNALS
  275. #define CYTHON_USE_PYLONG_INTERNALS 0
  276. #ifndef CYTHON_AVOID_BORROWED_REFS
  277. #define CYTHON_AVOID_BORROWED_REFS 0
  278. #endif
  279. #ifndef CYTHON_ASSUME_SAFE_MACROS
  280. #define CYTHON_ASSUME_SAFE_MACROS 1
  281. #endif
  282. #ifndef CYTHON_UNPACK_METHODS
  283. #define CYTHON_UNPACK_METHODS 1
  284. #endif
  285. #undef CYTHON_FAST_THREAD_STATE
  286. #define CYTHON_FAST_THREAD_STATE 0
  287. #undef CYTHON_FAST_PYCALL
  288. #define CYTHON_FAST_PYCALL 0
  289. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  290. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  291. #endif
  292. #ifndef CYTHON_USE_TP_FINALIZE
  293. #define CYTHON_USE_TP_FINALIZE 1
  294. #endif
  295. #undef CYTHON_USE_DICT_VERSIONS
  296. #define CYTHON_USE_DICT_VERSIONS 0
  297. #undef CYTHON_USE_EXC_INFO_STACK
  298. #define CYTHON_USE_EXC_INFO_STACK 0
  299. #else
  300. #define CYTHON_COMPILING_IN_PYPY 0
  301. #define CYTHON_COMPILING_IN_CPYTHON 1
  302. #define CYTHON_COMPILING_IN_LIMITED_API 0
  303. #define CYTHON_COMPILING_IN_GRAAL 0
  304. #define CYTHON_COMPILING_IN_NOGIL 0
  305. #ifndef CYTHON_USE_TYPE_SLOTS
  306. #define CYTHON_USE_TYPE_SLOTS 1
  307. #endif
  308. #ifndef CYTHON_USE_TYPE_SPECS
  309. #define CYTHON_USE_TYPE_SPECS 0
  310. #endif
  311. #ifndef CYTHON_USE_PYTYPE_LOOKUP
  312. #define CYTHON_USE_PYTYPE_LOOKUP 1
  313. #endif
  314. #if PY_MAJOR_VERSION < 3
  315. #undef CYTHON_USE_ASYNC_SLOTS
  316. #define CYTHON_USE_ASYNC_SLOTS 0
  317. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  318. #define CYTHON_USE_ASYNC_SLOTS 1
  319. #endif
  320. #ifndef CYTHON_USE_PYLONG_INTERNALS
  321. #define CYTHON_USE_PYLONG_INTERNALS 1
  322. #endif
  323. #ifndef CYTHON_USE_PYLIST_INTERNALS
  324. #define CYTHON_USE_PYLIST_INTERNALS 1
  325. #endif
  326. #ifndef CYTHON_USE_UNICODE_INTERNALS
  327. #define CYTHON_USE_UNICODE_INTERNALS 1
  328. #endif
  329. #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
  330. #undef CYTHON_USE_UNICODE_WRITER
  331. #define CYTHON_USE_UNICODE_WRITER 0
  332. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  333. #define CYTHON_USE_UNICODE_WRITER 1
  334. #endif
  335. #ifndef CYTHON_AVOID_BORROWED_REFS
  336. #define CYTHON_AVOID_BORROWED_REFS 0
  337. #endif
  338. #ifndef CYTHON_ASSUME_SAFE_MACROS
  339. #define CYTHON_ASSUME_SAFE_MACROS 1
  340. #endif
  341. #ifndef CYTHON_UNPACK_METHODS
  342. #define CYTHON_UNPACK_METHODS 1
  343. #endif
  344. #ifndef CYTHON_FAST_THREAD_STATE
  345. #define CYTHON_FAST_THREAD_STATE 1
  346. #endif
  347. #ifndef CYTHON_FAST_GIL
  348. #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
  349. #endif
  350. #ifndef CYTHON_METH_FASTCALL
  351. #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
  352. #endif
  353. #ifndef CYTHON_FAST_PYCALL
  354. #define CYTHON_FAST_PYCALL 1
  355. #endif
  356. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  357. #define CYTHON_PEP487_INIT_SUBCLASS 1
  358. #endif
  359. #if PY_VERSION_HEX < 0x03050000
  360. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  361. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  362. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  363. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  364. #endif
  365. #ifndef CYTHON_USE_MODULE_STATE
  366. #define CYTHON_USE_MODULE_STATE 0
  367. #endif
  368. #if PY_VERSION_HEX < 0x030400a1
  369. #undef CYTHON_USE_TP_FINALIZE
  370. #define CYTHON_USE_TP_FINALIZE 0
  371. #elif !defined(CYTHON_USE_TP_FINALIZE)
  372. #define CYTHON_USE_TP_FINALIZE 1
  373. #endif
  374. #if PY_VERSION_HEX < 0x030600B1
  375. #undef CYTHON_USE_DICT_VERSIONS
  376. #define CYTHON_USE_DICT_VERSIONS 0
  377. #elif !defined(CYTHON_USE_DICT_VERSIONS)
  378. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
  379. #endif
  380. #if PY_VERSION_HEX < 0x030700A3
  381. #undef CYTHON_USE_EXC_INFO_STACK
  382. #define CYTHON_USE_EXC_INFO_STACK 0
  383. #elif !defined(CYTHON_USE_EXC_INFO_STACK)
  384. #define CYTHON_USE_EXC_INFO_STACK 1
  385. #endif
  386. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  387. #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  388. #endif
  389. #endif
  390. #if !defined(CYTHON_FAST_PYCCALL)
  391. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  392. #endif
  393. #if !defined(CYTHON_VECTORCALL)
  394. #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
  395. #endif
  396. #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
  397. #if CYTHON_USE_PYLONG_INTERNALS
  398. #if PY_MAJOR_VERSION < 3
  399. #include "longintrepr.h"
  400. #endif
  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
  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. #ifdef _MSC_VER
  476. #ifndef _MSC_STDINT_H_
  477. #if _MSC_VER < 1300
  478. typedef unsigned char uint8_t;
  479. typedef unsigned short uint16_t;
  480. typedef unsigned int uint32_t;
  481. #else
  482. typedef unsigned __int8 uint8_t;
  483. typedef unsigned __int16 uint16_t;
  484. typedef unsigned __int32 uint32_t;
  485. #endif
  486. #endif
  487. #if _MSC_VER < 1300
  488. #ifdef _WIN64
  489. typedef unsigned long long __pyx_uintptr_t;
  490. #else
  491. typedef unsigned int __pyx_uintptr_t;
  492. #endif
  493. #else
  494. #ifdef _WIN64
  495. typedef unsigned __int64 __pyx_uintptr_t;
  496. #else
  497. typedef unsigned __int32 __pyx_uintptr_t;
  498. #endif
  499. #endif
  500. #else
  501. #include <stdint.h>
  502. typedef uintptr_t __pyx_uintptr_t;
  503. #endif
  504. #ifndef CYTHON_FALLTHROUGH
  505. #if defined(__cplusplus)
  506. /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
  507. * but leads to warnings with -pedantic, since it is a C++17 feature */
  508. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  509. #if __has_cpp_attribute(fallthrough)
  510. #define CYTHON_FALLTHROUGH [[fallthrough]]
  511. #endif
  512. #endif
  513. #ifndef CYTHON_FALLTHROUGH
  514. #if __has_cpp_attribute(clang::fallthrough)
  515. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  516. #elif __has_cpp_attribute(gnu::fallthrough)
  517. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  518. #endif
  519. #endif
  520. #endif
  521. #ifndef CYTHON_FALLTHROUGH
  522. #if __has_attribute(fallthrough)
  523. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  524. #else
  525. #define CYTHON_FALLTHROUGH
  526. #endif
  527. #endif
  528. #if defined(__clang__) && defined(__apple_build_version__)
  529. #if __apple_build_version__ < 7000000
  530. #undef CYTHON_FALLTHROUGH
  531. #define CYTHON_FALLTHROUGH
  532. #endif
  533. #endif
  534. #endif
  535. #ifdef __cplusplus
  536. template <typename T>
  537. struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  538. #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
  539. #else
  540. #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
  541. #endif
  542. #if CYTHON_COMPILING_IN_PYPY == 1
  543. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
  544. #else
  545. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
  546. #endif
  547. #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
  548. #ifndef CYTHON_INLINE
  549. #if defined(__clang__)
  550. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  551. #elif defined(__GNUC__)
  552. #define CYTHON_INLINE __inline__
  553. #elif defined(_MSC_VER)
  554. #define CYTHON_INLINE __inline
  555. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  556. #define CYTHON_INLINE inline
  557. #else
  558. #define CYTHON_INLINE
  559. #endif
  560. #endif
  561. #define __PYX_BUILD_PY_SSIZE_T "n"
  562. #define CYTHON_FORMAT_SSIZE_T "z"
  563. #if PY_MAJOR_VERSION < 3
  564. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  565. #define __Pyx_DefaultClassType PyClass_Type
  566. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  567. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  568. #else
  569. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  570. #define __Pyx_DefaultClassType PyType_Type
  571. #if CYTHON_COMPILING_IN_LIMITED_API
  572. static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
  573. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  574. PyObject *fv, PyObject *cell, PyObject* fn,
  575. PyObject *name, int fline, PyObject *lnos) {
  576. PyObject *exception_table = NULL;
  577. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  578. #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
  579. PyObject *version_info; // borrowed
  580. PyObject *py_minor_version = NULL;
  581. #endif
  582. long minor_version = 0;
  583. PyObject *type, *value, *traceback;
  584. PyErr_Fetch(&type, &value, &traceback);
  585. #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
  586. minor_version = 11; // we don't yet need to distinguish between versions > 11
  587. #else
  588. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  589. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  590. minor_version = PyLong_AsLong(py_minor_version);
  591. Py_DECREF(py_minor_version);
  592. if (minor_version == -1 && PyErr_Occurred()) goto end;
  593. #endif
  594. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  595. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  596. if (minor_version <= 7) {
  597. (void)p;
  598. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
  599. c, n, v, fn, name, fline, lnos, fv, cell);
  600. } else if (minor_version <= 10) {
  601. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
  602. c, n, v, fn, name, fline, lnos, fv, cell);
  603. } else {
  604. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  605. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
  606. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  607. }
  608. end:
  609. Py_XDECREF(code_type);
  610. Py_XDECREF(exception_table);
  611. Py_XDECREF(types_module);
  612. if (type) {
  613. PyErr_Restore(type, value, traceback);
  614. }
  615. return result;
  616. }
  617. #ifndef CO_OPTIMIZED
  618. #define CO_OPTIMIZED 0x0001
  619. #endif
  620. #ifndef CO_NEWLOCALS
  621. #define CO_NEWLOCALS 0x0002
  622. #endif
  623. #ifndef CO_VARARGS
  624. #define CO_VARARGS 0x0004
  625. #endif
  626. #ifndef CO_VARKEYWORDS
  627. #define CO_VARKEYWORDS 0x0008
  628. #endif
  629. #ifndef CO_ASYNC_GENERATOR
  630. #define CO_ASYNC_GENERATOR 0x0200
  631. #endif
  632. #ifndef CO_GENERATOR
  633. #define CO_GENERATOR 0x0020
  634. #endif
  635. #ifndef CO_COROUTINE
  636. #define CO_COROUTINE 0x0080
  637. #endif
  638. #elif PY_VERSION_HEX >= 0x030B0000
  639. static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
  640. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  641. PyObject *fv, PyObject *cell, PyObject* fn,
  642. PyObject *name, int fline, PyObject *lnos) {
  643. PyCodeObject *result;
  644. PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here
  645. if (!empty_bytes) return NULL;
  646. result =
  647. #if PY_VERSION_HEX >= 0x030C0000
  648. PyUnstable_Code_NewWithPosOnlyArgs
  649. #else
  650. PyCode_NewWithPosOnlyArgs
  651. #endif
  652. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
  653. Py_DECREF(empty_bytes);
  654. return result;
  655. }
  656. #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
  657. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  658. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  659. #else
  660. #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  661. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  662. #endif
  663. #endif
  664. #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  665. #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
  666. #else
  667. #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
  668. #endif
  669. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  670. #define __Pyx_Py_Is(x, y) Py_Is(x, y)
  671. #else
  672. #define __Pyx_Py_Is(x, y) ((x) == (y))
  673. #endif
  674. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  675. #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
  676. #else
  677. #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
  678. #endif
  679. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  680. #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
  681. #else
  682. #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
  683. #endif
  684. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  685. #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
  686. #else
  687. #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
  688. #endif
  689. #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
  690. #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  691. #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
  692. #else
  693. #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
  694. #endif
  695. #ifndef CO_COROUTINE
  696. #define CO_COROUTINE 0x80
  697. #endif
  698. #ifndef CO_ASYNC_GENERATOR
  699. #define CO_ASYNC_GENERATOR 0x200
  700. #endif
  701. #ifndef Py_TPFLAGS_CHECKTYPES
  702. #define Py_TPFLAGS_CHECKTYPES 0
  703. #endif
  704. #ifndef Py_TPFLAGS_HAVE_INDEX
  705. #define Py_TPFLAGS_HAVE_INDEX 0
  706. #endif
  707. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  708. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  709. #endif
  710. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  711. #define Py_TPFLAGS_HAVE_FINALIZE 0
  712. #endif
  713. #ifndef Py_TPFLAGS_SEQUENCE
  714. #define Py_TPFLAGS_SEQUENCE 0
  715. #endif
  716. #ifndef Py_TPFLAGS_MAPPING
  717. #define Py_TPFLAGS_MAPPING 0
  718. #endif
  719. #ifndef METH_STACKLESS
  720. #define METH_STACKLESS 0
  721. #endif
  722. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  723. #ifndef METH_FASTCALL
  724. #define METH_FASTCALL 0x80
  725. #endif
  726. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  727. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  728. Py_ssize_t nargs, PyObject *kwnames);
  729. #else
  730. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  731. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  732. #endif
  733. #if CYTHON_METH_FASTCALL
  734. #define __Pyx_METH_FASTCALL METH_FASTCALL
  735. #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  736. #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
  737. #else
  738. #define __Pyx_METH_FASTCALL METH_VARARGS
  739. #define __Pyx_PyCFunction_FastCall PyCFunction
  740. #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
  741. #endif
  742. #if CYTHON_VECTORCALL
  743. #define __pyx_vectorcallfunc vectorcallfunc
  744. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
  745. #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
  746. #elif CYTHON_BACKPORT_VECTORCALL
  747. typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
  748. size_t nargsf, PyObject *kwnames);
  749. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
  750. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
  751. #else
  752. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
  753. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
  754. #endif
  755. #if PY_MAJOR_VERSION >= 0x030900B1
  756. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
  757. #else
  758. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
  759. #endif
  760. #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
  761. #if CYTHON_COMPILING_IN_CPYTHON
  762. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
  763. #elif !CYTHON_COMPILING_IN_LIMITED_API
  764. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
  765. #endif
  766. #if CYTHON_COMPILING_IN_CPYTHON
  767. #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
  768. static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
  769. return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
  770. }
  771. #endif
  772. static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
  773. #if CYTHON_COMPILING_IN_LIMITED_API
  774. return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  775. #else
  776. return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  777. #endif
  778. }
  779. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
  780. #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
  781. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
  782. typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
  783. #else
  784. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
  785. #define __Pyx_PyCMethod PyCMethod
  786. #endif
  787. #ifndef METH_METHOD
  788. #define METH_METHOD 0x200
  789. #endif
  790. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  791. #define PyObject_Malloc(s) PyMem_Malloc(s)
  792. #define PyObject_Free(p) PyMem_Free(p)
  793. #define PyObject_Realloc(p) PyMem_Realloc(p)
  794. #endif
  795. #if CYTHON_COMPILING_IN_LIMITED_API
  796. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  797. #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
  798. #else
  799. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  800. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  801. #endif
  802. #if CYTHON_COMPILING_IN_LIMITED_API
  803. #define __Pyx_PyThreadState_Current PyThreadState_Get()
  804. #elif !CYTHON_FAST_THREAD_STATE
  805. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  806. #elif PY_VERSION_HEX >= 0x030d00A1
  807. #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
  808. #elif PY_VERSION_HEX >= 0x03060000
  809. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  810. #elif PY_VERSION_HEX >= 0x03000000
  811. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  812. #else
  813. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  814. #endif
  815. #if CYTHON_COMPILING_IN_LIMITED_API
  816. static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
  817. {
  818. void *result;
  819. result = PyModule_GetState(op);
  820. if (!result)
  821. Py_FatalError("Couldn't find the module state");
  822. return result;
  823. }
  824. #endif
  825. #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
  826. #if CYTHON_COMPILING_IN_LIMITED_API
  827. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
  828. #else
  829. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
  830. #endif
  831. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  832. #include "pythread.h"
  833. #define Py_tss_NEEDS_INIT 0
  834. typedef int Py_tss_t;
  835. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  836. *key = PyThread_create_key();
  837. return 0;
  838. }
  839. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  840. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  841. *key = Py_tss_NEEDS_INIT;
  842. return key;
  843. }
  844. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  845. PyObject_Free(key);
  846. }
  847. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  848. return *key != Py_tss_NEEDS_INIT;
  849. }
  850. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  851. PyThread_delete_key(*key);
  852. *key = Py_tss_NEEDS_INIT;
  853. }
  854. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  855. return PyThread_set_key_value(*key, value);
  856. }
  857. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  858. return PyThread_get_key_value(*key);
  859. }
  860. #endif
  861. #if PY_MAJOR_VERSION < 3
  862. #if CYTHON_COMPILING_IN_PYPY
  863. #if PYPY_VERSION_NUM < 0x07030600
  864. #if defined(__cplusplus) && __cplusplus >= 201402L
  865. [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
  866. #elif defined(__GNUC__) || defined(__clang__)
  867. __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
  868. #elif defined(_MSC_VER)
  869. __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
  870. #endif
  871. static CYTHON_INLINE int PyGILState_Check(void) {
  872. return 0;
  873. }
  874. #else // PYPY_VERSION_NUM < 0x07030600
  875. #endif // PYPY_VERSION_NUM < 0x07030600
  876. #else
  877. static CYTHON_INLINE int PyGILState_Check(void) {
  878. PyThreadState * tstate = _PyThreadState_Current;
  879. return tstate && (tstate == PyGILState_GetThisThreadState());
  880. }
  881. #endif
  882. #endif
  883. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
  884. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  885. #else
  886. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  887. #endif
  888. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  889. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  890. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  891. #else
  892. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  893. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  894. #endif
  895. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
  896. #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  897. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
  898. PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
  899. if (res == NULL) PyErr_Clear();
  900. return res;
  901. }
  902. #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
  903. #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
  904. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  905. #else
  906. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
  907. #if CYTHON_COMPILING_IN_PYPY
  908. return PyDict_GetItem(dict, name);
  909. #else
  910. PyDictEntry *ep;
  911. PyDictObject *mp = (PyDictObject*) dict;
  912. long hash = ((PyStringObject *) name)->ob_shash;
  913. assert(hash != -1);
  914. ep = (mp->ma_lookup)(mp, name, hash);
  915. if (ep == NULL) {
  916. return NULL;
  917. }
  918. return ep->me_value;
  919. #endif
  920. }
  921. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  922. #endif
  923. #if CYTHON_USE_TYPE_SLOTS
  924. #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
  925. #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
  926. #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
  927. #else
  928. #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
  929. #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
  930. #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
  931. #endif
  932. #if CYTHON_COMPILING_IN_LIMITED_API
  933. #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
  934. #else
  935. #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
  936. #endif
  937. #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
  938. #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
  939. PyTypeObject *type = Py_TYPE((PyObject*)obj);\
  940. assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
  941. PyObject_GC_Del(obj);\
  942. Py_DECREF(type);\
  943. }
  944. #else
  945. #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
  946. #endif
  947. #if CYTHON_COMPILING_IN_LIMITED_API
  948. #define CYTHON_PEP393_ENABLED 1
  949. #define __Pyx_PyUnicode_READY(op) (0)
  950. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
  951. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  952. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
  953. #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
  954. #define __Pyx_PyUnicode_DATA(u) ((void*)u)
  955. #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  956. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
  957. #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  958. #define CYTHON_PEP393_ENABLED 1
  959. #if PY_VERSION_HEX >= 0x030C0000
  960. #define __Pyx_PyUnicode_READY(op) (0)
  961. #else
  962. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  963. 0 : _PyUnicode_Ready((PyObject *)(op)))
  964. #endif
  965. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  966. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  967. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  968. #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
  969. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  970. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  971. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  972. #if PY_VERSION_HEX >= 0x030C0000
  973. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
  974. #else
  975. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  976. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  977. #else
  978. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  979. #endif
  980. #endif
  981. #else
  982. #define CYTHON_PEP393_ENABLED 0
  983. #define PyUnicode_1BYTE_KIND 1
  984. #define PyUnicode_2BYTE_KIND 2
  985. #define PyUnicode_4BYTE_KIND 4
  986. #define __Pyx_PyUnicode_READY(op) (0)
  987. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  988. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  989. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
  990. #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
  991. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  992. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  993. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
  994. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  995. #endif
  996. #if CYTHON_COMPILING_IN_PYPY
  997. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  998. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  999. #else
  1000. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  1001. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  1002. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  1003. #endif
  1004. #if CYTHON_COMPILING_IN_PYPY
  1005. #if !defined(PyUnicode_DecodeUnicodeEscape)
  1006. #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
  1007. #endif
  1008. #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
  1009. #undef PyUnicode_Contains
  1010. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  1011. #endif
  1012. #if !defined(PyByteArray_Check)
  1013. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  1014. #endif
  1015. #if !defined(PyObject_Format)
  1016. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  1017. #endif
  1018. #endif
  1019. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  1020. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  1021. #if PY_MAJOR_VERSION >= 3
  1022. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  1023. #else
  1024. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  1025. #endif
  1026. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  1027. #define PyObject_ASCII(o) PyObject_Repr(o)
  1028. #endif
  1029. #if PY_MAJOR_VERSION >= 3
  1030. #define PyBaseString_Type PyUnicode_Type
  1031. #define PyStringObject PyUnicodeObject
  1032. #define PyString_Type PyUnicode_Type
  1033. #define PyString_Check PyUnicode_Check
  1034. #define PyString_CheckExact PyUnicode_CheckExact
  1035. #ifndef PyObject_Unicode
  1036. #define PyObject_Unicode PyObject_Str
  1037. #endif
  1038. #endif
  1039. #if PY_MAJOR_VERSION >= 3
  1040. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  1041. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  1042. #else
  1043. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  1044. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  1045. #endif
  1046. #if CYTHON_COMPILING_IN_CPYTHON
  1047. #define __Pyx_PySequence_ListKeepNew(obj)\
  1048. (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  1049. #else
  1050. #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
  1051. #endif
  1052. #ifndef PySet_CheckExact
  1053. #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
  1054. #endif
  1055. #if PY_VERSION_HEX >= 0x030900A4
  1056. #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  1057. #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  1058. #else
  1059. #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  1060. #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  1061. #endif
  1062. #if CYTHON_ASSUME_SAFE_MACROS
  1063. #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  1064. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  1065. #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  1066. #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  1067. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  1068. #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  1069. #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  1070. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  1071. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  1072. #else
  1073. #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  1074. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  1075. #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  1076. #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  1077. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  1078. #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  1079. #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  1080. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  1081. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  1082. #endif
  1083. #if PY_VERSION_HEX >= 0x030d00A1
  1084. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  1085. #else
  1086. static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  1087. PyObject *module = PyImport_AddModule(name);
  1088. Py_XINCREF(module);
  1089. return module;
  1090. }
  1091. #endif
  1092. #if PY_MAJOR_VERSION >= 3
  1093. #define PyIntObject PyLongObject
  1094. #define PyInt_Type PyLong_Type
  1095. #define PyInt_Check(op) PyLong_Check(op)
  1096. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  1097. #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
  1098. #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
  1099. #define PyInt_FromString PyLong_FromString
  1100. #define PyInt_FromUnicode PyLong_FromUnicode
  1101. #define PyInt_FromLong PyLong_FromLong
  1102. #define PyInt_FromSize_t PyLong_FromSize_t
  1103. #define PyInt_FromSsize_t PyLong_FromSsize_t
  1104. #define PyInt_AsLong PyLong_AsLong
  1105. #define PyInt_AS_LONG PyLong_AS_LONG
  1106. #define PyInt_AsSsize_t PyLong_AsSsize_t
  1107. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  1108. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  1109. #define PyNumber_Int PyNumber_Long
  1110. #else
  1111. #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
  1112. #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
  1113. #endif
  1114. #if PY_MAJOR_VERSION >= 3
  1115. #define PyBoolObject PyLongObject
  1116. #endif
  1117. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  1118. #ifndef PyUnicode_InternFromString
  1119. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  1120. #endif
  1121. #endif
  1122. #if PY_VERSION_HEX < 0x030200A4
  1123. typedef long Py_hash_t;
  1124. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  1125. #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
  1126. #else
  1127. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  1128. #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
  1129. #endif
  1130. #if CYTHON_USE_ASYNC_SLOTS
  1131. #if PY_VERSION_HEX >= 0x030500B1
  1132. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  1133. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  1134. #else
  1135. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  1136. #endif
  1137. #else
  1138. #define __Pyx_PyType_AsAsync(obj) NULL
  1139. #endif
  1140. #ifndef __Pyx_PyAsyncMethodsStruct
  1141. typedef struct {
  1142. unaryfunc am_await;
  1143. unaryfunc am_aiter;
  1144. unaryfunc am_anext;
  1145. } __Pyx_PyAsyncMethodsStruct;
  1146. #endif
  1147. #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  1148. #if !defined(_USE_MATH_DEFINES)
  1149. #define _USE_MATH_DEFINES
  1150. #endif
  1151. #endif
  1152. #include <math.h>
  1153. #ifdef NAN
  1154. #define __PYX_NAN() ((float) NAN)
  1155. #else
  1156. static CYTHON_INLINE float __PYX_NAN() {
  1157. float value;
  1158. memset(&value, 0xFF, sizeof(value));
  1159. return value;
  1160. }
  1161. #endif
  1162. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  1163. #define __Pyx_truncl trunc
  1164. #else
  1165. #define __Pyx_truncl truncl
  1166. #endif
  1167. #define __PYX_MARK_ERR_POS(f_index, lineno) \
  1168. { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
  1169. #define __PYX_ERR(f_index, lineno, Ln_error) \
  1170. { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  1171. #ifdef CYTHON_EXTERN_C
  1172. #undef __PYX_EXTERN_C
  1173. #define __PYX_EXTERN_C CYTHON_EXTERN_C
  1174. #elif defined(__PYX_EXTERN_C)
  1175. #ifdef _MSC_VER
  1176. #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
  1177. #else
  1178. #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
  1179. #endif
  1180. #else
  1181. #ifdef __cplusplus
  1182. #define __PYX_EXTERN_C extern "C"
  1183. #else
  1184. #define __PYX_EXTERN_C extern
  1185. #endif
  1186. #endif
  1187. #define __PYX_HAVE__fontTools__varLib__iup
  1188. #define __PYX_HAVE_API__fontTools__varLib__iup
  1189. /* Early includes */
  1190. #ifdef _OPENMP
  1191. #include <omp.h>
  1192. #endif /* _OPENMP */
  1193. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  1194. #define CYTHON_WITHOUT_ASSERTIONS
  1195. #endif
  1196. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  1197. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  1198. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1199. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1200. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  1201. #define __PYX_DEFAULT_STRING_ENCODING ""
  1202. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1203. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1204. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1205. #define __Pyx_long_cast(x) ((long)x)
  1206. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1207. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1208. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1209. likely(v < (type)PY_SSIZE_T_MAX ||\
  1210. v == (type)PY_SSIZE_T_MAX) &&\
  1211. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1212. v == (type)PY_SSIZE_T_MIN))) ||\
  1213. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1214. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1215. v == (type)PY_SSIZE_T_MAX))) )
  1216. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1217. return (size_t) i < (size_t) limit;
  1218. }
  1219. #if defined (__cplusplus) && __cplusplus >= 201103L
  1220. #include <cstdlib>
  1221. #define __Pyx_sst_abs(value) std::abs(value)
  1222. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1223. #define __Pyx_sst_abs(value) abs(value)
  1224. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1225. #define __Pyx_sst_abs(value) labs(value)
  1226. #elif defined (_MSC_VER)
  1227. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1228. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1229. #define __Pyx_sst_abs(value) llabs(value)
  1230. #elif defined (__GNUC__)
  1231. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1232. #else
  1233. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1234. #endif
  1235. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1236. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1237. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1238. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1239. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1240. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1241. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1242. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1243. #if PY_MAJOR_VERSION < 3
  1244. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  1245. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1246. #else
  1247. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  1248. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  1249. #endif
  1250. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1251. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1252. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1253. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1254. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1255. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1256. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1257. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1258. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1259. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1260. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1261. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1262. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1263. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1264. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  1265. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1266. #if CYTHON_COMPILING_IN_LIMITED_API
  1267. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u)
  1268. {
  1269. const wchar_t *u_end = u;
  1270. while (*u_end++) ;
  1271. return (size_t)(u_end - u - 1);
  1272. }
  1273. #else
  1274. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  1275. {
  1276. const Py_UNICODE *u_end = u;
  1277. while (*u_end++) ;
  1278. return (size_t)(u_end - u - 1);
  1279. }
  1280. #endif
  1281. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1282. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  1283. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  1284. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1285. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  1286. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  1287. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1288. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1289. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1290. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  1291. #define __Pyx_PySequence_Tuple(obj)\
  1292. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1293. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1294. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  1295. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1296. #if CYTHON_ASSUME_SAFE_MACROS
  1297. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1298. #else
  1299. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1300. #endif
  1301. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  1302. #if PY_MAJOR_VERSION >= 3
  1303. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1304. #else
  1305. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  1306. #endif
  1307. #if CYTHON_USE_PYLONG_INTERNALS
  1308. #if PY_VERSION_HEX >= 0x030C00A7
  1309. #ifndef _PyLong_SIGN_MASK
  1310. #define _PyLong_SIGN_MASK 3
  1311. #endif
  1312. #ifndef _PyLong_NON_SIZE_BITS
  1313. #define _PyLong_NON_SIZE_BITS 3
  1314. #endif
  1315. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1316. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1317. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1318. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1319. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1320. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1321. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1322. #define __Pyx_PyLong_SignedDigitCount(x)\
  1323. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1324. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1325. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1326. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1327. #else
  1328. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1329. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1330. #endif
  1331. typedef Py_ssize_t __Pyx_compact_pylong;
  1332. typedef size_t __Pyx_compact_upylong;
  1333. #else // Py < 3.12
  1334. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1335. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1336. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1337. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1338. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1339. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1340. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1341. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1342. #define __Pyx_PyLong_CompactValue(x)\
  1343. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1344. typedef sdigit __Pyx_compact_pylong;
  1345. typedef digit __Pyx_compact_upylong;
  1346. #endif
  1347. #if PY_VERSION_HEX >= 0x030C00A5
  1348. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1349. #else
  1350. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1351. #endif
  1352. #endif
  1353. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1354. #include <string.h>
  1355. static int __Pyx_sys_getdefaultencoding_not_ascii;
  1356. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  1357. PyObject* sys;
  1358. PyObject* default_encoding = NULL;
  1359. PyObject* ascii_chars_u = NULL;
  1360. PyObject* ascii_chars_b = NULL;
  1361. const char* default_encoding_c;
  1362. sys = PyImport_ImportModule("sys");
  1363. if (!sys) goto bad;
  1364. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  1365. Py_DECREF(sys);
  1366. if (!default_encoding) goto bad;
  1367. default_encoding_c = PyBytes_AsString(default_encoding);
  1368. if (!default_encoding_c) goto bad;
  1369. if (strcmp(default_encoding_c, "ascii") == 0) {
  1370. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  1371. } else {
  1372. char ascii_chars[128];
  1373. int c;
  1374. for (c = 0; c < 128; c++) {
  1375. ascii_chars[c] = (char) c;
  1376. }
  1377. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  1378. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  1379. if (!ascii_chars_u) goto bad;
  1380. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  1381. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  1382. PyErr_Format(
  1383. PyExc_ValueError,
  1384. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  1385. default_encoding_c);
  1386. goto bad;
  1387. }
  1388. Py_DECREF(ascii_chars_u);
  1389. Py_DECREF(ascii_chars_b);
  1390. }
  1391. Py_DECREF(default_encoding);
  1392. return 0;
  1393. bad:
  1394. Py_XDECREF(default_encoding);
  1395. Py_XDECREF(ascii_chars_u);
  1396. Py_XDECREF(ascii_chars_b);
  1397. return -1;
  1398. }
  1399. #endif
  1400. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  1401. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1402. #else
  1403. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1404. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  1405. #include <string.h>
  1406. static char* __PYX_DEFAULT_STRING_ENCODING;
  1407. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  1408. PyObject* sys;
  1409. PyObject* default_encoding = NULL;
  1410. char* default_encoding_c;
  1411. sys = PyImport_ImportModule("sys");
  1412. if (!sys) goto bad;
  1413. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  1414. Py_DECREF(sys);
  1415. if (!default_encoding) goto bad;
  1416. default_encoding_c = PyBytes_AsString(default_encoding);
  1417. if (!default_encoding_c) goto bad;
  1418. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  1419. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  1420. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  1421. Py_DECREF(default_encoding);
  1422. return 0;
  1423. bad:
  1424. Py_XDECREF(default_encoding);
  1425. return -1;
  1426. }
  1427. #endif
  1428. #endif
  1429. /* Test for GCC > 2.95 */
  1430. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1431. #define likely(x) __builtin_expect(!!(x), 1)
  1432. #define unlikely(x) __builtin_expect(!!(x), 0)
  1433. #else /* !__GNUC__ or GCC < 2.95 */
  1434. #define likely(x) (x)
  1435. #define unlikely(x) (x)
  1436. #endif /* __GNUC__ */
  1437. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1438. #if !CYTHON_USE_MODULE_STATE
  1439. static PyObject *__pyx_m = NULL;
  1440. #endif
  1441. static int __pyx_lineno;
  1442. static int __pyx_clineno = 0;
  1443. static const char * __pyx_cfilenm = __FILE__;
  1444. static const char *__pyx_filename;
  1445. /* #### Code section: filename_table ### */
  1446. static const char *__pyx_f[] = {
  1447. "Lib/fontTools/varLib/iup.py",
  1448. };
  1449. /* #### Code section: utility_code_proto_before_types ### */
  1450. /* ForceInitThreads.proto */
  1451. #ifndef __PYX_FORCE_INIT_THREADS
  1452. #define __PYX_FORCE_INIT_THREADS 0
  1453. #endif
  1454. /* #### Code section: numeric_typedefs ### */
  1455. /* #### Code section: complex_type_declarations ### */
  1456. /* #### Code section: type_declarations ### */
  1457. /*--- Type declarations ---*/
  1458. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  1459. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  1460. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  1461. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  1462. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  1463. struct __pyx_defaults;
  1464. typedef struct __pyx_defaults __pyx_defaults;
  1465. struct __pyx_defaults {
  1466. PyObject *__pyx_arg_forced;
  1467. };
  1468. /* "fontTools/varLib/iup.py":165
  1469. *
  1470. *
  1471. * @cython.cfunc # <<<<<<<<<<<<<<
  1472. * @cython.inline
  1473. * @cython.locals(
  1474. */
  1475. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between {
  1476. PyObject_HEAD
  1477. PyObject *__pyx_v_tolerance;
  1478. };
  1479. /* "fontTools/varLib/iup.py":193
  1480. *
  1481. * return all(
  1482. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  1483. * for (x, y), (p, q) in zip(deltas, interp)
  1484. * )
  1485. */
  1486. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr {
  1487. PyObject_HEAD
  1488. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_outer_scope;
  1489. PyObject *__pyx_genexpr_arg_0;
  1490. int __pyx_v_i;
  1491. int __pyx_v_j;
  1492. double __pyx_v_p;
  1493. double __pyx_v_q;
  1494. double __pyx_v_x;
  1495. double __pyx_v_y;
  1496. };
  1497. /* "fontTools/varLib/iup.py":359
  1498. *
  1499. *
  1500. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  1501. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  1502. * ) -> _DeltaOrNoneSegment:
  1503. */
  1504. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize {
  1505. PyObject_HEAD
  1506. PyObject *__pyx_v_d0;
  1507. PyObject *__pyx_v_tolerance;
  1508. };
  1509. /* "fontTools/varLib/iup.py":374
  1510. *
  1511. * # If all are within tolerance distance of 0, encode nothing:
  1512. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  1513. * return [None] * n
  1514. *
  1515. */
  1516. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr {
  1517. PyObject_HEAD
  1518. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1519. PyObject *__pyx_genexpr_arg_0;
  1520. PyObject *__pyx_v_p;
  1521. };
  1522. /* "fontTools/varLib/iup.py":383
  1523. * # If all deltas are exactly the same, return just one (the first one):
  1524. * d0 = deltas[0]
  1525. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  1526. * return [d0] + [None] * (n - 1)
  1527. *
  1528. */
  1529. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr {
  1530. PyObject_HEAD
  1531. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_outer_scope;
  1532. PyObject *__pyx_genexpr_arg_0;
  1533. PyObject *__pyx_v_d;
  1534. };
  1535. /* #### Code section: utility_code_proto ### */
  1536. /* --- Runtime support code (head) --- */
  1537. /* Refnanny.proto */
  1538. #ifndef CYTHON_REFNANNY
  1539. #define CYTHON_REFNANNY 0
  1540. #endif
  1541. #if CYTHON_REFNANNY
  1542. typedef struct {
  1543. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1544. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1545. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1546. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1547. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1548. void (*FinishContext)(void**);
  1549. } __Pyx_RefNannyAPIStruct;
  1550. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1551. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1552. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1553. #ifdef WITH_THREAD
  1554. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1555. if (acquire_gil) {\
  1556. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1557. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1558. PyGILState_Release(__pyx_gilstate_save);\
  1559. } else {\
  1560. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1561. }
  1562. #define __Pyx_RefNannyFinishContextNogil() {\
  1563. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1564. __Pyx_RefNannyFinishContext();\
  1565. PyGILState_Release(__pyx_gilstate_save);\
  1566. }
  1567. #else
  1568. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1569. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
  1570. #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
  1571. #endif
  1572. #define __Pyx_RefNannyFinishContextNogil() {\
  1573. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1574. __Pyx_RefNannyFinishContext();\
  1575. PyGILState_Release(__pyx_gilstate_save);\
  1576. }
  1577. #define __Pyx_RefNannyFinishContext()\
  1578. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1579. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1580. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1581. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1582. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1583. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1584. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1585. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1586. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1587. #else
  1588. #define __Pyx_RefNannyDeclarations
  1589. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1590. #define __Pyx_RefNannyFinishContextNogil()
  1591. #define __Pyx_RefNannyFinishContext()
  1592. #define __Pyx_INCREF(r) Py_INCREF(r)
  1593. #define __Pyx_DECREF(r) Py_DECREF(r)
  1594. #define __Pyx_GOTREF(r)
  1595. #define __Pyx_GIVEREF(r)
  1596. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1597. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1598. #define __Pyx_XGOTREF(r)
  1599. #define __Pyx_XGIVEREF(r)
  1600. #endif
  1601. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1602. PyObject *tmp = (PyObject *) r;\
  1603. r = v; Py_XDECREF(tmp);\
  1604. } while (0)
  1605. #define __Pyx_XDECREF_SET(r, v) do {\
  1606. PyObject *tmp = (PyObject *) r;\
  1607. r = v; __Pyx_XDECREF(tmp);\
  1608. } while (0)
  1609. #define __Pyx_DECREF_SET(r, v) do {\
  1610. PyObject *tmp = (PyObject *) r;\
  1611. r = v; __Pyx_DECREF(tmp);\
  1612. } while (0)
  1613. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1614. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1615. /* PyErrExceptionMatches.proto */
  1616. #if CYTHON_FAST_THREAD_STATE
  1617. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1618. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1619. #else
  1620. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1621. #endif
  1622. /* PyThreadStateGet.proto */
  1623. #if CYTHON_FAST_THREAD_STATE
  1624. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1625. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1626. #if PY_VERSION_HEX >= 0x030C00A6
  1627. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1628. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1629. #else
  1630. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1631. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1632. #endif
  1633. #else
  1634. #define __Pyx_PyThreadState_declare
  1635. #define __Pyx_PyThreadState_assign
  1636. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1637. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1638. #endif
  1639. /* PyErrFetchRestore.proto */
  1640. #if CYTHON_FAST_THREAD_STATE
  1641. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1642. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1643. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1644. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1645. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1646. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1647. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1648. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1649. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1650. #else
  1651. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1652. #endif
  1653. #else
  1654. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1655. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1656. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1657. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1658. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1659. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1660. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1661. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1662. #endif
  1663. /* PyObjectGetAttrStr.proto */
  1664. #if CYTHON_USE_TYPE_SLOTS
  1665. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1666. #else
  1667. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1668. #endif
  1669. /* PyObjectGetAttrStrNoError.proto */
  1670. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1671. /* GetBuiltinName.proto */
  1672. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1673. /* SetItemInt.proto */
  1674. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1675. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1676. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
  1677. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  1678. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  1679. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  1680. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  1681. int is_list, int wraparound, int boundscheck);
  1682. /* GetItemInt.proto */
  1683. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1684. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1685. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1686. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1687. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1688. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1689. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1690. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1691. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1692. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1693. int wraparound, int boundscheck);
  1694. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1695. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1696. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1697. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1698. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1699. int wraparound, int boundscheck);
  1700. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1701. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1702. int is_list, int wraparound, int boundscheck);
  1703. /* ListExtend.proto */
  1704. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1705. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  1706. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1707. if (unlikely(!none))
  1708. return -1;
  1709. Py_DECREF(none);
  1710. return 0;
  1711. #else
  1712. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1713. #endif
  1714. }
  1715. /* ListAppend.proto */
  1716. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1717. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1718. PyListObject* L = (PyListObject*) list;
  1719. Py_ssize_t len = Py_SIZE(list);
  1720. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1721. Py_INCREF(x);
  1722. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1723. L->ob_item[len] = x;
  1724. #else
  1725. PyList_SET_ITEM(list, len, x);
  1726. #endif
  1727. __Pyx_SET_SIZE(list, len + 1);
  1728. return 0;
  1729. }
  1730. return PyList_Append(list, x);
  1731. }
  1732. #else
  1733. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1734. #endif
  1735. /* PyObjectCall.proto */
  1736. #if CYTHON_COMPILING_IN_CPYTHON
  1737. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1738. #else
  1739. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1740. #endif
  1741. /* TupleAndListFromArray.proto */
  1742. #if CYTHON_COMPILING_IN_CPYTHON
  1743. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1744. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1745. #endif
  1746. /* IncludeStringH.proto */
  1747. #include <string.h>
  1748. /* BytesEquals.proto */
  1749. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1750. /* UnicodeEquals.proto */
  1751. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1752. /* fastcall.proto */
  1753. #if CYTHON_AVOID_BORROWED_REFS
  1754. #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
  1755. #elif CYTHON_ASSUME_SAFE_MACROS
  1756. #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
  1757. #else
  1758. #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
  1759. #endif
  1760. #if CYTHON_AVOID_BORROWED_REFS
  1761. #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
  1762. #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
  1763. #else
  1764. #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op
  1765. #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed
  1766. #endif
  1767. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1768. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1769. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1770. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1771. #if CYTHON_METH_FASTCALL
  1772. #define __Pyx_Arg_FASTCALL(args, i) args[i]
  1773. #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
  1774. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1775. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1776. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1777. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1778. #else
  1779. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1780. #endif
  1781. #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs
  1782. #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array
  1783. #else
  1784. #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
  1785. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1786. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1787. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1788. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1789. #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
  1790. #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
  1791. #endif
  1792. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  1793. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
  1794. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
  1795. #else
  1796. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1797. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1798. #endif
  1799. /* RaiseArgTupleInvalid.proto */
  1800. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1801. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1802. /* RaiseDoubleKeywords.proto */
  1803. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1804. /* ParseKeywords.proto */
  1805. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
  1806. PyObject **argnames[],
  1807. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
  1808. const char* function_name);
  1809. /* AssertionsEnabled.proto */
  1810. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  1811. #define __Pyx_init_assertions_enabled() (0)
  1812. #define __pyx_assertions_enabled() (1)
  1813. #elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000)
  1814. static int __pyx_assertions_enabled_flag;
  1815. #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
  1816. static int __Pyx_init_assertions_enabled(void) {
  1817. PyObject *builtins, *debug, *debug_str;
  1818. int flag;
  1819. builtins = PyEval_GetBuiltins();
  1820. if (!builtins) goto bad;
  1821. debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
  1822. if (!debug_str) goto bad;
  1823. debug = PyObject_GetItem(builtins, debug_str);
  1824. Py_DECREF(debug_str);
  1825. if (!debug) goto bad;
  1826. flag = PyObject_IsTrue(debug);
  1827. Py_DECREF(debug);
  1828. if (flag == -1) goto bad;
  1829. __pyx_assertions_enabled_flag = flag;
  1830. return 0;
  1831. bad:
  1832. __pyx_assertions_enabled_flag = 1;
  1833. return -1;
  1834. }
  1835. #else
  1836. #define __Pyx_init_assertions_enabled() (0)
  1837. #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
  1838. #endif
  1839. /* RaiseException.proto */
  1840. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1841. /* PySequenceContains.proto */
  1842. static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
  1843. int result = PySequence_Contains(seq, item);
  1844. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  1845. }
  1846. /* PyIntBinop.proto */
  1847. #if !CYTHON_COMPILING_IN_PYPY
  1848. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1849. #else
  1850. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1851. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1852. #endif
  1853. /* ListCompAppend.proto */
  1854. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1855. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1856. PyListObject* L = (PyListObject*) list;
  1857. Py_ssize_t len = Py_SIZE(list);
  1858. if (likely(L->allocated > len)) {
  1859. Py_INCREF(x);
  1860. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  1861. L->ob_item[len] = x;
  1862. #else
  1863. PyList_SET_ITEM(list, len, x);
  1864. #endif
  1865. __Pyx_SET_SIZE(list, len + 1);
  1866. return 0;
  1867. }
  1868. return PyList_Append(list, x);
  1869. }
  1870. #else
  1871. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  1872. #endif
  1873. /* IterNext.proto */
  1874. #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
  1875. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
  1876. /* PyIntCompare.proto */
  1877. static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  1878. /* SliceObject.proto */
  1879. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  1880. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  1881. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  1882. int has_cstart, int has_cstop, int wraparound);
  1883. /* PyFunctionFastCall.proto */
  1884. #if CYTHON_FAST_PYCALL
  1885. #if !CYTHON_VECTORCALL
  1886. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1887. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1888. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
  1889. #endif
  1890. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1891. (sizeof(char [1 - 2*!(cond)]) - 1)
  1892. #ifndef Py_MEMBER_SIZE
  1893. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1894. #endif
  1895. #if !CYTHON_VECTORCALL
  1896. #if PY_VERSION_HEX >= 0x03080000
  1897. #include "frameobject.h"
  1898. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  1899. #ifndef Py_BUILD_CORE
  1900. #define Py_BUILD_CORE 1
  1901. #endif
  1902. #include "internal/pycore_frame.h"
  1903. #endif
  1904. #define __Pxy_PyFrame_Initialize_Offsets()
  1905. #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
  1906. #else
  1907. static size_t __pyx_pyframe_localsplus_offset = 0;
  1908. #include "frameobject.h"
  1909. #define __Pxy_PyFrame_Initialize_Offsets()\
  1910. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1911. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1912. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1913. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1914. #endif
  1915. #endif
  1916. #endif
  1917. /* PyObjectCallMethO.proto */
  1918. #if CYTHON_COMPILING_IN_CPYTHON
  1919. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1920. #endif
  1921. /* PyObjectFastCall.proto */
  1922. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1923. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
  1924. /* PyObjectCallOneArg.proto */
  1925. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1926. /* ObjectGetItem.proto */
  1927. #if CYTHON_USE_TYPE_SLOTS
  1928. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  1929. #else
  1930. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  1931. #endif
  1932. /* PyIntBinop.proto */
  1933. #if !CYTHON_COMPILING_IN_PYPY
  1934. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1935. #else
  1936. #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
  1937. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  1938. #endif
  1939. /* PyDictVersioning.proto */
  1940. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1941. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1942. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1943. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1944. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1945. (cache_var) = (value);
  1946. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1947. static PY_UINT64_T __pyx_dict_version = 0;\
  1948. static PyObject *__pyx_dict_cached_value = NULL;\
  1949. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1950. (VAR) = __pyx_dict_cached_value;\
  1951. } else {\
  1952. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1953. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1954. }\
  1955. }
  1956. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1957. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1958. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1959. #else
  1960. #define __PYX_GET_DICT_VERSION(dict) (0)
  1961. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1962. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1963. #endif
  1964. /* GetModuleGlobalName.proto */
  1965. #if CYTHON_USE_DICT_VERSIONS
  1966. #define __Pyx_GetModuleGlobalName(var, name) do {\
  1967. static PY_UINT64_T __pyx_dict_version = 0;\
  1968. static PyObject *__pyx_dict_cached_value = NULL;\
  1969. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1970. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1971. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1972. } while(0)
  1973. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  1974. PY_UINT64_T __pyx_dict_version;\
  1975. PyObject *__pyx_dict_cached_value;\
  1976. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1977. } while(0)
  1978. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1979. #else
  1980. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1981. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1982. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1983. #endif
  1984. /* RaiseUnboundLocalError.proto */
  1985. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1986. /* RaiseTooManyValuesToUnpack.proto */
  1987. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1988. /* RaiseNeedMoreValuesToUnpack.proto */
  1989. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1990. /* IterFinish.proto */
  1991. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1992. /* UnpackItemEndCheck.proto */
  1993. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1994. /* py_abs.proto */
  1995. #if CYTHON_USE_PYLONG_INTERNALS
  1996. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  1997. #define __Pyx_PyNumber_Absolute(x)\
  1998. ((likely(PyLong_CheckExact(x))) ?\
  1999. (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
  2000. PyNumber_Absolute(x))
  2001. #else
  2002. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  2003. #endif
  2004. /* RaiseClosureNameError.proto */
  2005. static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
  2006. /* GetException.proto */
  2007. #if CYTHON_FAST_THREAD_STATE
  2008. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  2009. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2010. #else
  2011. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  2012. #endif
  2013. /* pep479.proto */
  2014. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  2015. /* ArgTypeTest.proto */
  2016. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  2017. ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  2018. __Pyx__ArgTypeTest(obj, type, name, exact))
  2019. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  2020. /* DictGetItem.proto */
  2021. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  2022. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  2023. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  2024. (likely(PyDict_CheckExact(obj)) ?\
  2025. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  2026. #else
  2027. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  2028. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  2029. #endif
  2030. /* pyfrozenset_new.proto */
  2031. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2032. /* PySetContains.proto */
  2033. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2034. /* RaiseUnexpectedTypeError.proto */
  2035. static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
  2036. /* SliceTupleAndList.proto */
  2037. #if CYTHON_COMPILING_IN_CPYTHON
  2038. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2039. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
  2040. #else
  2041. #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2042. #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
  2043. #endif
  2044. /* set_iter.proto */
  2045. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  2046. Py_ssize_t* p_orig_length, int* p_source_is_set);
  2047. static CYTHON_INLINE int __Pyx_set_iter_next(
  2048. PyObject* iter_obj, Py_ssize_t orig_length,
  2049. Py_ssize_t* ppos, PyObject **value,
  2050. int source_is_set);
  2051. /* PyIntCompare.proto */
  2052. static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2053. /* py_set_remove.proto */
  2054. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key);
  2055. /* IncludeStructmemberH.proto */
  2056. #include <structmember.h>
  2057. /* FixUpExtensionType.proto */
  2058. #if CYTHON_USE_TYPE_SPECS
  2059. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2060. #endif
  2061. /* PyObjectCallNoArg.proto */
  2062. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  2063. /* PyObjectGetMethod.proto */
  2064. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2065. /* PyObjectCallMethod0.proto */
  2066. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2067. /* ValidateBasesTuple.proto */
  2068. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2069. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2070. #endif
  2071. /* PyType_Ready.proto */
  2072. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2073. /* PyObject_GenericGetAttrNoDict.proto */
  2074. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  2075. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  2076. #else
  2077. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  2078. #endif
  2079. /* GetTopmostException.proto */
  2080. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2081. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2082. #endif
  2083. /* SaveResetException.proto */
  2084. #if CYTHON_FAST_THREAD_STATE
  2085. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2086. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2087. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2088. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2089. #else
  2090. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2091. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2092. #endif
  2093. /* FastTypeChecks.proto */
  2094. #if CYTHON_COMPILING_IN_CPYTHON
  2095. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2096. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2097. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2098. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2099. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2100. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2101. #else
  2102. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2103. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2104. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2105. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  2106. #endif
  2107. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2108. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2109. /* Import.proto */
  2110. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  2111. /* ImportFrom.proto */
  2112. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2113. /* FetchSharedCythonModule.proto */
  2114. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2115. /* FetchCommonType.proto */
  2116. #if !CYTHON_USE_TYPE_SPECS
  2117. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  2118. #else
  2119. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
  2120. #endif
  2121. /* PyMethodNew.proto */
  2122. #if CYTHON_COMPILING_IN_LIMITED_API
  2123. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  2124. PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
  2125. CYTHON_UNUSED_VAR(typ);
  2126. if (!self)
  2127. return __Pyx_NewRef(func);
  2128. typesModule = PyImport_ImportModule("types");
  2129. if (!typesModule) return NULL;
  2130. methodType = PyObject_GetAttrString(typesModule, "MethodType");
  2131. Py_DECREF(typesModule);
  2132. if (!methodType) return NULL;
  2133. result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
  2134. Py_DECREF(methodType);
  2135. return result;
  2136. }
  2137. #elif PY_MAJOR_VERSION >= 3
  2138. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  2139. CYTHON_UNUSED_VAR(typ);
  2140. if (!self)
  2141. return __Pyx_NewRef(func);
  2142. return PyMethod_New(func, self);
  2143. }
  2144. #else
  2145. #define __Pyx_PyMethod_New PyMethod_New
  2146. #endif
  2147. /* PyVectorcallFastCallDict.proto */
  2148. #if CYTHON_METH_FASTCALL
  2149. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2150. #endif
  2151. /* CythonFunctionShared.proto */
  2152. #define __Pyx_CyFunction_USED
  2153. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2154. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2155. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2156. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2157. #define __Pyx_CyFunction_GetClosure(f)\
  2158. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2159. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2160. #define __Pyx_CyFunction_GetClassObj(f)\
  2161. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2162. #else
  2163. #define __Pyx_CyFunction_GetClassObj(f)\
  2164. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2165. #endif
  2166. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2167. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2168. #define __Pyx_CyFunction_Defaults(type, f)\
  2169. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2170. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2171. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2172. typedef struct {
  2173. #if CYTHON_COMPILING_IN_LIMITED_API
  2174. PyObject_HEAD
  2175. PyObject *func;
  2176. #elif PY_VERSION_HEX < 0x030900B1
  2177. PyCFunctionObject func;
  2178. #else
  2179. PyCMethodObject func;
  2180. #endif
  2181. #if CYTHON_BACKPORT_VECTORCALL
  2182. __pyx_vectorcallfunc func_vectorcall;
  2183. #endif
  2184. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  2185. PyObject *func_weakreflist;
  2186. #endif
  2187. PyObject *func_dict;
  2188. PyObject *func_name;
  2189. PyObject *func_qualname;
  2190. PyObject *func_doc;
  2191. PyObject *func_globals;
  2192. PyObject *func_code;
  2193. PyObject *func_closure;
  2194. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2195. PyObject *func_classobj;
  2196. #endif
  2197. void *defaults;
  2198. int defaults_pyobjects;
  2199. size_t defaults_size; // used by FusedFunction for copying defaults
  2200. int flags;
  2201. PyObject *defaults_tuple;
  2202. PyObject *defaults_kwdict;
  2203. PyObject *(*defaults_getter)(PyObject *);
  2204. PyObject *func_annotations;
  2205. PyObject *func_is_coroutine;
  2206. } __pyx_CyFunctionObject;
  2207. #undef __Pyx_CyOrPyCFunction_Check
  2208. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
  2209. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
  2210. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
  2211. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
  2212. #undef __Pyx_IsSameCFunction
  2213. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2214. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2215. int flags, PyObject* qualname,
  2216. PyObject *closure,
  2217. PyObject *module, PyObject *globals,
  2218. PyObject* code);
  2219. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2220. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  2221. size_t size,
  2222. int pyobjects);
  2223. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2224. PyObject *tuple);
  2225. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2226. PyObject *dict);
  2227. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2228. PyObject *dict);
  2229. static int __pyx_CyFunction_init(PyObject *module);
  2230. #if CYTHON_METH_FASTCALL
  2231. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2232. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2233. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2234. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2235. #if CYTHON_BACKPORT_VECTORCALL
  2236. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2237. #else
  2238. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2239. #endif
  2240. #endif
  2241. /* CythonFunction.proto */
  2242. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2243. int flags, PyObject* qualname,
  2244. PyObject *closure,
  2245. PyObject *module, PyObject *globals,
  2246. PyObject* code);
  2247. /* CLineInTraceback.proto */
  2248. #ifdef CYTHON_CLINE_IN_TRACEBACK
  2249. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2250. #else
  2251. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2252. #endif
  2253. /* CodeObjectCache.proto */
  2254. #if !CYTHON_COMPILING_IN_LIMITED_API
  2255. typedef struct {
  2256. PyCodeObject* code_object;
  2257. int code_line;
  2258. } __Pyx_CodeObjectCacheEntry;
  2259. struct __Pyx_CodeObjectCache {
  2260. int count;
  2261. int max_count;
  2262. __Pyx_CodeObjectCacheEntry* entries;
  2263. };
  2264. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  2265. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2266. static PyCodeObject *__pyx_find_code_object(int code_line);
  2267. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  2268. #endif
  2269. /* AddTraceback.proto */
  2270. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2271. int py_line, const char *filename);
  2272. /* GCCDiagnostics.proto */
  2273. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2274. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2275. #endif
  2276. /* CIntFromPy.proto */
  2277. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  2278. /* CIntToPy.proto */
  2279. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  2280. /* CIntToPy.proto */
  2281. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  2282. /* CIntFromPy.proto */
  2283. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  2284. /* FormatTypeName.proto */
  2285. #if CYTHON_COMPILING_IN_LIMITED_API
  2286. typedef PyObject *__Pyx_TypeName;
  2287. #define __Pyx_FMT_TYPENAME "%U"
  2288. static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
  2289. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2290. #else
  2291. typedef const char *__Pyx_TypeName;
  2292. #define __Pyx_FMT_TYPENAME "%.200s"
  2293. #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
  2294. #define __Pyx_DECREF_TypeName(obj)
  2295. #endif
  2296. /* SwapException.proto */
  2297. #if CYTHON_FAST_THREAD_STATE
  2298. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2299. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2300. #else
  2301. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2302. #endif
  2303. /* PyObjectCall2Args.proto */
  2304. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2305. /* PyObjectCallMethod1.proto */
  2306. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2307. /* CoroutineBase.proto */
  2308. struct __pyx_CoroutineObject;
  2309. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2310. #if CYTHON_USE_EXC_INFO_STACK
  2311. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2312. #else
  2313. typedef struct {
  2314. PyObject *exc_type;
  2315. PyObject *exc_value;
  2316. PyObject *exc_traceback;
  2317. } __Pyx_ExcInfoStruct;
  2318. #endif
  2319. typedef struct __pyx_CoroutineObject {
  2320. PyObject_HEAD
  2321. __pyx_coroutine_body_t body;
  2322. PyObject *closure;
  2323. __Pyx_ExcInfoStruct gi_exc_state;
  2324. PyObject *gi_weakreflist;
  2325. PyObject *classobj;
  2326. PyObject *yieldfrom;
  2327. PyObject *gi_name;
  2328. PyObject *gi_qualname;
  2329. PyObject *gi_modulename;
  2330. PyObject *gi_code;
  2331. PyObject *gi_frame;
  2332. int resume_label;
  2333. char is_running;
  2334. } __pyx_CoroutineObject;
  2335. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2336. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2337. PyObject *name, PyObject *qualname, PyObject *module_name);
  2338. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2339. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2340. PyObject *name, PyObject *qualname, PyObject *module_name);
  2341. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2342. static int __Pyx_Coroutine_clear(PyObject *self);
  2343. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2344. static PyObject *__Pyx_Coroutine_Close(PyObject *self);
  2345. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2346. #if CYTHON_USE_EXC_INFO_STACK
  2347. #define __Pyx_Coroutine_SwapException(self)
  2348. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2349. #else
  2350. #define __Pyx_Coroutine_SwapException(self) {\
  2351. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2352. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2353. }
  2354. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2355. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2356. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2357. }
  2358. #endif
  2359. #if CYTHON_FAST_THREAD_STATE
  2360. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2361. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2362. #else
  2363. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2364. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2365. #endif
  2366. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2367. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2368. /* PatchModuleWithCoroutine.proto */
  2369. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
  2370. /* PatchGeneratorABC.proto */
  2371. static int __Pyx_patch_abc(void);
  2372. /* Generator.proto */
  2373. #define __Pyx_Generator_USED
  2374. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_GeneratorType)
  2375. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2376. __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2377. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2378. static int __pyx_Generator_init(PyObject *module);
  2379. /* CheckBinaryVersion.proto */
  2380. static unsigned long __Pyx_get_runtime_version(void);
  2381. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2382. /* InitStrings.proto */
  2383. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  2384. /* #### Code section: module_declarations ### */
  2385. /* Module declarations from "cython" */
  2386. /* Module declarations from "fontTools.varLib.iup" */
  2387. static PyObject *__pyx_f_9fontTools_6varLib_3iup_iup_segment(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
  2388. static CYTHON_INLINE int __pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *, PyObject *, int, int, PyObject *); /*proto*/
  2389. /* #### Code section: typeinfo ### */
  2390. /* #### Code section: before_global_var ### */
  2391. #define __Pyx_MODULE_NAME "fontTools.varLib.iup"
  2392. extern int __pyx_module_is_main_fontTools__varLib__iup;
  2393. int __pyx_module_is_main_fontTools__varLib__iup = 0;
  2394. /* Implementation of "fontTools.varLib.iup" */
  2395. /* #### Code section: global_var ### */
  2396. static PyObject *__pyx_builtin_AttributeError;
  2397. static PyObject *__pyx_builtin_ImportError;
  2398. static PyObject *__pyx_builtin_zip;
  2399. static PyObject *__pyx_builtin_AssertionError;
  2400. static PyObject *__pyx_builtin_enumerate;
  2401. static PyObject *__pyx_builtin_range;
  2402. static PyObject *__pyx_builtin_max;
  2403. /* #### Code section: string_decls ### */
  2404. static const char __pyx_k_c[] = "c";
  2405. static const char __pyx_k_d[] = "d";
  2406. static const char __pyx_k_i[] = "i";
  2407. static const char __pyx_k_j[] = "j";
  2408. static const char __pyx_k_k[] = "k";
  2409. static const char __pyx_k_l[] = "l";
  2410. static const char __pyx_k_n[] = "n";
  2411. static const char __pyx_k_s[] = "s";
  2412. static const char __pyx_k_v[] = "v";
  2413. static const char __pyx_k__3[] = ".";
  2414. static const char __pyx_k_c1[] = "c1";
  2415. static const char __pyx_k_c2[] = "c2";
  2416. static const char __pyx_k_cj[] = "cj";
  2417. static const char __pyx_k_d0[] = "d0";
  2418. static const char __pyx_k_d1[] = "d1";
  2419. static const char __pyx_k_d2[] = "d2";
  2420. static const char __pyx_k_dj[] = "dj";
  2421. static const char __pyx_k_gc[] = "gc";
  2422. static const char __pyx_k_i1[] = "i1";
  2423. static const char __pyx_k_i2[] = "i2";
  2424. static const char __pyx_k_it[] = "it";
  2425. static const char __pyx_k_lc[] = "lc";
  2426. static const char __pyx_k_ld[] = "ld";
  2427. static const char __pyx_k_nc[] = "nc";
  2428. static const char __pyx_k_nd[] = "nd";
  2429. static const char __pyx_k__22[] = "?";
  2430. static const char __pyx_k_end[] = "end";
  2431. static const char __pyx_k_int[] = "int";
  2432. static const char __pyx_k_lcj[] = "lcj";
  2433. static const char __pyx_k_ldj[] = "ldj";
  2434. static const char __pyx_k_max[] = "max";
  2435. static const char __pyx_k_ncj[] = "ncj";
  2436. static const char __pyx_k_ndj[] = "ndj";
  2437. static const char __pyx_k_out[] = "out";
  2438. static const char __pyx_k_ri1[] = "ri1";
  2439. static const char __pyx_k_ri2[] = "ri2";
  2440. static const char __pyx_k_set[] = "set";
  2441. static const char __pyx_k_zip[] = "zip";
  2442. static const char __pyx_k_Real[] = "Real";
  2443. static const char __pyx_k_args[] = "args";
  2444. static const char __pyx_k_cost[] = "cost";
  2445. static const char __pyx_k_ends[] = "ends";
  2446. static const char __pyx_k_list[] = "list";
  2447. static const char __pyx_k_main[] = "__main__";
  2448. static const char __pyx_k_name[] = "__name__";
  2449. static const char __pyx_k_send[] = "send";
  2450. static const char __pyx_k_test[] = "__test__";
  2451. static const char __pyx_k_Delta[] = "_Delta";
  2452. static const char __pyx_k_Point[] = "_Point";
  2453. static const char __pyx_k_Tuple[] = "Tuple";
  2454. static const char __pyx_k_Union[] = "Union";
  2455. static const char __pyx_k_chain[] = "chain";
  2456. static const char __pyx_k_close[] = "close";
  2457. static const char __pyx_k_costs[] = "costs";
  2458. static const char __pyx_k_force[] = "force";
  2459. static const char __pyx_k_range[] = "range";
  2460. static const char __pyx_k_start[] = "start";
  2461. static const char __pyx_k_throw[] = "throw";
  2462. static const char __pyx_k_best_j[] = "best_j";
  2463. static const char __pyx_k_coords[] = "coords";
  2464. static const char __pyx_k_cython[] = "cython";
  2465. static const char __pyx_k_deltas[] = "deltas";
  2466. static const char __pyx_k_enable[] = "enable";
  2467. static const char __pyx_k_forced[] = "forced";
  2468. static const char __pyx_k_import[] = "__import__";
  2469. static const char __pyx_k_return[] = "return";
  2470. static const char __pyx_k_typing[] = "typing";
  2471. static const char __pyx_k_contour[] = "contour";
  2472. static const char __pyx_k_disable[] = "disable";
  2473. static const char __pyx_k_genexpr[] = "genexpr";
  2474. static const char __pyx_k_indices[] = "indices";
  2475. static const char __pyx_k_numbers[] = "numbers";
  2476. static const char __pyx_k_rot_set[] = "_rot_set";
  2477. static const char __pyx_k_COMPILED[] = "COMPILED";
  2478. static const char __pyx_k_Integral[] = "Integral";
  2479. static const char __pyx_k_Sequence[] = "Sequence";
  2480. static const char __pyx_k_best_sol[] = "best_sol";
  2481. static const char __pyx_k_lookback[] = "lookback";
  2482. static const char __pyx_k_rot_list[] = "_rot_list";
  2483. static const char __pyx_k_solution[] = "solution";
  2484. static const char __pyx_k_Endpoints[] = "_Endpoints";
  2485. static const char __pyx_k_best_cost[] = "best_cost";
  2486. static const char __pyx_k_enumerate[] = "enumerate";
  2487. static const char __pyx_k_isenabled[] = "isenabled";
  2488. static const char __pyx_k_iup_delta[] = "iup_delta";
  2489. static const char __pyx_k_tolerance[] = "tolerance";
  2490. static const char __pyx_k_DeltaOrNone[] = "_DeltaOrNone";
  2491. static const char __pyx_k_ImportError[] = "ImportError";
  2492. static const char __pyx_k_iup_contour[] = "iup_contour";
  2493. static const char __pyx_k_DeltaSegment[] = "_DeltaSegment";
  2494. static const char __pyx_k_MAX_LOOKBACK[] = "MAX_LOOKBACK";
  2495. static const char __pyx_k_PointSegment[] = "_PointSegment";
  2496. static const char __pyx_k_is_coroutine[] = "_is_coroutine";
  2497. static const char __pyx_k_class_getitem[] = "__class_getitem__";
  2498. static const char __pyx_k_AssertionError[] = "AssertionError";
  2499. static const char __pyx_k_AttributeError[] = "AttributeError";
  2500. static const char __pyx_k_fontTools_misc[] = "fontTools.misc";
  2501. static const char __pyx_k_DeltaOrNoneSegment[] = "_DeltaOrNoneSegment";
  2502. static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
  2503. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  2504. static const char __pyx_k_iup_delta_optimize[] = "iup_delta_optimize";
  2505. static const char __pyx_k_fontTools_varLib_iup[] = "fontTools.varLib.iup";
  2506. static const char __pyx_k_iup_contour_optimize[] = "iup_contour_optimize";
  2507. static const char __pyx_k_iup_contour_optimize_dp[] = "_iup_contour_optimize_dp";
  2508. static const char __pyx_k_Lib_fontTools_varLib_iup_py[] = "Lib/fontTools/varLib/iup.py";
  2509. static const char __pyx_k_iup_contour_bound_forced_set[] = "_iup_contour_bound_forced_set";
  2510. static const char __pyx_k_can_iup_in_between_locals_genexp[] = "can_iup_in_between.<locals>.genexpr";
  2511. static const char __pyx_k_iup_contour_optimize_locals_gene[] = "iup_contour_optimize.<locals>.genexpr";
  2512. /* #### Code section: decls ### */
  2513. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords); /* proto */
  2514. 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 */
  2515. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2516. 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 */
  2517. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2518. 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 */
  2519. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k); /* proto */
  2520. 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 */
  2521. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2522. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2523. 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 */
  2524. 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 */
  2525. 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*/
  2526. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2527. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2528. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2529. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2530. /* #### Code section: late_includes ### */
  2531. /* #### Code section: module_state ### */
  2532. typedef struct {
  2533. PyObject *__pyx_d;
  2534. PyObject *__pyx_b;
  2535. PyObject *__pyx_cython_runtime;
  2536. PyObject *__pyx_empty_tuple;
  2537. PyObject *__pyx_empty_bytes;
  2538. PyObject *__pyx_empty_unicode;
  2539. #ifdef __Pyx_CyFunction_USED
  2540. PyTypeObject *__pyx_CyFunctionType;
  2541. #endif
  2542. #ifdef __Pyx_FusedFunction_USED
  2543. PyTypeObject *__pyx_FusedFunctionType;
  2544. #endif
  2545. #ifdef __Pyx_Generator_USED
  2546. PyTypeObject *__pyx_GeneratorType;
  2547. #endif
  2548. #ifdef __Pyx_IterableCoroutine_USED
  2549. PyTypeObject *__pyx_IterableCoroutineType;
  2550. #endif
  2551. #ifdef __Pyx_Coroutine_USED
  2552. PyTypeObject *__pyx_CoroutineAwaitType;
  2553. #endif
  2554. #ifdef __Pyx_Coroutine_USED
  2555. PyTypeObject *__pyx_CoroutineType;
  2556. #endif
  2557. #if CYTHON_USE_MODULE_STATE
  2558. #endif
  2559. #if CYTHON_USE_MODULE_STATE
  2560. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2561. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2562. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2563. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2564. PyObject *__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2565. #endif
  2566. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between;
  2567. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  2568. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  2569. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  2570. PyTypeObject *__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  2571. PyObject *__pyx_n_s_AssertionError;
  2572. PyObject *__pyx_n_s_AttributeError;
  2573. PyObject *__pyx_n_s_COMPILED;
  2574. PyObject *__pyx_n_s_Delta;
  2575. PyObject *__pyx_n_s_DeltaOrNone;
  2576. PyObject *__pyx_n_s_DeltaOrNoneSegment;
  2577. PyObject *__pyx_n_s_DeltaSegment;
  2578. PyObject *__pyx_n_s_Endpoints;
  2579. PyObject *__pyx_n_s_ImportError;
  2580. PyObject *__pyx_n_s_Integral;
  2581. PyObject *__pyx_kp_s_Lib_fontTools_varLib_iup_py;
  2582. PyObject *__pyx_n_s_MAX_LOOKBACK;
  2583. PyObject *__pyx_n_s_Point;
  2584. PyObject *__pyx_n_s_PointSegment;
  2585. PyObject *__pyx_n_s_Real;
  2586. PyObject *__pyx_n_s_Sequence;
  2587. PyObject *__pyx_n_s_Tuple;
  2588. PyObject *__pyx_n_s_Union;
  2589. PyObject *__pyx_n_s__22;
  2590. PyObject *__pyx_kp_u__3;
  2591. PyObject *__pyx_n_s_args;
  2592. PyObject *__pyx_n_s_asyncio_coroutines;
  2593. PyObject *__pyx_n_s_best_cost;
  2594. PyObject *__pyx_n_s_best_j;
  2595. PyObject *__pyx_n_s_best_sol;
  2596. PyObject *__pyx_n_s_c;
  2597. PyObject *__pyx_n_s_c1;
  2598. PyObject *__pyx_n_s_c2;
  2599. PyObject *__pyx_n_s_can_iup_in_between_locals_genexp;
  2600. PyObject *__pyx_n_s_chain;
  2601. PyObject *__pyx_n_s_cj;
  2602. PyObject *__pyx_n_s_class_getitem;
  2603. PyObject *__pyx_n_s_cline_in_traceback;
  2604. PyObject *__pyx_n_s_close;
  2605. PyObject *__pyx_n_s_contour;
  2606. PyObject *__pyx_n_s_coords;
  2607. PyObject *__pyx_n_s_cost;
  2608. PyObject *__pyx_n_s_costs;
  2609. PyObject *__pyx_n_s_cython;
  2610. PyObject *__pyx_n_s_d;
  2611. PyObject *__pyx_n_s_d0;
  2612. PyObject *__pyx_n_s_d1;
  2613. PyObject *__pyx_n_s_d2;
  2614. PyObject *__pyx_n_s_deltas;
  2615. PyObject *__pyx_kp_u_disable;
  2616. PyObject *__pyx_n_s_dj;
  2617. PyObject *__pyx_kp_u_enable;
  2618. PyObject *__pyx_n_s_end;
  2619. PyObject *__pyx_n_s_ends;
  2620. PyObject *__pyx_n_s_enumerate;
  2621. PyObject *__pyx_n_s_fontTools_misc;
  2622. PyObject *__pyx_n_s_fontTools_varLib_iup;
  2623. PyObject *__pyx_n_s_force;
  2624. PyObject *__pyx_n_s_forced;
  2625. PyObject *__pyx_kp_u_gc;
  2626. PyObject *__pyx_n_s_genexpr;
  2627. PyObject *__pyx_n_s_i;
  2628. PyObject *__pyx_n_s_i1;
  2629. PyObject *__pyx_n_s_i2;
  2630. PyObject *__pyx_n_s_import;
  2631. PyObject *__pyx_n_s_indices;
  2632. PyObject *__pyx_n_s_int;
  2633. PyObject *__pyx_n_s_is_coroutine;
  2634. PyObject *__pyx_kp_u_isenabled;
  2635. PyObject *__pyx_n_s_it;
  2636. PyObject *__pyx_n_s_iup_contour;
  2637. PyObject *__pyx_n_s_iup_contour_bound_forced_set;
  2638. PyObject *__pyx_n_s_iup_contour_optimize;
  2639. PyObject *__pyx_n_s_iup_contour_optimize_dp;
  2640. PyObject *__pyx_n_s_iup_contour_optimize_locals_gene;
  2641. PyObject *__pyx_n_s_iup_delta;
  2642. PyObject *__pyx_n_s_iup_delta_optimize;
  2643. PyObject *__pyx_n_s_j;
  2644. PyObject *__pyx_n_s_k;
  2645. PyObject *__pyx_n_s_l;
  2646. PyObject *__pyx_n_s_lc;
  2647. PyObject *__pyx_n_s_lcj;
  2648. PyObject *__pyx_n_s_ld;
  2649. PyObject *__pyx_n_s_ldj;
  2650. PyObject *__pyx_n_s_list;
  2651. PyObject *__pyx_n_s_lookback;
  2652. PyObject *__pyx_n_s_main;
  2653. PyObject *__pyx_n_s_max;
  2654. PyObject *__pyx_n_s_n;
  2655. PyObject *__pyx_n_s_name;
  2656. PyObject *__pyx_n_s_nc;
  2657. PyObject *__pyx_n_s_ncj;
  2658. PyObject *__pyx_n_s_nd;
  2659. PyObject *__pyx_n_s_ndj;
  2660. PyObject *__pyx_n_s_numbers;
  2661. PyObject *__pyx_n_s_out;
  2662. PyObject *__pyx_n_s_range;
  2663. PyObject *__pyx_n_s_return;
  2664. PyObject *__pyx_n_s_ri1;
  2665. PyObject *__pyx_n_s_ri2;
  2666. PyObject *__pyx_n_s_rot_list;
  2667. PyObject *__pyx_n_s_rot_set;
  2668. PyObject *__pyx_n_s_s;
  2669. PyObject *__pyx_n_s_send;
  2670. PyObject *__pyx_n_s_set;
  2671. PyObject *__pyx_n_s_solution;
  2672. PyObject *__pyx_n_s_start;
  2673. PyObject *__pyx_n_s_test;
  2674. PyObject *__pyx_n_s_throw;
  2675. PyObject *__pyx_n_s_tolerance;
  2676. PyObject *__pyx_n_s_typing;
  2677. PyObject *__pyx_n_s_v;
  2678. PyObject *__pyx_n_s_zip;
  2679. PyObject *__pyx_float_0_0;
  2680. PyObject *__pyx_int_0;
  2681. PyObject *__pyx_int_1;
  2682. PyObject *__pyx_int_2;
  2683. PyObject *__pyx_int_3;
  2684. PyObject *__pyx_int_4;
  2685. PyObject *__pyx_int_8;
  2686. PyObject *__pyx_int_neg_1;
  2687. PyObject *__pyx_tuple_;
  2688. PyObject *__pyx_tuple__2;
  2689. PyObject *__pyx_tuple__4;
  2690. PyObject *__pyx_tuple__6;
  2691. PyObject *__pyx_tuple__8;
  2692. PyObject *__pyx_tuple__10;
  2693. PyObject *__pyx_tuple__11;
  2694. PyObject *__pyx_tuple__13;
  2695. PyObject *__pyx_tuple__15;
  2696. PyObject *__pyx_tuple__17;
  2697. PyObject *__pyx_tuple__19;
  2698. PyObject *__pyx_tuple__20;
  2699. PyObject *__pyx_codeobj__5;
  2700. PyObject *__pyx_codeobj__7;
  2701. PyObject *__pyx_codeobj__9;
  2702. PyObject *__pyx_codeobj__12;
  2703. PyObject *__pyx_codeobj__14;
  2704. PyObject *__pyx_codeobj__16;
  2705. PyObject *__pyx_codeobj__18;
  2706. PyObject *__pyx_codeobj__21;
  2707. } __pyx_mstate;
  2708. #if CYTHON_USE_MODULE_STATE
  2709. #ifdef __cplusplus
  2710. namespace {
  2711. extern struct PyModuleDef __pyx_moduledef;
  2712. } /* anonymous namespace */
  2713. #else
  2714. static struct PyModuleDef __pyx_moduledef;
  2715. #endif
  2716. #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
  2717. #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
  2718. #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
  2719. #else
  2720. static __pyx_mstate __pyx_mstate_global_static =
  2721. #ifdef __cplusplus
  2722. {};
  2723. #else
  2724. {0};
  2725. #endif
  2726. static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
  2727. #endif
  2728. /* #### Code section: module_state_clear ### */
  2729. #if CYTHON_USE_MODULE_STATE
  2730. static int __pyx_m_clear(PyObject *m) {
  2731. __pyx_mstate *clear_module_state = __pyx_mstate(m);
  2732. if (!clear_module_state) return 0;
  2733. Py_CLEAR(clear_module_state->__pyx_d);
  2734. Py_CLEAR(clear_module_state->__pyx_b);
  2735. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  2736. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  2737. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  2738. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  2739. #ifdef __Pyx_CyFunction_USED
  2740. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  2741. #endif
  2742. #ifdef __Pyx_FusedFunction_USED
  2743. Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
  2744. #endif
  2745. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2746. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2747. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2748. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2749. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2750. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2751. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2752. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2753. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2754. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2755. Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError);
  2756. Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError);
  2757. Py_CLEAR(clear_module_state->__pyx_n_s_COMPILED);
  2758. Py_CLEAR(clear_module_state->__pyx_n_s_Delta);
  2759. Py_CLEAR(clear_module_state->__pyx_n_s_DeltaOrNone);
  2760. Py_CLEAR(clear_module_state->__pyx_n_s_DeltaOrNoneSegment);
  2761. Py_CLEAR(clear_module_state->__pyx_n_s_DeltaSegment);
  2762. Py_CLEAR(clear_module_state->__pyx_n_s_Endpoints);
  2763. Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
  2764. Py_CLEAR(clear_module_state->__pyx_n_s_Integral);
  2765. Py_CLEAR(clear_module_state->__pyx_kp_s_Lib_fontTools_varLib_iup_py);
  2766. Py_CLEAR(clear_module_state->__pyx_n_s_MAX_LOOKBACK);
  2767. Py_CLEAR(clear_module_state->__pyx_n_s_Point);
  2768. Py_CLEAR(clear_module_state->__pyx_n_s_PointSegment);
  2769. Py_CLEAR(clear_module_state->__pyx_n_s_Real);
  2770. Py_CLEAR(clear_module_state->__pyx_n_s_Sequence);
  2771. Py_CLEAR(clear_module_state->__pyx_n_s_Tuple);
  2772. Py_CLEAR(clear_module_state->__pyx_n_s_Union);
  2773. Py_CLEAR(clear_module_state->__pyx_n_s__22);
  2774. Py_CLEAR(clear_module_state->__pyx_kp_u__3);
  2775. Py_CLEAR(clear_module_state->__pyx_n_s_args);
  2776. Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
  2777. Py_CLEAR(clear_module_state->__pyx_n_s_best_cost);
  2778. Py_CLEAR(clear_module_state->__pyx_n_s_best_j);
  2779. Py_CLEAR(clear_module_state->__pyx_n_s_best_sol);
  2780. Py_CLEAR(clear_module_state->__pyx_n_s_c);
  2781. Py_CLEAR(clear_module_state->__pyx_n_s_c1);
  2782. Py_CLEAR(clear_module_state->__pyx_n_s_c2);
  2783. Py_CLEAR(clear_module_state->__pyx_n_s_can_iup_in_between_locals_genexp);
  2784. Py_CLEAR(clear_module_state->__pyx_n_s_chain);
  2785. Py_CLEAR(clear_module_state->__pyx_n_s_cj);
  2786. Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
  2787. Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
  2788. Py_CLEAR(clear_module_state->__pyx_n_s_close);
  2789. Py_CLEAR(clear_module_state->__pyx_n_s_contour);
  2790. Py_CLEAR(clear_module_state->__pyx_n_s_coords);
  2791. Py_CLEAR(clear_module_state->__pyx_n_s_cost);
  2792. Py_CLEAR(clear_module_state->__pyx_n_s_costs);
  2793. Py_CLEAR(clear_module_state->__pyx_n_s_cython);
  2794. Py_CLEAR(clear_module_state->__pyx_n_s_d);
  2795. Py_CLEAR(clear_module_state->__pyx_n_s_d0);
  2796. Py_CLEAR(clear_module_state->__pyx_n_s_d1);
  2797. Py_CLEAR(clear_module_state->__pyx_n_s_d2);
  2798. Py_CLEAR(clear_module_state->__pyx_n_s_deltas);
  2799. Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
  2800. Py_CLEAR(clear_module_state->__pyx_n_s_dj);
  2801. Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
  2802. Py_CLEAR(clear_module_state->__pyx_n_s_end);
  2803. Py_CLEAR(clear_module_state->__pyx_n_s_ends);
  2804. Py_CLEAR(clear_module_state->__pyx_n_s_enumerate);
  2805. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_misc);
  2806. Py_CLEAR(clear_module_state->__pyx_n_s_fontTools_varLib_iup);
  2807. Py_CLEAR(clear_module_state->__pyx_n_s_force);
  2808. Py_CLEAR(clear_module_state->__pyx_n_s_forced);
  2809. Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
  2810. Py_CLEAR(clear_module_state->__pyx_n_s_genexpr);
  2811. Py_CLEAR(clear_module_state->__pyx_n_s_i);
  2812. Py_CLEAR(clear_module_state->__pyx_n_s_i1);
  2813. Py_CLEAR(clear_module_state->__pyx_n_s_i2);
  2814. Py_CLEAR(clear_module_state->__pyx_n_s_import);
  2815. Py_CLEAR(clear_module_state->__pyx_n_s_indices);
  2816. Py_CLEAR(clear_module_state->__pyx_n_s_int);
  2817. Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
  2818. Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
  2819. Py_CLEAR(clear_module_state->__pyx_n_s_it);
  2820. Py_CLEAR(clear_module_state->__pyx_n_s_iup_contour);
  2821. Py_CLEAR(clear_module_state->__pyx_n_s_iup_contour_bound_forced_set);
  2822. Py_CLEAR(clear_module_state->__pyx_n_s_iup_contour_optimize);
  2823. Py_CLEAR(clear_module_state->__pyx_n_s_iup_contour_optimize_dp);
  2824. Py_CLEAR(clear_module_state->__pyx_n_s_iup_contour_optimize_locals_gene);
  2825. Py_CLEAR(clear_module_state->__pyx_n_s_iup_delta);
  2826. Py_CLEAR(clear_module_state->__pyx_n_s_iup_delta_optimize);
  2827. Py_CLEAR(clear_module_state->__pyx_n_s_j);
  2828. Py_CLEAR(clear_module_state->__pyx_n_s_k);
  2829. Py_CLEAR(clear_module_state->__pyx_n_s_l);
  2830. Py_CLEAR(clear_module_state->__pyx_n_s_lc);
  2831. Py_CLEAR(clear_module_state->__pyx_n_s_lcj);
  2832. Py_CLEAR(clear_module_state->__pyx_n_s_ld);
  2833. Py_CLEAR(clear_module_state->__pyx_n_s_ldj);
  2834. Py_CLEAR(clear_module_state->__pyx_n_s_list);
  2835. Py_CLEAR(clear_module_state->__pyx_n_s_lookback);
  2836. Py_CLEAR(clear_module_state->__pyx_n_s_main);
  2837. Py_CLEAR(clear_module_state->__pyx_n_s_max);
  2838. Py_CLEAR(clear_module_state->__pyx_n_s_n);
  2839. Py_CLEAR(clear_module_state->__pyx_n_s_name);
  2840. Py_CLEAR(clear_module_state->__pyx_n_s_nc);
  2841. Py_CLEAR(clear_module_state->__pyx_n_s_ncj);
  2842. Py_CLEAR(clear_module_state->__pyx_n_s_nd);
  2843. Py_CLEAR(clear_module_state->__pyx_n_s_ndj);
  2844. Py_CLEAR(clear_module_state->__pyx_n_s_numbers);
  2845. Py_CLEAR(clear_module_state->__pyx_n_s_out);
  2846. Py_CLEAR(clear_module_state->__pyx_n_s_range);
  2847. Py_CLEAR(clear_module_state->__pyx_n_s_return);
  2848. Py_CLEAR(clear_module_state->__pyx_n_s_ri1);
  2849. Py_CLEAR(clear_module_state->__pyx_n_s_ri2);
  2850. Py_CLEAR(clear_module_state->__pyx_n_s_rot_list);
  2851. Py_CLEAR(clear_module_state->__pyx_n_s_rot_set);
  2852. Py_CLEAR(clear_module_state->__pyx_n_s_s);
  2853. Py_CLEAR(clear_module_state->__pyx_n_s_send);
  2854. Py_CLEAR(clear_module_state->__pyx_n_s_set);
  2855. Py_CLEAR(clear_module_state->__pyx_n_s_solution);
  2856. Py_CLEAR(clear_module_state->__pyx_n_s_start);
  2857. Py_CLEAR(clear_module_state->__pyx_n_s_test);
  2858. Py_CLEAR(clear_module_state->__pyx_n_s_throw);
  2859. Py_CLEAR(clear_module_state->__pyx_n_s_tolerance);
  2860. Py_CLEAR(clear_module_state->__pyx_n_s_typing);
  2861. Py_CLEAR(clear_module_state->__pyx_n_s_v);
  2862. Py_CLEAR(clear_module_state->__pyx_n_s_zip);
  2863. Py_CLEAR(clear_module_state->__pyx_float_0_0);
  2864. Py_CLEAR(clear_module_state->__pyx_int_0);
  2865. Py_CLEAR(clear_module_state->__pyx_int_1);
  2866. Py_CLEAR(clear_module_state->__pyx_int_2);
  2867. Py_CLEAR(clear_module_state->__pyx_int_3);
  2868. Py_CLEAR(clear_module_state->__pyx_int_4);
  2869. Py_CLEAR(clear_module_state->__pyx_int_8);
  2870. Py_CLEAR(clear_module_state->__pyx_int_neg_1);
  2871. Py_CLEAR(clear_module_state->__pyx_tuple_);
  2872. Py_CLEAR(clear_module_state->__pyx_tuple__2);
  2873. Py_CLEAR(clear_module_state->__pyx_tuple__4);
  2874. Py_CLEAR(clear_module_state->__pyx_tuple__6);
  2875. Py_CLEAR(clear_module_state->__pyx_tuple__8);
  2876. Py_CLEAR(clear_module_state->__pyx_tuple__10);
  2877. Py_CLEAR(clear_module_state->__pyx_tuple__11);
  2878. Py_CLEAR(clear_module_state->__pyx_tuple__13);
  2879. Py_CLEAR(clear_module_state->__pyx_tuple__15);
  2880. Py_CLEAR(clear_module_state->__pyx_tuple__17);
  2881. Py_CLEAR(clear_module_state->__pyx_tuple__19);
  2882. Py_CLEAR(clear_module_state->__pyx_tuple__20);
  2883. Py_CLEAR(clear_module_state->__pyx_codeobj__5);
  2884. Py_CLEAR(clear_module_state->__pyx_codeobj__7);
  2885. Py_CLEAR(clear_module_state->__pyx_codeobj__9);
  2886. Py_CLEAR(clear_module_state->__pyx_codeobj__12);
  2887. Py_CLEAR(clear_module_state->__pyx_codeobj__14);
  2888. Py_CLEAR(clear_module_state->__pyx_codeobj__16);
  2889. Py_CLEAR(clear_module_state->__pyx_codeobj__18);
  2890. Py_CLEAR(clear_module_state->__pyx_codeobj__21);
  2891. return 0;
  2892. }
  2893. #endif
  2894. /* #### Code section: module_state_traverse ### */
  2895. #if CYTHON_USE_MODULE_STATE
  2896. static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  2897. __pyx_mstate *traverse_module_state = __pyx_mstate(m);
  2898. if (!traverse_module_state) return 0;
  2899. Py_VISIT(traverse_module_state->__pyx_d);
  2900. Py_VISIT(traverse_module_state->__pyx_b);
  2901. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  2902. Py_VISIT(traverse_module_state->__pyx_empty_tuple);
  2903. Py_VISIT(traverse_module_state->__pyx_empty_bytes);
  2904. Py_VISIT(traverse_module_state->__pyx_empty_unicode);
  2905. #ifdef __Pyx_CyFunction_USED
  2906. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  2907. #endif
  2908. #ifdef __Pyx_FusedFunction_USED
  2909. Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
  2910. #endif
  2911. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2912. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between);
  2913. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2914. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr);
  2915. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2916. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize);
  2917. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2918. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr);
  2919. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2920. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr);
  2921. Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError);
  2922. Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError);
  2923. Py_VISIT(traverse_module_state->__pyx_n_s_COMPILED);
  2924. Py_VISIT(traverse_module_state->__pyx_n_s_Delta);
  2925. Py_VISIT(traverse_module_state->__pyx_n_s_DeltaOrNone);
  2926. Py_VISIT(traverse_module_state->__pyx_n_s_DeltaOrNoneSegment);
  2927. Py_VISIT(traverse_module_state->__pyx_n_s_DeltaSegment);
  2928. Py_VISIT(traverse_module_state->__pyx_n_s_Endpoints);
  2929. Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
  2930. Py_VISIT(traverse_module_state->__pyx_n_s_Integral);
  2931. Py_VISIT(traverse_module_state->__pyx_kp_s_Lib_fontTools_varLib_iup_py);
  2932. Py_VISIT(traverse_module_state->__pyx_n_s_MAX_LOOKBACK);
  2933. Py_VISIT(traverse_module_state->__pyx_n_s_Point);
  2934. Py_VISIT(traverse_module_state->__pyx_n_s_PointSegment);
  2935. Py_VISIT(traverse_module_state->__pyx_n_s_Real);
  2936. Py_VISIT(traverse_module_state->__pyx_n_s_Sequence);
  2937. Py_VISIT(traverse_module_state->__pyx_n_s_Tuple);
  2938. Py_VISIT(traverse_module_state->__pyx_n_s_Union);
  2939. Py_VISIT(traverse_module_state->__pyx_n_s__22);
  2940. Py_VISIT(traverse_module_state->__pyx_kp_u__3);
  2941. Py_VISIT(traverse_module_state->__pyx_n_s_args);
  2942. Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
  2943. Py_VISIT(traverse_module_state->__pyx_n_s_best_cost);
  2944. Py_VISIT(traverse_module_state->__pyx_n_s_best_j);
  2945. Py_VISIT(traverse_module_state->__pyx_n_s_best_sol);
  2946. Py_VISIT(traverse_module_state->__pyx_n_s_c);
  2947. Py_VISIT(traverse_module_state->__pyx_n_s_c1);
  2948. Py_VISIT(traverse_module_state->__pyx_n_s_c2);
  2949. Py_VISIT(traverse_module_state->__pyx_n_s_can_iup_in_between_locals_genexp);
  2950. Py_VISIT(traverse_module_state->__pyx_n_s_chain);
  2951. Py_VISIT(traverse_module_state->__pyx_n_s_cj);
  2952. Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
  2953. Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
  2954. Py_VISIT(traverse_module_state->__pyx_n_s_close);
  2955. Py_VISIT(traverse_module_state->__pyx_n_s_contour);
  2956. Py_VISIT(traverse_module_state->__pyx_n_s_coords);
  2957. Py_VISIT(traverse_module_state->__pyx_n_s_cost);
  2958. Py_VISIT(traverse_module_state->__pyx_n_s_costs);
  2959. Py_VISIT(traverse_module_state->__pyx_n_s_cython);
  2960. Py_VISIT(traverse_module_state->__pyx_n_s_d);
  2961. Py_VISIT(traverse_module_state->__pyx_n_s_d0);
  2962. Py_VISIT(traverse_module_state->__pyx_n_s_d1);
  2963. Py_VISIT(traverse_module_state->__pyx_n_s_d2);
  2964. Py_VISIT(traverse_module_state->__pyx_n_s_deltas);
  2965. Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
  2966. Py_VISIT(traverse_module_state->__pyx_n_s_dj);
  2967. Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
  2968. Py_VISIT(traverse_module_state->__pyx_n_s_end);
  2969. Py_VISIT(traverse_module_state->__pyx_n_s_ends);
  2970. Py_VISIT(traverse_module_state->__pyx_n_s_enumerate);
  2971. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_misc);
  2972. Py_VISIT(traverse_module_state->__pyx_n_s_fontTools_varLib_iup);
  2973. Py_VISIT(traverse_module_state->__pyx_n_s_force);
  2974. Py_VISIT(traverse_module_state->__pyx_n_s_forced);
  2975. Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
  2976. Py_VISIT(traverse_module_state->__pyx_n_s_genexpr);
  2977. Py_VISIT(traverse_module_state->__pyx_n_s_i);
  2978. Py_VISIT(traverse_module_state->__pyx_n_s_i1);
  2979. Py_VISIT(traverse_module_state->__pyx_n_s_i2);
  2980. Py_VISIT(traverse_module_state->__pyx_n_s_import);
  2981. Py_VISIT(traverse_module_state->__pyx_n_s_indices);
  2982. Py_VISIT(traverse_module_state->__pyx_n_s_int);
  2983. Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
  2984. Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
  2985. Py_VISIT(traverse_module_state->__pyx_n_s_it);
  2986. Py_VISIT(traverse_module_state->__pyx_n_s_iup_contour);
  2987. Py_VISIT(traverse_module_state->__pyx_n_s_iup_contour_bound_forced_set);
  2988. Py_VISIT(traverse_module_state->__pyx_n_s_iup_contour_optimize);
  2989. Py_VISIT(traverse_module_state->__pyx_n_s_iup_contour_optimize_dp);
  2990. Py_VISIT(traverse_module_state->__pyx_n_s_iup_contour_optimize_locals_gene);
  2991. Py_VISIT(traverse_module_state->__pyx_n_s_iup_delta);
  2992. Py_VISIT(traverse_module_state->__pyx_n_s_iup_delta_optimize);
  2993. Py_VISIT(traverse_module_state->__pyx_n_s_j);
  2994. Py_VISIT(traverse_module_state->__pyx_n_s_k);
  2995. Py_VISIT(traverse_module_state->__pyx_n_s_l);
  2996. Py_VISIT(traverse_module_state->__pyx_n_s_lc);
  2997. Py_VISIT(traverse_module_state->__pyx_n_s_lcj);
  2998. Py_VISIT(traverse_module_state->__pyx_n_s_ld);
  2999. Py_VISIT(traverse_module_state->__pyx_n_s_ldj);
  3000. Py_VISIT(traverse_module_state->__pyx_n_s_list);
  3001. Py_VISIT(traverse_module_state->__pyx_n_s_lookback);
  3002. Py_VISIT(traverse_module_state->__pyx_n_s_main);
  3003. Py_VISIT(traverse_module_state->__pyx_n_s_max);
  3004. Py_VISIT(traverse_module_state->__pyx_n_s_n);
  3005. Py_VISIT(traverse_module_state->__pyx_n_s_name);
  3006. Py_VISIT(traverse_module_state->__pyx_n_s_nc);
  3007. Py_VISIT(traverse_module_state->__pyx_n_s_ncj);
  3008. Py_VISIT(traverse_module_state->__pyx_n_s_nd);
  3009. Py_VISIT(traverse_module_state->__pyx_n_s_ndj);
  3010. Py_VISIT(traverse_module_state->__pyx_n_s_numbers);
  3011. Py_VISIT(traverse_module_state->__pyx_n_s_out);
  3012. Py_VISIT(traverse_module_state->__pyx_n_s_range);
  3013. Py_VISIT(traverse_module_state->__pyx_n_s_return);
  3014. Py_VISIT(traverse_module_state->__pyx_n_s_ri1);
  3015. Py_VISIT(traverse_module_state->__pyx_n_s_ri2);
  3016. Py_VISIT(traverse_module_state->__pyx_n_s_rot_list);
  3017. Py_VISIT(traverse_module_state->__pyx_n_s_rot_set);
  3018. Py_VISIT(traverse_module_state->__pyx_n_s_s);
  3019. Py_VISIT(traverse_module_state->__pyx_n_s_send);
  3020. Py_VISIT(traverse_module_state->__pyx_n_s_set);
  3021. Py_VISIT(traverse_module_state->__pyx_n_s_solution);
  3022. Py_VISIT(traverse_module_state->__pyx_n_s_start);
  3023. Py_VISIT(traverse_module_state->__pyx_n_s_test);
  3024. Py_VISIT(traverse_module_state->__pyx_n_s_throw);
  3025. Py_VISIT(traverse_module_state->__pyx_n_s_tolerance);
  3026. Py_VISIT(traverse_module_state->__pyx_n_s_typing);
  3027. Py_VISIT(traverse_module_state->__pyx_n_s_v);
  3028. Py_VISIT(traverse_module_state->__pyx_n_s_zip);
  3029. Py_VISIT(traverse_module_state->__pyx_float_0_0);
  3030. Py_VISIT(traverse_module_state->__pyx_int_0);
  3031. Py_VISIT(traverse_module_state->__pyx_int_1);
  3032. Py_VISIT(traverse_module_state->__pyx_int_2);
  3033. Py_VISIT(traverse_module_state->__pyx_int_3);
  3034. Py_VISIT(traverse_module_state->__pyx_int_4);
  3035. Py_VISIT(traverse_module_state->__pyx_int_8);
  3036. Py_VISIT(traverse_module_state->__pyx_int_neg_1);
  3037. Py_VISIT(traverse_module_state->__pyx_tuple_);
  3038. Py_VISIT(traverse_module_state->__pyx_tuple__2);
  3039. Py_VISIT(traverse_module_state->__pyx_tuple__4);
  3040. Py_VISIT(traverse_module_state->__pyx_tuple__6);
  3041. Py_VISIT(traverse_module_state->__pyx_tuple__8);
  3042. Py_VISIT(traverse_module_state->__pyx_tuple__10);
  3043. Py_VISIT(traverse_module_state->__pyx_tuple__11);
  3044. Py_VISIT(traverse_module_state->__pyx_tuple__13);
  3045. Py_VISIT(traverse_module_state->__pyx_tuple__15);
  3046. Py_VISIT(traverse_module_state->__pyx_tuple__17);
  3047. Py_VISIT(traverse_module_state->__pyx_tuple__19);
  3048. Py_VISIT(traverse_module_state->__pyx_tuple__20);
  3049. Py_VISIT(traverse_module_state->__pyx_codeobj__5);
  3050. Py_VISIT(traverse_module_state->__pyx_codeobj__7);
  3051. Py_VISIT(traverse_module_state->__pyx_codeobj__9);
  3052. Py_VISIT(traverse_module_state->__pyx_codeobj__12);
  3053. Py_VISIT(traverse_module_state->__pyx_codeobj__14);
  3054. Py_VISIT(traverse_module_state->__pyx_codeobj__16);
  3055. Py_VISIT(traverse_module_state->__pyx_codeobj__18);
  3056. Py_VISIT(traverse_module_state->__pyx_codeobj__21);
  3057. return 0;
  3058. }
  3059. #endif
  3060. /* #### Code section: module_state_defines ### */
  3061. #define __pyx_d __pyx_mstate_global->__pyx_d
  3062. #define __pyx_b __pyx_mstate_global->__pyx_b
  3063. #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
  3064. #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
  3065. #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
  3066. #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
  3067. #ifdef __Pyx_CyFunction_USED
  3068. #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
  3069. #endif
  3070. #ifdef __Pyx_FusedFunction_USED
  3071. #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
  3072. #endif
  3073. #ifdef __Pyx_Generator_USED
  3074. #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
  3075. #endif
  3076. #ifdef __Pyx_IterableCoroutine_USED
  3077. #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
  3078. #endif
  3079. #ifdef __Pyx_Coroutine_USED
  3080. #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
  3081. #endif
  3082. #ifdef __Pyx_Coroutine_USED
  3083. #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
  3084. #endif
  3085. #if CYTHON_USE_MODULE_STATE
  3086. #endif
  3087. #if CYTHON_USE_MODULE_STATE
  3088. #define __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between __pyx_mstate_global->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between
  3089. #define __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr
  3090. #define __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize __pyx_mstate_global->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize
  3091. #define __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr __pyx_mstate_global->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr
  3092. #define __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr __pyx_mstate_global->__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr
  3093. #endif
  3094. #define __pyx_ptype_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
  3095. #define __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr
  3096. #define __pyx_ptype_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
  3097. #define __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr
  3098. #define __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr __pyx_mstate_global->__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr
  3099. #define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError
  3100. #define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError
  3101. #define __pyx_n_s_COMPILED __pyx_mstate_global->__pyx_n_s_COMPILED
  3102. #define __pyx_n_s_Delta __pyx_mstate_global->__pyx_n_s_Delta
  3103. #define __pyx_n_s_DeltaOrNone __pyx_mstate_global->__pyx_n_s_DeltaOrNone
  3104. #define __pyx_n_s_DeltaOrNoneSegment __pyx_mstate_global->__pyx_n_s_DeltaOrNoneSegment
  3105. #define __pyx_n_s_DeltaSegment __pyx_mstate_global->__pyx_n_s_DeltaSegment
  3106. #define __pyx_n_s_Endpoints __pyx_mstate_global->__pyx_n_s_Endpoints
  3107. #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
  3108. #define __pyx_n_s_Integral __pyx_mstate_global->__pyx_n_s_Integral
  3109. #define __pyx_kp_s_Lib_fontTools_varLib_iup_py __pyx_mstate_global->__pyx_kp_s_Lib_fontTools_varLib_iup_py
  3110. #define __pyx_n_s_MAX_LOOKBACK __pyx_mstate_global->__pyx_n_s_MAX_LOOKBACK
  3111. #define __pyx_n_s_Point __pyx_mstate_global->__pyx_n_s_Point
  3112. #define __pyx_n_s_PointSegment __pyx_mstate_global->__pyx_n_s_PointSegment
  3113. #define __pyx_n_s_Real __pyx_mstate_global->__pyx_n_s_Real
  3114. #define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence
  3115. #define __pyx_n_s_Tuple __pyx_mstate_global->__pyx_n_s_Tuple
  3116. #define __pyx_n_s_Union __pyx_mstate_global->__pyx_n_s_Union
  3117. #define __pyx_n_s__22 __pyx_mstate_global->__pyx_n_s__22
  3118. #define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3
  3119. #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
  3120. #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
  3121. #define __pyx_n_s_best_cost __pyx_mstate_global->__pyx_n_s_best_cost
  3122. #define __pyx_n_s_best_j __pyx_mstate_global->__pyx_n_s_best_j
  3123. #define __pyx_n_s_best_sol __pyx_mstate_global->__pyx_n_s_best_sol
  3124. #define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c
  3125. #define __pyx_n_s_c1 __pyx_mstate_global->__pyx_n_s_c1
  3126. #define __pyx_n_s_c2 __pyx_mstate_global->__pyx_n_s_c2
  3127. #define __pyx_n_s_can_iup_in_between_locals_genexp __pyx_mstate_global->__pyx_n_s_can_iup_in_between_locals_genexp
  3128. #define __pyx_n_s_chain __pyx_mstate_global->__pyx_n_s_chain
  3129. #define __pyx_n_s_cj __pyx_mstate_global->__pyx_n_s_cj
  3130. #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
  3131. #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
  3132. #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
  3133. #define __pyx_n_s_contour __pyx_mstate_global->__pyx_n_s_contour
  3134. #define __pyx_n_s_coords __pyx_mstate_global->__pyx_n_s_coords
  3135. #define __pyx_n_s_cost __pyx_mstate_global->__pyx_n_s_cost
  3136. #define __pyx_n_s_costs __pyx_mstate_global->__pyx_n_s_costs
  3137. #define __pyx_n_s_cython __pyx_mstate_global->__pyx_n_s_cython
  3138. #define __pyx_n_s_d __pyx_mstate_global->__pyx_n_s_d
  3139. #define __pyx_n_s_d0 __pyx_mstate_global->__pyx_n_s_d0
  3140. #define __pyx_n_s_d1 __pyx_mstate_global->__pyx_n_s_d1
  3141. #define __pyx_n_s_d2 __pyx_mstate_global->__pyx_n_s_d2
  3142. #define __pyx_n_s_deltas __pyx_mstate_global->__pyx_n_s_deltas
  3143. #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
  3144. #define __pyx_n_s_dj __pyx_mstate_global->__pyx_n_s_dj
  3145. #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
  3146. #define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
  3147. #define __pyx_n_s_ends __pyx_mstate_global->__pyx_n_s_ends
  3148. #define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate
  3149. #define __pyx_n_s_fontTools_misc __pyx_mstate_global->__pyx_n_s_fontTools_misc
  3150. #define __pyx_n_s_fontTools_varLib_iup __pyx_mstate_global->__pyx_n_s_fontTools_varLib_iup
  3151. #define __pyx_n_s_force __pyx_mstate_global->__pyx_n_s_force
  3152. #define __pyx_n_s_forced __pyx_mstate_global->__pyx_n_s_forced
  3153. #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
  3154. #define __pyx_n_s_genexpr __pyx_mstate_global->__pyx_n_s_genexpr
  3155. #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
  3156. #define __pyx_n_s_i1 __pyx_mstate_global->__pyx_n_s_i1
  3157. #define __pyx_n_s_i2 __pyx_mstate_global->__pyx_n_s_i2
  3158. #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
  3159. #define __pyx_n_s_indices __pyx_mstate_global->__pyx_n_s_indices
  3160. #define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int
  3161. #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
  3162. #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
  3163. #define __pyx_n_s_it __pyx_mstate_global->__pyx_n_s_it
  3164. #define __pyx_n_s_iup_contour __pyx_mstate_global->__pyx_n_s_iup_contour
  3165. #define __pyx_n_s_iup_contour_bound_forced_set __pyx_mstate_global->__pyx_n_s_iup_contour_bound_forced_set
  3166. #define __pyx_n_s_iup_contour_optimize __pyx_mstate_global->__pyx_n_s_iup_contour_optimize
  3167. #define __pyx_n_s_iup_contour_optimize_dp __pyx_mstate_global->__pyx_n_s_iup_contour_optimize_dp
  3168. #define __pyx_n_s_iup_contour_optimize_locals_gene __pyx_mstate_global->__pyx_n_s_iup_contour_optimize_locals_gene
  3169. #define __pyx_n_s_iup_delta __pyx_mstate_global->__pyx_n_s_iup_delta
  3170. #define __pyx_n_s_iup_delta_optimize __pyx_mstate_global->__pyx_n_s_iup_delta_optimize
  3171. #define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j
  3172. #define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k
  3173. #define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l
  3174. #define __pyx_n_s_lc __pyx_mstate_global->__pyx_n_s_lc
  3175. #define __pyx_n_s_lcj __pyx_mstate_global->__pyx_n_s_lcj
  3176. #define __pyx_n_s_ld __pyx_mstate_global->__pyx_n_s_ld
  3177. #define __pyx_n_s_ldj __pyx_mstate_global->__pyx_n_s_ldj
  3178. #define __pyx_n_s_list __pyx_mstate_global->__pyx_n_s_list
  3179. #define __pyx_n_s_lookback __pyx_mstate_global->__pyx_n_s_lookback
  3180. #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
  3181. #define __pyx_n_s_max __pyx_mstate_global->__pyx_n_s_max
  3182. #define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n
  3183. #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
  3184. #define __pyx_n_s_nc __pyx_mstate_global->__pyx_n_s_nc
  3185. #define __pyx_n_s_ncj __pyx_mstate_global->__pyx_n_s_ncj
  3186. #define __pyx_n_s_nd __pyx_mstate_global->__pyx_n_s_nd
  3187. #define __pyx_n_s_ndj __pyx_mstate_global->__pyx_n_s_ndj
  3188. #define __pyx_n_s_numbers __pyx_mstate_global->__pyx_n_s_numbers
  3189. #define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out
  3190. #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
  3191. #define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return
  3192. #define __pyx_n_s_ri1 __pyx_mstate_global->__pyx_n_s_ri1
  3193. #define __pyx_n_s_ri2 __pyx_mstate_global->__pyx_n_s_ri2
  3194. #define __pyx_n_s_rot_list __pyx_mstate_global->__pyx_n_s_rot_list
  3195. #define __pyx_n_s_rot_set __pyx_mstate_global->__pyx_n_s_rot_set
  3196. #define __pyx_n_s_s __pyx_mstate_global->__pyx_n_s_s
  3197. #define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send
  3198. #define __pyx_n_s_set __pyx_mstate_global->__pyx_n_s_set
  3199. #define __pyx_n_s_solution __pyx_mstate_global->__pyx_n_s_solution
  3200. #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
  3201. #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
  3202. #define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw
  3203. #define __pyx_n_s_tolerance __pyx_mstate_global->__pyx_n_s_tolerance
  3204. #define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing
  3205. #define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v
  3206. #define __pyx_n_s_zip __pyx_mstate_global->__pyx_n_s_zip
  3207. #define __pyx_float_0_0 __pyx_mstate_global->__pyx_float_0_0
  3208. #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
  3209. #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
  3210. #define __pyx_int_2 __pyx_mstate_global->__pyx_int_2
  3211. #define __pyx_int_3 __pyx_mstate_global->__pyx_int_3
  3212. #define __pyx_int_4 __pyx_mstate_global->__pyx_int_4
  3213. #define __pyx_int_8 __pyx_mstate_global->__pyx_int_8
  3214. #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
  3215. #define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
  3216. #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
  3217. #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
  3218. #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
  3219. #define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8
  3220. #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10
  3221. #define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11
  3222. #define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
  3223. #define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
  3224. #define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17
  3225. #define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
  3226. #define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20
  3227. #define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5
  3228. #define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7
  3229. #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9
  3230. #define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12
  3231. #define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14
  3232. #define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16
  3233. #define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18
  3234. #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21
  3235. /* #### Code section: module_code ### */
  3236. /* "fontTools/varLib/iup.py":31
  3237. *
  3238. *
  3239. * @cython.cfunc # <<<<<<<<<<<<<<
  3240. * @cython.locals(
  3241. * j=cython.int,
  3242. */
  3243. 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) {
  3244. int __pyx_v_j;
  3245. int __pyx_v_n;
  3246. double __pyx_v_x1;
  3247. double __pyx_v_x2;
  3248. double __pyx_v_d1;
  3249. double __pyx_v_d2;
  3250. double __pyx_v_scale;
  3251. double __pyx_v_x;
  3252. double __pyx_v_d;
  3253. PyObject *__pyx_v_out_arrays = NULL;
  3254. PyObject *__pyx_v_out = NULL;
  3255. PyObject *__pyx_v_pair = NULL;
  3256. PyObject *__pyx_r = NULL;
  3257. __Pyx_RefNannyDeclarations
  3258. PyObject *__pyx_t_1 = NULL;
  3259. Py_ssize_t __pyx_t_2;
  3260. PyObject *__pyx_t_3 = NULL;
  3261. int __pyx_t_4;
  3262. double __pyx_t_5;
  3263. double __pyx_t_6;
  3264. double __pyx_t_7;
  3265. double __pyx_t_8;
  3266. int __pyx_t_9;
  3267. Py_ssize_t __pyx_t_10;
  3268. PyObject *__pyx_t_11 = NULL;
  3269. int __pyx_t_12;
  3270. PyObject *(*__pyx_t_13)(PyObject *);
  3271. int __pyx_lineno = 0;
  3272. const char *__pyx_filename = NULL;
  3273. int __pyx_clineno = 0;
  3274. __Pyx_RefNannySetupContext("iup_segment", 1);
  3275. /* "fontTools/varLib/iup.py":52
  3276. * # rc1 = reference coord 1
  3277. * # rd1 = reference delta 1
  3278. * out_arrays = [None, None] # <<<<<<<<<<<<<<
  3279. * for j in 0, 1:
  3280. * out_arrays[j] = out = []
  3281. */
  3282. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
  3283. __Pyx_GOTREF(__pyx_t_1);
  3284. __Pyx_INCREF(Py_None);
  3285. __Pyx_GIVEREF(Py_None);
  3286. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_None)) __PYX_ERR(0, 52, __pyx_L1_error);
  3287. __Pyx_INCREF(Py_None);
  3288. __Pyx_GIVEREF(Py_None);
  3289. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, Py_None)) __PYX_ERR(0, 52, __pyx_L1_error);
  3290. __pyx_v_out_arrays = ((PyObject*)__pyx_t_1);
  3291. __pyx_t_1 = 0;
  3292. /* "fontTools/varLib/iup.py":53
  3293. * # rd1 = reference delta 1
  3294. * out_arrays = [None, None]
  3295. * for j in 0, 1: # <<<<<<<<<<<<<<
  3296. * out_arrays[j] = out = []
  3297. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3298. */
  3299. __pyx_t_1 = __pyx_tuple_; __Pyx_INCREF(__pyx_t_1);
  3300. __pyx_t_2 = 0;
  3301. for (;;) {
  3302. if (__pyx_t_2 >= 2) break;
  3303. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3304. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 53, __pyx_L1_error)
  3305. #else
  3306. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
  3307. __Pyx_GOTREF(__pyx_t_3);
  3308. #endif
  3309. __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error)
  3310. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3311. __pyx_v_j = __pyx_t_4;
  3312. /* "fontTools/varLib/iup.py":54
  3313. * out_arrays = [None, None]
  3314. * for j in 0, 1:
  3315. * out_arrays[j] = out = [] # <<<<<<<<<<<<<<
  3316. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3317. *
  3318. */
  3319. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  3320. __Pyx_GOTREF(__pyx_t_3);
  3321. if (unlikely((__Pyx_SetItemInt(__pyx_v_out_arrays, __pyx_v_j, __pyx_t_3, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 54, __pyx_L1_error)
  3322. __Pyx_INCREF(__pyx_t_3);
  3323. __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_3);
  3324. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3325. /* "fontTools/varLib/iup.py":55
  3326. * for j in 0, 1:
  3327. * out_arrays[j] = out = []
  3328. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j] # <<<<<<<<<<<<<<
  3329. *
  3330. * if x1 == x2:
  3331. */
  3332. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rc1, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  3333. __Pyx_GOTREF(__pyx_t_3);
  3334. __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  3335. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3336. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rc2, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  3337. __Pyx_GOTREF(__pyx_t_3);
  3338. __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  3339. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3340. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rd1, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  3341. __Pyx_GOTREF(__pyx_t_3);
  3342. __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  3343. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3344. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_rd2, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  3345. __Pyx_GOTREF(__pyx_t_3);
  3346. __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
  3347. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3348. __pyx_v_x1 = __pyx_t_5;
  3349. __pyx_v_x2 = __pyx_t_6;
  3350. __pyx_v_d1 = __pyx_t_7;
  3351. __pyx_v_d2 = __pyx_t_8;
  3352. /* "fontTools/varLib/iup.py":57
  3353. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3354. *
  3355. * if x1 == x2: # <<<<<<<<<<<<<<
  3356. * n = len(coords)
  3357. * if d1 == d2:
  3358. */
  3359. __pyx_t_9 = (__pyx_v_x1 == __pyx_v_x2);
  3360. if (__pyx_t_9) {
  3361. /* "fontTools/varLib/iup.py":58
  3362. *
  3363. * if x1 == x2:
  3364. * n = len(coords) # <<<<<<<<<<<<<<
  3365. * if d1 == d2:
  3366. * out.extend([d1] * n)
  3367. */
  3368. __pyx_t_10 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 58, __pyx_L1_error)
  3369. __pyx_v_n = __pyx_t_10;
  3370. /* "fontTools/varLib/iup.py":59
  3371. * if x1 == x2:
  3372. * n = len(coords)
  3373. * if d1 == d2: # <<<<<<<<<<<<<<
  3374. * out.extend([d1] * n)
  3375. * else:
  3376. */
  3377. __pyx_t_9 = (__pyx_v_d1 == __pyx_v_d2);
  3378. if (__pyx_t_9) {
  3379. /* "fontTools/varLib/iup.py":60
  3380. * n = len(coords)
  3381. * if d1 == d2:
  3382. * out.extend([d1] * n) # <<<<<<<<<<<<<<
  3383. * else:
  3384. * out.extend([0] * n)
  3385. */
  3386. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
  3387. __Pyx_GOTREF(__pyx_t_3);
  3388. __pyx_t_11 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 60, __pyx_L1_error)
  3389. __Pyx_GOTREF(__pyx_t_11);
  3390. { Py_ssize_t __pyx_temp;
  3391. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3392. __Pyx_INCREF(__pyx_t_3);
  3393. __Pyx_GIVEREF(__pyx_t_3);
  3394. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error);
  3395. }
  3396. }
  3397. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3398. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error)
  3399. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3400. /* "fontTools/varLib/iup.py":59
  3401. * if x1 == x2:
  3402. * n = len(coords)
  3403. * if d1 == d2: # <<<<<<<<<<<<<<
  3404. * out.extend([d1] * n)
  3405. * else:
  3406. */
  3407. goto __pyx_L6;
  3408. }
  3409. /* "fontTools/varLib/iup.py":62
  3410. * out.extend([d1] * n)
  3411. * else:
  3412. * out.extend([0] * n) # <<<<<<<<<<<<<<
  3413. * continue
  3414. *
  3415. */
  3416. /*else*/ {
  3417. __pyx_t_11 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error)
  3418. __Pyx_GOTREF(__pyx_t_11);
  3419. { Py_ssize_t __pyx_temp;
  3420. for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
  3421. __Pyx_INCREF(__pyx_int_0);
  3422. __Pyx_GIVEREF(__pyx_int_0);
  3423. if (__Pyx_PyList_SET_ITEM(__pyx_t_11, __pyx_temp, __pyx_int_0)) __PYX_ERR(0, 62, __pyx_L1_error);
  3424. }
  3425. }
  3426. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 62, __pyx_L1_error)
  3427. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3428. }
  3429. __pyx_L6:;
  3430. /* "fontTools/varLib/iup.py":63
  3431. * else:
  3432. * out.extend([0] * n)
  3433. * continue # <<<<<<<<<<<<<<
  3434. *
  3435. * if x1 > x2:
  3436. */
  3437. goto __pyx_L3_continue;
  3438. /* "fontTools/varLib/iup.py":57
  3439. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3440. *
  3441. * if x1 == x2: # <<<<<<<<<<<<<<
  3442. * n = len(coords)
  3443. * if d1 == d2:
  3444. */
  3445. }
  3446. /* "fontTools/varLib/iup.py":65
  3447. * continue
  3448. *
  3449. * if x1 > x2: # <<<<<<<<<<<<<<
  3450. * x1, x2 = x2, x1
  3451. * d1, d2 = d2, d1
  3452. */
  3453. __pyx_t_9 = (__pyx_v_x1 > __pyx_v_x2);
  3454. if (__pyx_t_9) {
  3455. /* "fontTools/varLib/iup.py":66
  3456. *
  3457. * if x1 > x2:
  3458. * x1, x2 = x2, x1 # <<<<<<<<<<<<<<
  3459. * d1, d2 = d2, d1
  3460. *
  3461. */
  3462. __pyx_t_8 = __pyx_v_x2;
  3463. __pyx_t_7 = __pyx_v_x1;
  3464. __pyx_v_x1 = __pyx_t_8;
  3465. __pyx_v_x2 = __pyx_t_7;
  3466. /* "fontTools/varLib/iup.py":67
  3467. * if x1 > x2:
  3468. * x1, x2 = x2, x1
  3469. * d1, d2 = d2, d1 # <<<<<<<<<<<<<<
  3470. *
  3471. * # x1 < x2
  3472. */
  3473. __pyx_t_7 = __pyx_v_d2;
  3474. __pyx_t_8 = __pyx_v_d1;
  3475. __pyx_v_d1 = __pyx_t_7;
  3476. __pyx_v_d2 = __pyx_t_8;
  3477. /* "fontTools/varLib/iup.py":65
  3478. * continue
  3479. *
  3480. * if x1 > x2: # <<<<<<<<<<<<<<
  3481. * x1, x2 = x2, x1
  3482. * d1, d2 = d2, d1
  3483. */
  3484. }
  3485. /* "fontTools/varLib/iup.py":70
  3486. *
  3487. * # x1 < x2
  3488. * scale = (d2 - d1) / (x2 - x1) # <<<<<<<<<<<<<<
  3489. * for pair in coords:
  3490. * x = pair[j]
  3491. */
  3492. __pyx_t_8 = (__pyx_v_d2 - __pyx_v_d1);
  3493. __pyx_t_7 = (__pyx_v_x2 - __pyx_v_x1);
  3494. if (unlikely(__pyx_t_7 == 0)) {
  3495. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  3496. __PYX_ERR(0, 70, __pyx_L1_error)
  3497. }
  3498. __pyx_v_scale = (__pyx_t_8 / __pyx_t_7);
  3499. /* "fontTools/varLib/iup.py":71
  3500. * # x1 < x2
  3501. * scale = (d2 - d1) / (x2 - x1)
  3502. * for pair in coords: # <<<<<<<<<<<<<<
  3503. * x = pair[j]
  3504. *
  3505. */
  3506. if (likely(PyList_CheckExact(__pyx_v_coords)) || PyTuple_CheckExact(__pyx_v_coords)) {
  3507. __pyx_t_11 = __pyx_v_coords; __Pyx_INCREF(__pyx_t_11);
  3508. __pyx_t_10 = 0;
  3509. __pyx_t_13 = NULL;
  3510. } else {
  3511. __pyx_t_10 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_coords); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 71, __pyx_L1_error)
  3512. __Pyx_GOTREF(__pyx_t_11);
  3513. __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 71, __pyx_L1_error)
  3514. }
  3515. for (;;) {
  3516. if (likely(!__pyx_t_13)) {
  3517. if (likely(PyList_CheckExact(__pyx_t_11))) {
  3518. {
  3519. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  3520. #if !CYTHON_ASSUME_SAFE_MACROS
  3521. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
  3522. #endif
  3523. if (__pyx_t_10 >= __pyx_temp) break;
  3524. }
  3525. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3526. __pyx_t_3 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
  3527. #else
  3528. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  3529. __Pyx_GOTREF(__pyx_t_3);
  3530. #endif
  3531. } else {
  3532. {
  3533. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  3534. #if !CYTHON_ASSUME_SAFE_MACROS
  3535. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
  3536. #endif
  3537. if (__pyx_t_10 >= __pyx_temp) break;
  3538. }
  3539. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3540. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
  3541. #else
  3542. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  3543. __Pyx_GOTREF(__pyx_t_3);
  3544. #endif
  3545. }
  3546. } else {
  3547. __pyx_t_3 = __pyx_t_13(__pyx_t_11);
  3548. if (unlikely(!__pyx_t_3)) {
  3549. PyObject* exc_type = PyErr_Occurred();
  3550. if (exc_type) {
  3551. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  3552. else __PYX_ERR(0, 71, __pyx_L1_error)
  3553. }
  3554. break;
  3555. }
  3556. __Pyx_GOTREF(__pyx_t_3);
  3557. }
  3558. __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3);
  3559. __pyx_t_3 = 0;
  3560. /* "fontTools/varLib/iup.py":72
  3561. * scale = (d2 - d1) / (x2 - x1)
  3562. * for pair in coords:
  3563. * x = pair[j] # <<<<<<<<<<<<<<
  3564. *
  3565. * if x <= x1:
  3566. */
  3567. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pair, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  3568. __Pyx_GOTREF(__pyx_t_3);
  3569. __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
  3570. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3571. __pyx_v_x = __pyx_t_7;
  3572. /* "fontTools/varLib/iup.py":74
  3573. * x = pair[j]
  3574. *
  3575. * if x <= x1: # <<<<<<<<<<<<<<
  3576. * d = d1
  3577. * elif x >= x2:
  3578. */
  3579. __pyx_t_9 = (__pyx_v_x <= __pyx_v_x1);
  3580. if (__pyx_t_9) {
  3581. /* "fontTools/varLib/iup.py":75
  3582. *
  3583. * if x <= x1:
  3584. * d = d1 # <<<<<<<<<<<<<<
  3585. * elif x >= x2:
  3586. * d = d2
  3587. */
  3588. __pyx_v_d = __pyx_v_d1;
  3589. /* "fontTools/varLib/iup.py":74
  3590. * x = pair[j]
  3591. *
  3592. * if x <= x1: # <<<<<<<<<<<<<<
  3593. * d = d1
  3594. * elif x >= x2:
  3595. */
  3596. goto __pyx_L10;
  3597. }
  3598. /* "fontTools/varLib/iup.py":76
  3599. * if x <= x1:
  3600. * d = d1
  3601. * elif x >= x2: # <<<<<<<<<<<<<<
  3602. * d = d2
  3603. * else:
  3604. */
  3605. __pyx_t_9 = (__pyx_v_x >= __pyx_v_x2);
  3606. if (__pyx_t_9) {
  3607. /* "fontTools/varLib/iup.py":77
  3608. * d = d1
  3609. * elif x >= x2:
  3610. * d = d2 # <<<<<<<<<<<<<<
  3611. * else:
  3612. * # Interpolate
  3613. */
  3614. __pyx_v_d = __pyx_v_d2;
  3615. /* "fontTools/varLib/iup.py":76
  3616. * if x <= x1:
  3617. * d = d1
  3618. * elif x >= x2: # <<<<<<<<<<<<<<
  3619. * d = d2
  3620. * else:
  3621. */
  3622. goto __pyx_L10;
  3623. }
  3624. /* "fontTools/varLib/iup.py":80
  3625. * else:
  3626. * # Interpolate
  3627. * d = d1 + (x - x1) * scale # <<<<<<<<<<<<<<
  3628. *
  3629. * out.append(d)
  3630. */
  3631. /*else*/ {
  3632. __pyx_v_d = (__pyx_v_d1 + ((__pyx_v_x - __pyx_v_x1) * __pyx_v_scale));
  3633. }
  3634. __pyx_L10:;
  3635. /* "fontTools/varLib/iup.py":82
  3636. * d = d1 + (x - x1) * scale
  3637. *
  3638. * out.append(d) # <<<<<<<<<<<<<<
  3639. *
  3640. * return zip(*out_arrays)
  3641. */
  3642. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
  3643. __Pyx_GOTREF(__pyx_t_3);
  3644. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 82, __pyx_L1_error)
  3645. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3646. /* "fontTools/varLib/iup.py":71
  3647. * # x1 < x2
  3648. * scale = (d2 - d1) / (x2 - x1)
  3649. * for pair in coords: # <<<<<<<<<<<<<<
  3650. * x = pair[j]
  3651. *
  3652. */
  3653. }
  3654. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3655. /* "fontTools/varLib/iup.py":53
  3656. * # rd1 = reference delta 1
  3657. * out_arrays = [None, None]
  3658. * for j in 0, 1: # <<<<<<<<<<<<<<
  3659. * out_arrays[j] = out = []
  3660. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  3661. */
  3662. __pyx_L3_continue:;
  3663. }
  3664. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3665. /* "fontTools/varLib/iup.py":84
  3666. * out.append(d)
  3667. *
  3668. * return zip(*out_arrays) # <<<<<<<<<<<<<<
  3669. *
  3670. *
  3671. */
  3672. __Pyx_XDECREF(__pyx_r);
  3673. __pyx_t_1 = PySequence_Tuple(__pyx_v_out_arrays); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  3674. __Pyx_GOTREF(__pyx_t_1);
  3675. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 84, __pyx_L1_error)
  3676. __Pyx_GOTREF(__pyx_t_11);
  3677. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3678. __pyx_r = __pyx_t_11;
  3679. __pyx_t_11 = 0;
  3680. goto __pyx_L0;
  3681. /* "fontTools/varLib/iup.py":31
  3682. *
  3683. *
  3684. * @cython.cfunc # <<<<<<<<<<<<<<
  3685. * @cython.locals(
  3686. * j=cython.int,
  3687. */
  3688. /* function exit code */
  3689. __pyx_L1_error:;
  3690. __Pyx_XDECREF(__pyx_t_1);
  3691. __Pyx_XDECREF(__pyx_t_3);
  3692. __Pyx_XDECREF(__pyx_t_11);
  3693. __Pyx_AddTraceback("fontTools.varLib.iup.iup_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3694. __pyx_r = 0;
  3695. __pyx_L0:;
  3696. __Pyx_XDECREF(__pyx_v_out_arrays);
  3697. __Pyx_XDECREF(__pyx_v_out);
  3698. __Pyx_XDECREF(__pyx_v_pair);
  3699. __Pyx_XGIVEREF(__pyx_r);
  3700. __Pyx_RefNannyFinishContext();
  3701. return __pyx_r;
  3702. }
  3703. /* "fontTools/varLib/iup.py":87
  3704. *
  3705. *
  3706. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  3707. * """For the contour given in `coords`, interpolate any missing
  3708. * delta values in delta vector `deltas`.
  3709. */
  3710. /* Python wrapper */
  3711. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_1iup_contour(PyObject *__pyx_self,
  3712. #if CYTHON_METH_FASTCALL
  3713. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3714. #else
  3715. PyObject *__pyx_args, PyObject *__pyx_kwds
  3716. #endif
  3717. ); /*proto*/
  3718. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_iup_contour, "iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment\nFor the contour given in `coords`, interpolate any missing\n delta values in delta vector `deltas`.\n\n Returns fully filled-out delta vector.");
  3719. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_1iup_contour = {"iup_contour", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_1iup_contour, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_iup_contour};
  3720. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_1iup_contour(PyObject *__pyx_self,
  3721. #if CYTHON_METH_FASTCALL
  3722. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3723. #else
  3724. PyObject *__pyx_args, PyObject *__pyx_kwds
  3725. #endif
  3726. ) {
  3727. PyObject *__pyx_v_deltas = 0;
  3728. PyObject *__pyx_v_coords = 0;
  3729. #if !CYTHON_METH_FASTCALL
  3730. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3731. #endif
  3732. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3733. PyObject* values[2] = {0,0};
  3734. int __pyx_lineno = 0;
  3735. const char *__pyx_filename = NULL;
  3736. int __pyx_clineno = 0;
  3737. PyObject *__pyx_r = 0;
  3738. __Pyx_RefNannyDeclarations
  3739. __Pyx_RefNannySetupContext("iup_contour (wrapper)", 0);
  3740. #if !CYTHON_METH_FASTCALL
  3741. #if CYTHON_ASSUME_SAFE_MACROS
  3742. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3743. #else
  3744. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3745. #endif
  3746. #endif
  3747. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3748. {
  3749. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,0};
  3750. if (__pyx_kwds) {
  3751. Py_ssize_t kw_args;
  3752. switch (__pyx_nargs) {
  3753. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  3754. CYTHON_FALLTHROUGH;
  3755. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  3756. CYTHON_FALLTHROUGH;
  3757. case 0: break;
  3758. default: goto __pyx_L5_argtuple_error;
  3759. }
  3760. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  3761. switch (__pyx_nargs) {
  3762. case 0:
  3763. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  3764. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  3765. kw_args--;
  3766. }
  3767. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
  3768. else goto __pyx_L5_argtuple_error;
  3769. CYTHON_FALLTHROUGH;
  3770. case 1:
  3771. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  3772. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  3773. kw_args--;
  3774. }
  3775. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
  3776. else {
  3777. __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, 1); __PYX_ERR(0, 87, __pyx_L3_error)
  3778. }
  3779. }
  3780. if (unlikely(kw_args > 0)) {
  3781. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3782. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iup_contour") < 0)) __PYX_ERR(0, 87, __pyx_L3_error)
  3783. }
  3784. } else if (unlikely(__pyx_nargs != 2)) {
  3785. goto __pyx_L5_argtuple_error;
  3786. } else {
  3787. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  3788. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  3789. }
  3790. __pyx_v_deltas = values[0];
  3791. __pyx_v_coords = values[1];
  3792. }
  3793. goto __pyx_L6_skip;
  3794. __pyx_L5_argtuple_error:;
  3795. __Pyx_RaiseArgtupleInvalid("iup_contour", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 87, __pyx_L3_error)
  3796. __pyx_L6_skip:;
  3797. goto __pyx_L4_argument_unpacking_done;
  3798. __pyx_L3_error:;
  3799. {
  3800. Py_ssize_t __pyx_temp;
  3801. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3802. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  3803. }
  3804. }
  3805. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3806. __Pyx_RefNannyFinishContext();
  3807. return NULL;
  3808. __pyx_L4_argument_unpacking_done:;
  3809. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_iup_contour(__pyx_self, __pyx_v_deltas, __pyx_v_coords);
  3810. /* function exit code */
  3811. {
  3812. Py_ssize_t __pyx_temp;
  3813. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3814. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  3815. }
  3816. }
  3817. __Pyx_RefNannyFinishContext();
  3818. return __pyx_r;
  3819. }
  3820. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_iup_contour(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_deltas, PyObject *__pyx_v_coords) {
  3821. PyObject *__pyx_v_n = NULL;
  3822. PyObject *__pyx_v_indices = NULL;
  3823. PyObject *__pyx_v_out = NULL;
  3824. PyObject *__pyx_v_it = NULL;
  3825. PyObject *__pyx_v_start = NULL;
  3826. PyObject *__pyx_v_i1 = NULL;
  3827. PyObject *__pyx_v_i2 = NULL;
  3828. PyObject *__pyx_v_ri1 = NULL;
  3829. PyObject *__pyx_v_ri2 = NULL;
  3830. PyObject *__pyx_v_end = NULL;
  3831. PyObject *__pyx_7genexpr__pyx_v_i = NULL;
  3832. PyObject *__pyx_7genexpr__pyx_v_v = NULL;
  3833. PyObject *__pyx_r = NULL;
  3834. __Pyx_RefNannyDeclarations
  3835. Py_ssize_t __pyx_t_1;
  3836. Py_ssize_t __pyx_t_2;
  3837. int __pyx_t_3;
  3838. PyObject *__pyx_t_4 = NULL;
  3839. PyObject *__pyx_t_5 = NULL;
  3840. PyObject *__pyx_t_6 = NULL;
  3841. PyObject *(*__pyx_t_7)(PyObject *);
  3842. PyObject *__pyx_t_8 = NULL;
  3843. int __pyx_t_9;
  3844. PyObject *__pyx_t_10 = NULL;
  3845. PyObject *__pyx_t_11 = NULL;
  3846. int __pyx_t_12;
  3847. PyObject *__pyx_t_13 = NULL;
  3848. int __pyx_lineno = 0;
  3849. const char *__pyx_filename = NULL;
  3850. int __pyx_clineno = 0;
  3851. __Pyx_RefNannySetupContext("iup_contour", 1);
  3852. /* "fontTools/varLib/iup.py":93
  3853. * Returns fully filled-out delta vector."""
  3854. *
  3855. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  3856. * if None not in deltas:
  3857. * return deltas
  3858. */
  3859. #ifndef CYTHON_WITHOUT_ASSERTIONS
  3860. if (unlikely(__pyx_assertions_enabled())) {
  3861. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 93, __pyx_L1_error)
  3862. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 93, __pyx_L1_error)
  3863. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  3864. if (unlikely(!__pyx_t_3)) {
  3865. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  3866. __PYX_ERR(0, 93, __pyx_L1_error)
  3867. }
  3868. }
  3869. #else
  3870. if ((1)); else __PYX_ERR(0, 93, __pyx_L1_error)
  3871. #endif
  3872. /* "fontTools/varLib/iup.py":94
  3873. *
  3874. * assert len(deltas) == len(coords)
  3875. * if None not in deltas: # <<<<<<<<<<<<<<
  3876. * return deltas
  3877. *
  3878. */
  3879. __pyx_t_3 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_deltas, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 94, __pyx_L1_error)
  3880. if (__pyx_t_3) {
  3881. /* "fontTools/varLib/iup.py":95
  3882. * assert len(deltas) == len(coords)
  3883. * if None not in deltas:
  3884. * return deltas # <<<<<<<<<<<<<<
  3885. *
  3886. * n = len(deltas)
  3887. */
  3888. __Pyx_XDECREF(__pyx_r);
  3889. __Pyx_INCREF(__pyx_v_deltas);
  3890. __pyx_r = __pyx_v_deltas;
  3891. goto __pyx_L0;
  3892. /* "fontTools/varLib/iup.py":94
  3893. *
  3894. * assert len(deltas) == len(coords)
  3895. * if None not in deltas: # <<<<<<<<<<<<<<
  3896. * return deltas
  3897. *
  3898. */
  3899. }
  3900. /* "fontTools/varLib/iup.py":97
  3901. * return deltas
  3902. *
  3903. * n = len(deltas) # <<<<<<<<<<<<<<
  3904. * # indices of points with explicit deltas
  3905. * indices = [i for i, v in enumerate(deltas) if v is not None]
  3906. */
  3907. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error)
  3908. __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
  3909. __Pyx_GOTREF(__pyx_t_4);
  3910. __pyx_v_n = __pyx_t_4;
  3911. __pyx_t_4 = 0;
  3912. /* "fontTools/varLib/iup.py":99
  3913. * n = len(deltas)
  3914. * # indices of points with explicit deltas
  3915. * indices = [i for i, v in enumerate(deltas) if v is not None] # <<<<<<<<<<<<<<
  3916. * if not indices:
  3917. * # All deltas are None. Return 0,0 for all.
  3918. */
  3919. { /* enter inner scope */
  3920. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L6_error)
  3921. __Pyx_GOTREF(__pyx_t_4);
  3922. __Pyx_INCREF(__pyx_int_0);
  3923. __pyx_t_5 = __pyx_int_0;
  3924. if (likely(PyList_CheckExact(__pyx_v_deltas)) || PyTuple_CheckExact(__pyx_v_deltas)) {
  3925. __pyx_t_6 = __pyx_v_deltas; __Pyx_INCREF(__pyx_t_6);
  3926. __pyx_t_2 = 0;
  3927. __pyx_t_7 = NULL;
  3928. } else {
  3929. __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_deltas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L6_error)
  3930. __Pyx_GOTREF(__pyx_t_6);
  3931. __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L6_error)
  3932. }
  3933. for (;;) {
  3934. if (likely(!__pyx_t_7)) {
  3935. if (likely(PyList_CheckExact(__pyx_t_6))) {
  3936. {
  3937. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  3938. #if !CYTHON_ASSUME_SAFE_MACROS
  3939. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 99, __pyx_L6_error)
  3940. #endif
  3941. if (__pyx_t_2 >= __pyx_temp) break;
  3942. }
  3943. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3944. __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 99, __pyx_L6_error)
  3945. #else
  3946. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L6_error)
  3947. __Pyx_GOTREF(__pyx_t_8);
  3948. #endif
  3949. } else {
  3950. {
  3951. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  3952. #if !CYTHON_ASSUME_SAFE_MACROS
  3953. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 99, __pyx_L6_error)
  3954. #endif
  3955. if (__pyx_t_2 >= __pyx_temp) break;
  3956. }
  3957. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3958. __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 99, __pyx_L6_error)
  3959. #else
  3960. __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L6_error)
  3961. __Pyx_GOTREF(__pyx_t_8);
  3962. #endif
  3963. }
  3964. } else {
  3965. __pyx_t_8 = __pyx_t_7(__pyx_t_6);
  3966. if (unlikely(!__pyx_t_8)) {
  3967. PyObject* exc_type = PyErr_Occurred();
  3968. if (exc_type) {
  3969. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  3970. else __PYX_ERR(0, 99, __pyx_L6_error)
  3971. }
  3972. break;
  3973. }
  3974. __Pyx_GOTREF(__pyx_t_8);
  3975. }
  3976. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_8);
  3977. __pyx_t_8 = 0;
  3978. __Pyx_INCREF(__pyx_t_5);
  3979. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_5);
  3980. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L6_error)
  3981. __Pyx_GOTREF(__pyx_t_8);
  3982. __Pyx_DECREF(__pyx_t_5);
  3983. __pyx_t_5 = __pyx_t_8;
  3984. __pyx_t_8 = 0;
  3985. __pyx_t_3 = (__pyx_7genexpr__pyx_v_v != Py_None);
  3986. if (__pyx_t_3) {
  3987. if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_7genexpr__pyx_v_i))) __PYX_ERR(0, 99, __pyx_L6_error)
  3988. }
  3989. }
  3990. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3991. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3992. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3993. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3994. goto __pyx_L11_exit_scope;
  3995. __pyx_L6_error:;
  3996. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
  3997. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
  3998. goto __pyx_L1_error;
  3999. __pyx_L11_exit_scope:;
  4000. } /* exit inner scope */
  4001. __pyx_v_indices = ((PyObject*)__pyx_t_4);
  4002. __pyx_t_4 = 0;
  4003. /* "fontTools/varLib/iup.py":100
  4004. * # indices of points with explicit deltas
  4005. * indices = [i for i, v in enumerate(deltas) if v is not None]
  4006. * if not indices: # <<<<<<<<<<<<<<
  4007. * # All deltas are None. Return 0,0 for all.
  4008. * return [(0, 0)] * n
  4009. */
  4010. __pyx_t_3 = (PyList_GET_SIZE(__pyx_v_indices) != 0);
  4011. __pyx_t_9 = (!__pyx_t_3);
  4012. if (__pyx_t_9) {
  4013. /* "fontTools/varLib/iup.py":102
  4014. * if not indices:
  4015. * # All deltas are None. Return 0,0 for all.
  4016. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  4017. *
  4018. * out = []
  4019. */
  4020. __Pyx_XDECREF(__pyx_r);
  4021. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
  4022. __Pyx_GOTREF(__pyx_t_4);
  4023. __Pyx_INCREF(__pyx_tuple__2);
  4024. __Pyx_GIVEREF(__pyx_tuple__2);
  4025. if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_tuple__2)) __PYX_ERR(0, 102, __pyx_L1_error);
  4026. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 102, __pyx_L1_error)
  4027. __Pyx_GOTREF(__pyx_temp);
  4028. __Pyx_DECREF(__pyx_t_4);
  4029. __pyx_t_4 = __pyx_temp;
  4030. }
  4031. __pyx_r = __pyx_t_4;
  4032. __pyx_t_4 = 0;
  4033. goto __pyx_L0;
  4034. /* "fontTools/varLib/iup.py":100
  4035. * # indices of points with explicit deltas
  4036. * indices = [i for i, v in enumerate(deltas) if v is not None]
  4037. * if not indices: # <<<<<<<<<<<<<<
  4038. * # All deltas are None. Return 0,0 for all.
  4039. * return [(0, 0)] * n
  4040. */
  4041. }
  4042. /* "fontTools/varLib/iup.py":104
  4043. * return [(0, 0)] * n
  4044. *
  4045. * out = [] # <<<<<<<<<<<<<<
  4046. * it = iter(indices)
  4047. * start = next(it)
  4048. */
  4049. __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
  4050. __Pyx_GOTREF(__pyx_t_4);
  4051. __pyx_v_out = ((PyObject*)__pyx_t_4);
  4052. __pyx_t_4 = 0;
  4053. /* "fontTools/varLib/iup.py":105
  4054. *
  4055. * out = []
  4056. * it = iter(indices) # <<<<<<<<<<<<<<
  4057. * start = next(it)
  4058. * if start != 0:
  4059. */
  4060. __pyx_t_4 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
  4061. __Pyx_GOTREF(__pyx_t_4);
  4062. __pyx_v_it = __pyx_t_4;
  4063. __pyx_t_4 = 0;
  4064. /* "fontTools/varLib/iup.py":106
  4065. * out = []
  4066. * it = iter(indices)
  4067. * start = next(it) # <<<<<<<<<<<<<<
  4068. * if start != 0:
  4069. * # Initial segment that wraps around
  4070. */
  4071. __pyx_t_4 = __Pyx_PyIter_Next(__pyx_v_it); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
  4072. __Pyx_GOTREF(__pyx_t_4);
  4073. __pyx_v_start = __pyx_t_4;
  4074. __pyx_t_4 = 0;
  4075. /* "fontTools/varLib/iup.py":107
  4076. * it = iter(indices)
  4077. * start = next(it)
  4078. * if start != 0: # <<<<<<<<<<<<<<
  4079. * # Initial segment that wraps around
  4080. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  4081. */
  4082. __pyx_t_9 = (__Pyx_PyInt_BoolNeObjC(__pyx_v_start, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 107, __pyx_L1_error)
  4083. if (__pyx_t_9) {
  4084. /* "fontTools/varLib/iup.py":109
  4085. * if start != 0:
  4086. * # Initial segment that wraps around
  4087. * i1, i2, ri1, ri2 = 0, start, start, indices[-1] # <<<<<<<<<<<<<<
  4088. * out.extend(
  4089. * iup_segment(
  4090. */
  4091. __pyx_t_4 = __pyx_int_0;
  4092. __Pyx_INCREF(__pyx_t_4);
  4093. __pyx_t_5 = __pyx_v_start;
  4094. __Pyx_INCREF(__pyx_t_5);
  4095. __pyx_t_6 = __pyx_v_start;
  4096. __Pyx_INCREF(__pyx_t_6);
  4097. __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_indices, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 109, __pyx_L1_error)
  4098. __Pyx_GOTREF(__pyx_t_8);
  4099. __pyx_v_i1 = __pyx_t_4;
  4100. __pyx_t_4 = 0;
  4101. __pyx_v_i2 = __pyx_t_5;
  4102. __pyx_t_5 = 0;
  4103. __pyx_v_ri1 = __pyx_t_6;
  4104. __pyx_t_6 = 0;
  4105. __pyx_v_ri2 = __pyx_t_8;
  4106. __pyx_t_8 = 0;
  4107. /* "fontTools/varLib/iup.py":112
  4108. * out.extend(
  4109. * iup_segment(
  4110. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  4111. * )
  4112. * )
  4113. */
  4114. __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, 112, __pyx_L1_error)
  4115. __Pyx_GOTREF(__pyx_t_8);
  4116. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
  4117. __Pyx_GOTREF(__pyx_t_6);
  4118. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
  4119. __Pyx_GOTREF(__pyx_t_5);
  4120. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
  4121. __Pyx_GOTREF(__pyx_t_4);
  4122. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 112, __pyx_L1_error)
  4123. __Pyx_GOTREF(__pyx_t_10);
  4124. /* "fontTools/varLib/iup.py":111
  4125. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  4126. * out.extend(
  4127. * iup_segment( # <<<<<<<<<<<<<<
  4128. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4129. * )
  4130. */
  4131. __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, 111, __pyx_L1_error)
  4132. __Pyx_GOTREF(__pyx_t_11);
  4133. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4134. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4135. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4136. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4137. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4138. /* "fontTools/varLib/iup.py":110
  4139. * # Initial segment that wraps around
  4140. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  4141. * out.extend( # <<<<<<<<<<<<<<
  4142. * iup_segment(
  4143. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4144. */
  4145. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 110, __pyx_L1_error)
  4146. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4147. /* "fontTools/varLib/iup.py":107
  4148. * it = iter(indices)
  4149. * start = next(it)
  4150. * if start != 0: # <<<<<<<<<<<<<<
  4151. * # Initial segment that wraps around
  4152. * i1, i2, ri1, ri2 = 0, start, start, indices[-1]
  4153. */
  4154. }
  4155. /* "fontTools/varLib/iup.py":115
  4156. * )
  4157. * )
  4158. * out.append(deltas[start]) # <<<<<<<<<<<<<<
  4159. * for end in it:
  4160. * if end - start > 1:
  4161. */
  4162. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 115, __pyx_L1_error)
  4163. __Pyx_GOTREF(__pyx_t_11);
  4164. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_11); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 115, __pyx_L1_error)
  4165. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4166. /* "fontTools/varLib/iup.py":116
  4167. * )
  4168. * out.append(deltas[start])
  4169. * for end in it: # <<<<<<<<<<<<<<
  4170. * if end - start > 1:
  4171. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4172. */
  4173. if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) {
  4174. __pyx_t_11 = __pyx_v_it; __Pyx_INCREF(__pyx_t_11);
  4175. __pyx_t_2 = 0;
  4176. __pyx_t_7 = NULL;
  4177. } else {
  4178. __pyx_t_2 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 116, __pyx_L1_error)
  4179. __Pyx_GOTREF(__pyx_t_11);
  4180. __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __pyx_L1_error)
  4181. }
  4182. for (;;) {
  4183. if (likely(!__pyx_t_7)) {
  4184. if (likely(PyList_CheckExact(__pyx_t_11))) {
  4185. {
  4186. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  4187. #if !CYTHON_ASSUME_SAFE_MACROS
  4188. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
  4189. #endif
  4190. if (__pyx_t_2 >= __pyx_temp) break;
  4191. }
  4192. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4193. __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_2); __Pyx_INCREF(__pyx_t_10); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
  4194. #else
  4195. __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 116, __pyx_L1_error)
  4196. __Pyx_GOTREF(__pyx_t_10);
  4197. #endif
  4198. } else {
  4199. {
  4200. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  4201. #if !CYTHON_ASSUME_SAFE_MACROS
  4202. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
  4203. #endif
  4204. if (__pyx_t_2 >= __pyx_temp) break;
  4205. }
  4206. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4207. __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_2); __Pyx_INCREF(__pyx_t_10); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
  4208. #else
  4209. __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 116, __pyx_L1_error)
  4210. __Pyx_GOTREF(__pyx_t_10);
  4211. #endif
  4212. }
  4213. } else {
  4214. __pyx_t_10 = __pyx_t_7(__pyx_t_11);
  4215. if (unlikely(!__pyx_t_10)) {
  4216. PyObject* exc_type = PyErr_Occurred();
  4217. if (exc_type) {
  4218. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4219. else __PYX_ERR(0, 116, __pyx_L1_error)
  4220. }
  4221. break;
  4222. }
  4223. __Pyx_GOTREF(__pyx_t_10);
  4224. }
  4225. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_10);
  4226. __pyx_t_10 = 0;
  4227. /* "fontTools/varLib/iup.py":117
  4228. * out.append(deltas[start])
  4229. * for end in it:
  4230. * if end - start > 1: # <<<<<<<<<<<<<<
  4231. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4232. * out.extend(
  4233. */
  4234. __pyx_t_10 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 117, __pyx_L1_error)
  4235. __Pyx_GOTREF(__pyx_t_10);
  4236. __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
  4237. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4238. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 117, __pyx_L1_error)
  4239. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4240. if (__pyx_t_9) {
  4241. /* "fontTools/varLib/iup.py":118
  4242. * for end in it:
  4243. * if end - start > 1:
  4244. * i1, i2, ri1, ri2 = start + 1, end, start, end # <<<<<<<<<<<<<<
  4245. * out.extend(
  4246. * iup_segment(
  4247. */
  4248. __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
  4249. __Pyx_GOTREF(__pyx_t_4);
  4250. __pyx_t_10 = __pyx_v_end;
  4251. __Pyx_INCREF(__pyx_t_10);
  4252. __pyx_t_5 = __pyx_v_start;
  4253. __Pyx_INCREF(__pyx_t_5);
  4254. __pyx_t_6 = __pyx_v_end;
  4255. __Pyx_INCREF(__pyx_t_6);
  4256. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_4);
  4257. __pyx_t_4 = 0;
  4258. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_10);
  4259. __pyx_t_10 = 0;
  4260. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_5);
  4261. __pyx_t_5 = 0;
  4262. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_6);
  4263. __pyx_t_6 = 0;
  4264. /* "fontTools/varLib/iup.py":121
  4265. * out.extend(
  4266. * iup_segment(
  4267. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  4268. * )
  4269. * )
  4270. */
  4271. __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, 121, __pyx_L1_error)
  4272. __Pyx_GOTREF(__pyx_t_6);
  4273. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  4274. __Pyx_GOTREF(__pyx_t_5);
  4275. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error)
  4276. __Pyx_GOTREF(__pyx_t_10);
  4277. __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  4278. __Pyx_GOTREF(__pyx_t_4);
  4279. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 121, __pyx_L1_error)
  4280. __Pyx_GOTREF(__pyx_t_8);
  4281. /* "fontTools/varLib/iup.py":120
  4282. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4283. * out.extend(
  4284. * iup_segment( # <<<<<<<<<<<<<<
  4285. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4286. * )
  4287. */
  4288. __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, 120, __pyx_L1_error)
  4289. __Pyx_GOTREF(__pyx_t_13);
  4290. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4291. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4292. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4293. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4294. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4295. /* "fontTools/varLib/iup.py":119
  4296. * if end - start > 1:
  4297. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4298. * out.extend( # <<<<<<<<<<<<<<
  4299. * iup_segment(
  4300. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4301. */
  4302. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error)
  4303. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4304. /* "fontTools/varLib/iup.py":117
  4305. * out.append(deltas[start])
  4306. * for end in it:
  4307. * if end - start > 1: # <<<<<<<<<<<<<<
  4308. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4309. * out.extend(
  4310. */
  4311. }
  4312. /* "fontTools/varLib/iup.py":124
  4313. * )
  4314. * )
  4315. * out.append(deltas[end]) # <<<<<<<<<<<<<<
  4316. * start = end
  4317. * if start != n - 1:
  4318. */
  4319. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_end); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 124, __pyx_L1_error)
  4320. __Pyx_GOTREF(__pyx_t_13);
  4321. __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_out, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 124, __pyx_L1_error)
  4322. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4323. /* "fontTools/varLib/iup.py":125
  4324. * )
  4325. * out.append(deltas[end])
  4326. * start = end # <<<<<<<<<<<<<<
  4327. * if start != n - 1:
  4328. * # Final segment that wraps around
  4329. */
  4330. __Pyx_INCREF(__pyx_v_end);
  4331. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4332. /* "fontTools/varLib/iup.py":116
  4333. * )
  4334. * out.append(deltas[start])
  4335. * for end in it: # <<<<<<<<<<<<<<
  4336. * if end - start > 1:
  4337. * i1, i2, ri1, ri2 = start + 1, end, start, end
  4338. */
  4339. }
  4340. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4341. /* "fontTools/varLib/iup.py":126
  4342. * out.append(deltas[end])
  4343. * start = end
  4344. * if start != n - 1: # <<<<<<<<<<<<<<
  4345. * # Final segment that wraps around
  4346. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4347. */
  4348. __pyx_t_11 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 126, __pyx_L1_error)
  4349. __Pyx_GOTREF(__pyx_t_11);
  4350. __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, 126, __pyx_L1_error)
  4351. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4352. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 126, __pyx_L1_error)
  4353. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4354. if (__pyx_t_9) {
  4355. /* "fontTools/varLib/iup.py":128
  4356. * if start != n - 1:
  4357. * # Final segment that wraps around
  4358. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0] # <<<<<<<<<<<<<<
  4359. * out.extend(
  4360. * iup_segment(
  4361. */
  4362. __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 128, __pyx_L1_error)
  4363. __Pyx_GOTREF(__pyx_t_13);
  4364. __pyx_t_11 = __pyx_v_n;
  4365. __Pyx_INCREF(__pyx_t_11);
  4366. __pyx_t_8 = __pyx_v_start;
  4367. __Pyx_INCREF(__pyx_t_8);
  4368. __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indices, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error)
  4369. __Pyx_GOTREF(__pyx_t_4);
  4370. __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_13);
  4371. __pyx_t_13 = 0;
  4372. __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_11);
  4373. __pyx_t_11 = 0;
  4374. __Pyx_XDECREF_SET(__pyx_v_ri1, __pyx_t_8);
  4375. __pyx_t_8 = 0;
  4376. __Pyx_XDECREF_SET(__pyx_v_ri2, __pyx_t_4);
  4377. __pyx_t_4 = 0;
  4378. /* "fontTools/varLib/iup.py":131
  4379. * out.extend(
  4380. * iup_segment(
  4381. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2] # <<<<<<<<<<<<<<
  4382. * )
  4383. * )
  4384. */
  4385. __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, 131, __pyx_L1_error)
  4386. __Pyx_GOTREF(__pyx_t_4);
  4387. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)
  4388. __Pyx_GOTREF(__pyx_t_8);
  4389. __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 131, __pyx_L1_error)
  4390. __Pyx_GOTREF(__pyx_t_11);
  4391. __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_ri2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 131, __pyx_L1_error)
  4392. __Pyx_GOTREF(__pyx_t_13);
  4393. __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_ri2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 131, __pyx_L1_error)
  4394. __Pyx_GOTREF(__pyx_t_10);
  4395. /* "fontTools/varLib/iup.py":130
  4396. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4397. * out.extend(
  4398. * iup_segment( # <<<<<<<<<<<<<<
  4399. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4400. * )
  4401. */
  4402. __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, 130, __pyx_L1_error)
  4403. __Pyx_GOTREF(__pyx_t_5);
  4404. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4405. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4406. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4407. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4408. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4409. /* "fontTools/varLib/iup.py":129
  4410. * # Final segment that wraps around
  4411. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4412. * out.extend( # <<<<<<<<<<<<<<
  4413. * iup_segment(
  4414. * coords[i1:i2], coords[ri1], deltas[ri1], coords[ri2], deltas[ri2]
  4415. */
  4416. __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_t_5); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 129, __pyx_L1_error)
  4417. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4418. /* "fontTools/varLib/iup.py":126
  4419. * out.append(deltas[end])
  4420. * start = end
  4421. * if start != n - 1: # <<<<<<<<<<<<<<
  4422. * # Final segment that wraps around
  4423. * i1, i2, ri1, ri2 = start + 1, n, start, indices[0]
  4424. */
  4425. }
  4426. /* "fontTools/varLib/iup.py":135
  4427. * )
  4428. *
  4429. * assert len(deltas) == len(out), (len(deltas), len(out)) # <<<<<<<<<<<<<<
  4430. * return out
  4431. *
  4432. */
  4433. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4434. if (unlikely(__pyx_assertions_enabled())) {
  4435. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 135, __pyx_L1_error)
  4436. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_out); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 135, __pyx_L1_error)
  4437. __pyx_t_9 = (__pyx_t_2 == __pyx_t_1);
  4438. if (unlikely(!__pyx_t_9)) {
  4439. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 135, __pyx_L1_error)
  4440. __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
  4441. __Pyx_GOTREF(__pyx_t_5);
  4442. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_out); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 135, __pyx_L1_error)
  4443. __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
  4444. __Pyx_GOTREF(__pyx_t_10);
  4445. __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 135, __pyx_L1_error)
  4446. __Pyx_GOTREF(__pyx_t_13);
  4447. __Pyx_GIVEREF(__pyx_t_5);
  4448. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error);
  4449. __Pyx_GIVEREF(__pyx_t_10);
  4450. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error);
  4451. __pyx_t_5 = 0;
  4452. __pyx_t_10 = 0;
  4453. __pyx_t_10 = PyTuple_Pack(1, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
  4454. __Pyx_GOTREF(__pyx_t_10);
  4455. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  4456. __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_10, 0, 0);
  4457. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4458. __PYX_ERR(0, 135, __pyx_L1_error)
  4459. }
  4460. }
  4461. #else
  4462. if ((1)); else __PYX_ERR(0, 135, __pyx_L1_error)
  4463. #endif
  4464. /* "fontTools/varLib/iup.py":136
  4465. *
  4466. * assert len(deltas) == len(out), (len(deltas), len(out))
  4467. * return out # <<<<<<<<<<<<<<
  4468. *
  4469. *
  4470. */
  4471. __Pyx_XDECREF(__pyx_r);
  4472. __Pyx_INCREF(__pyx_v_out);
  4473. __pyx_r = __pyx_v_out;
  4474. goto __pyx_L0;
  4475. /* "fontTools/varLib/iup.py":87
  4476. *
  4477. *
  4478. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  4479. * """For the contour given in `coords`, interpolate any missing
  4480. * delta values in delta vector `deltas`.
  4481. */
  4482. /* function exit code */
  4483. __pyx_L1_error:;
  4484. __Pyx_XDECREF(__pyx_t_4);
  4485. __Pyx_XDECREF(__pyx_t_5);
  4486. __Pyx_XDECREF(__pyx_t_6);
  4487. __Pyx_XDECREF(__pyx_t_8);
  4488. __Pyx_XDECREF(__pyx_t_10);
  4489. __Pyx_XDECREF(__pyx_t_11);
  4490. __Pyx_XDECREF(__pyx_t_13);
  4491. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4492. __pyx_r = NULL;
  4493. __pyx_L0:;
  4494. __Pyx_XDECREF(__pyx_v_n);
  4495. __Pyx_XDECREF(__pyx_v_indices);
  4496. __Pyx_XDECREF(__pyx_v_out);
  4497. __Pyx_XDECREF(__pyx_v_it);
  4498. __Pyx_XDECREF(__pyx_v_start);
  4499. __Pyx_XDECREF(__pyx_v_i1);
  4500. __Pyx_XDECREF(__pyx_v_i2);
  4501. __Pyx_XDECREF(__pyx_v_ri1);
  4502. __Pyx_XDECREF(__pyx_v_ri2);
  4503. __Pyx_XDECREF(__pyx_v_end);
  4504. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
  4505. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v);
  4506. __Pyx_XGIVEREF(__pyx_r);
  4507. __Pyx_RefNannyFinishContext();
  4508. return __pyx_r;
  4509. }
  4510. /* "fontTools/varLib/iup.py":139
  4511. *
  4512. *
  4513. * def iup_delta( # <<<<<<<<<<<<<<
  4514. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4515. * ) -> _DeltaSegment:
  4516. */
  4517. /* Python wrapper */
  4518. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_3iup_delta(PyObject *__pyx_self,
  4519. #if CYTHON_METH_FASTCALL
  4520. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4521. #else
  4522. PyObject *__pyx_args, PyObject *__pyx_kwds
  4523. #endif
  4524. ); /*proto*/
  4525. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_2iup_delta, "iup_delta(deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints) -> _DeltaSegment\nFor the outline given in `coords`, with contour endpoints given\n in sorted increasing order in `ends`, interpolate any missing\n delta values in delta vector `deltas`.\n\n Returns fully filled-out delta vector.");
  4526. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_3iup_delta = {"iup_delta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_6varLib_3iup_3iup_delta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_6varLib_3iup_2iup_delta};
  4527. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_3iup_delta(PyObject *__pyx_self,
  4528. #if CYTHON_METH_FASTCALL
  4529. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4530. #else
  4531. PyObject *__pyx_args, PyObject *__pyx_kwds
  4532. #endif
  4533. ) {
  4534. PyObject *__pyx_v_deltas = 0;
  4535. PyObject *__pyx_v_coords = 0;
  4536. PyObject *__pyx_v_ends = 0;
  4537. #if !CYTHON_METH_FASTCALL
  4538. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4539. #endif
  4540. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4541. PyObject* values[3] = {0,0,0};
  4542. int __pyx_lineno = 0;
  4543. const char *__pyx_filename = NULL;
  4544. int __pyx_clineno = 0;
  4545. PyObject *__pyx_r = 0;
  4546. __Pyx_RefNannyDeclarations
  4547. __Pyx_RefNannySetupContext("iup_delta (wrapper)", 0);
  4548. #if !CYTHON_METH_FASTCALL
  4549. #if CYTHON_ASSUME_SAFE_MACROS
  4550. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4551. #else
  4552. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4553. #endif
  4554. #endif
  4555. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4556. {
  4557. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,&__pyx_n_s_ends,0};
  4558. if (__pyx_kwds) {
  4559. Py_ssize_t kw_args;
  4560. switch (__pyx_nargs) {
  4561. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  4562. CYTHON_FALLTHROUGH;
  4563. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  4564. CYTHON_FALLTHROUGH;
  4565. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4566. CYTHON_FALLTHROUGH;
  4567. case 0: break;
  4568. default: goto __pyx_L5_argtuple_error;
  4569. }
  4570. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  4571. switch (__pyx_nargs) {
  4572. case 0:
  4573. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  4574. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  4575. kw_args--;
  4576. }
  4577. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
  4578. else goto __pyx_L5_argtuple_error;
  4579. CYTHON_FALLTHROUGH;
  4580. case 1:
  4581. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  4582. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  4583. kw_args--;
  4584. }
  4585. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
  4586. else {
  4587. __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, 1); __PYX_ERR(0, 139, __pyx_L3_error)
  4588. }
  4589. CYTHON_FALLTHROUGH;
  4590. case 2:
  4591. if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ends)) != 0)) {
  4592. (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
  4593. kw_args--;
  4594. }
  4595. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
  4596. else {
  4597. __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, 2); __PYX_ERR(0, 139, __pyx_L3_error)
  4598. }
  4599. }
  4600. if (unlikely(kw_args > 0)) {
  4601. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4602. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iup_delta") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
  4603. }
  4604. } else if (unlikely(__pyx_nargs != 3)) {
  4605. goto __pyx_L5_argtuple_error;
  4606. } else {
  4607. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  4608. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  4609. values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  4610. }
  4611. __pyx_v_deltas = values[0];
  4612. __pyx_v_coords = values[1];
  4613. __pyx_v_ends = values[2];
  4614. }
  4615. goto __pyx_L6_skip;
  4616. __pyx_L5_argtuple_error:;
  4617. __Pyx_RaiseArgtupleInvalid("iup_delta", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 139, __pyx_L3_error)
  4618. __pyx_L6_skip:;
  4619. goto __pyx_L4_argument_unpacking_done;
  4620. __pyx_L3_error:;
  4621. {
  4622. Py_ssize_t __pyx_temp;
  4623. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4624. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4625. }
  4626. }
  4627. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4628. __Pyx_RefNannyFinishContext();
  4629. return NULL;
  4630. __pyx_L4_argument_unpacking_done:;
  4631. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_2iup_delta(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends);
  4632. /* function exit code */
  4633. {
  4634. Py_ssize_t __pyx_temp;
  4635. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4636. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  4637. }
  4638. }
  4639. __Pyx_RefNannyFinishContext();
  4640. return __pyx_r;
  4641. }
  4642. 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) {
  4643. PyObject *__pyx_v_n = NULL;
  4644. PyObject *__pyx_v_out = NULL;
  4645. PyObject *__pyx_v_start = NULL;
  4646. PyObject *__pyx_v_end = NULL;
  4647. PyObject *__pyx_v_contour = NULL;
  4648. PyObject *__pyx_r = NULL;
  4649. __Pyx_RefNannyDeclarations
  4650. int __pyx_t_1;
  4651. PyObject *__pyx_t_2 = NULL;
  4652. PyObject *__pyx_t_3 = NULL;
  4653. int __pyx_t_4;
  4654. int __pyx_t_5;
  4655. Py_ssize_t __pyx_t_6;
  4656. PyObject *__pyx_t_7 = NULL;
  4657. PyObject *__pyx_t_8 = NULL;
  4658. PyObject *__pyx_t_9 = NULL;
  4659. PyObject *(*__pyx_t_10)(PyObject *);
  4660. PyObject *__pyx_t_11 = NULL;
  4661. int __pyx_t_12;
  4662. int __pyx_lineno = 0;
  4663. const char *__pyx_filename = NULL;
  4664. int __pyx_clineno = 0;
  4665. __Pyx_RefNannySetupContext("iup_delta", 0);
  4666. __Pyx_INCREF(__pyx_v_ends);
  4667. /* "fontTools/varLib/iup.py":148
  4668. * Returns fully filled-out delta vector."""
  4669. *
  4670. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  4671. * n = len(coords)
  4672. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4673. */
  4674. #ifndef CYTHON_WITHOUT_ASSERTIONS
  4675. if (unlikely(__pyx_assertions_enabled())) {
  4676. __pyx_t_3 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  4677. __Pyx_GOTREF(__pyx_t_3);
  4678. __pyx_t_2 = ((PyObject*)__pyx_t_3);
  4679. __pyx_t_3 = 0;
  4680. __pyx_t_4 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 148, __pyx_L1_error)
  4681. __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, 148, __pyx_L1_error)
  4682. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4683. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
  4684. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4685. if (__pyx_t_5) {
  4686. } else {
  4687. __pyx_t_1 = __pyx_t_5;
  4688. goto __pyx_L3_bool_binop_done;
  4689. }
  4690. __pyx_t_6 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 148, __pyx_L1_error)
  4691. __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  4692. __Pyx_GOTREF(__pyx_t_3);
  4693. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
  4694. if (__pyx_t_5) {
  4695. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ends, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error)
  4696. __Pyx_GOTREF(__pyx_t_7);
  4697. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
  4698. __Pyx_GOTREF(__pyx_t_8);
  4699. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4700. __pyx_t_2 = __pyx_t_8;
  4701. __pyx_t_8 = 0;
  4702. } else {
  4703. __Pyx_INCREF(__pyx_int_0);
  4704. __pyx_t_2 = __pyx_int_0;
  4705. }
  4706. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
  4707. __Pyx_GOTREF(__pyx_t_8);
  4708. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4709. __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  4710. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4711. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4712. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
  4713. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4714. __pyx_t_1 = __pyx_t_5;
  4715. __pyx_L3_bool_binop_done:;
  4716. if (unlikely(!__pyx_t_1)) {
  4717. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  4718. __PYX_ERR(0, 148, __pyx_L1_error)
  4719. }
  4720. }
  4721. #else
  4722. if ((1)); else __PYX_ERR(0, 148, __pyx_L1_error)
  4723. #endif
  4724. /* "fontTools/varLib/iup.py":149
  4725. *
  4726. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4727. * n = len(coords) # <<<<<<<<<<<<<<
  4728. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4729. * out = []
  4730. */
  4731. __pyx_t_6 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 149, __pyx_L1_error)
  4732. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
  4733. __Pyx_GOTREF(__pyx_t_2);
  4734. __pyx_v_n = __pyx_t_2;
  4735. __pyx_t_2 = 0;
  4736. /* "fontTools/varLib/iup.py":150
  4737. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  4738. * n = len(coords)
  4739. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  4740. * out = []
  4741. * start = 0
  4742. */
  4743. __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  4744. __Pyx_GOTREF(__pyx_t_2);
  4745. __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
  4746. __Pyx_GOTREF(__pyx_t_8);
  4747. __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
  4748. __Pyx_GOTREF(__pyx_t_3);
  4749. __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
  4750. __Pyx_GOTREF(__pyx_t_7);
  4751. __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
  4752. __Pyx_GOTREF(__pyx_t_9);
  4753. __Pyx_GIVEREF(__pyx_t_2);
  4754. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error);
  4755. __Pyx_GIVEREF(__pyx_t_8);
  4756. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error);
  4757. __Pyx_GIVEREF(__pyx_t_3);
  4758. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error);
  4759. __Pyx_GIVEREF(__pyx_t_7);
  4760. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error);
  4761. __pyx_t_2 = 0;
  4762. __pyx_t_8 = 0;
  4763. __pyx_t_3 = 0;
  4764. __pyx_t_7 = 0;
  4765. __pyx_t_7 = PyNumber_Add(__pyx_v_ends, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
  4766. __Pyx_GOTREF(__pyx_t_7);
  4767. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4768. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_7);
  4769. __pyx_t_7 = 0;
  4770. /* "fontTools/varLib/iup.py":151
  4771. * n = len(coords)
  4772. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4773. * out = [] # <<<<<<<<<<<<<<
  4774. * start = 0
  4775. * for end in ends:
  4776. */
  4777. __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L1_error)
  4778. __Pyx_GOTREF(__pyx_t_7);
  4779. __pyx_v_out = ((PyObject*)__pyx_t_7);
  4780. __pyx_t_7 = 0;
  4781. /* "fontTools/varLib/iup.py":152
  4782. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  4783. * out = []
  4784. * start = 0 # <<<<<<<<<<<<<<
  4785. * for end in ends:
  4786. * end += 1
  4787. */
  4788. __Pyx_INCREF(__pyx_int_0);
  4789. __pyx_v_start = __pyx_int_0;
  4790. /* "fontTools/varLib/iup.py":153
  4791. * out = []
  4792. * start = 0
  4793. * for end in ends: # <<<<<<<<<<<<<<
  4794. * end += 1
  4795. * contour = iup_contour(deltas[start:end], coords[start:end])
  4796. */
  4797. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  4798. __pyx_t_7 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_7);
  4799. __pyx_t_6 = 0;
  4800. __pyx_t_10 = NULL;
  4801. } else {
  4802. __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error)
  4803. __Pyx_GOTREF(__pyx_t_7);
  4804. __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 153, __pyx_L1_error)
  4805. }
  4806. for (;;) {
  4807. if (likely(!__pyx_t_10)) {
  4808. if (likely(PyList_CheckExact(__pyx_t_7))) {
  4809. {
  4810. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
  4811. #if !CYTHON_ASSUME_SAFE_MACROS
  4812. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  4813. #endif
  4814. if (__pyx_t_6 >= __pyx_temp) break;
  4815. }
  4816. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4817. __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  4818. #else
  4819. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error)
  4820. __Pyx_GOTREF(__pyx_t_9);
  4821. #endif
  4822. } else {
  4823. {
  4824. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
  4825. #if !CYTHON_ASSUME_SAFE_MACROS
  4826. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  4827. #endif
  4828. if (__pyx_t_6 >= __pyx_temp) break;
  4829. }
  4830. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4831. __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  4832. #else
  4833. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 153, __pyx_L1_error)
  4834. __Pyx_GOTREF(__pyx_t_9);
  4835. #endif
  4836. }
  4837. } else {
  4838. __pyx_t_9 = __pyx_t_10(__pyx_t_7);
  4839. if (unlikely(!__pyx_t_9)) {
  4840. PyObject* exc_type = PyErr_Occurred();
  4841. if (exc_type) {
  4842. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4843. else __PYX_ERR(0, 153, __pyx_L1_error)
  4844. }
  4845. break;
  4846. }
  4847. __Pyx_GOTREF(__pyx_t_9);
  4848. }
  4849. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_9);
  4850. __pyx_t_9 = 0;
  4851. /* "fontTools/varLib/iup.py":154
  4852. * start = 0
  4853. * for end in ends:
  4854. * end += 1 # <<<<<<<<<<<<<<
  4855. * contour = iup_contour(deltas[start:end], coords[start:end])
  4856. * out.extend(contour)
  4857. */
  4858. __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_end, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 154, __pyx_L1_error)
  4859. __Pyx_GOTREF(__pyx_t_9);
  4860. __Pyx_DECREF_SET(__pyx_v_end, __pyx_t_9);
  4861. __pyx_t_9 = 0;
  4862. /* "fontTools/varLib/iup.py":155
  4863. * for end in ends:
  4864. * end += 1
  4865. * contour = iup_contour(deltas[start:end], coords[start:end]) # <<<<<<<<<<<<<<
  4866. * out.extend(contour)
  4867. * start = end
  4868. */
  4869. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_iup_contour); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
  4870. __Pyx_GOTREF(__pyx_t_3);
  4871. __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_deltas, 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error)
  4872. __Pyx_GOTREF(__pyx_t_8);
  4873. __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_start, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
  4874. __Pyx_GOTREF(__pyx_t_2);
  4875. __pyx_t_11 = NULL;
  4876. __pyx_t_12 = 0;
  4877. #if CYTHON_UNPACK_METHODS
  4878. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4879. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
  4880. if (likely(__pyx_t_11)) {
  4881. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4882. __Pyx_INCREF(__pyx_t_11);
  4883. __Pyx_INCREF(function);
  4884. __Pyx_DECREF_SET(__pyx_t_3, function);
  4885. __pyx_t_12 = 1;
  4886. }
  4887. }
  4888. #endif
  4889. {
  4890. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_2};
  4891. __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_12, 2+__pyx_t_12);
  4892. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  4893. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4894. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4895. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 155, __pyx_L1_error)
  4896. __Pyx_GOTREF(__pyx_t_9);
  4897. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4898. }
  4899. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_9);
  4900. __pyx_t_9 = 0;
  4901. /* "fontTools/varLib/iup.py":156
  4902. * end += 1
  4903. * contour = iup_contour(deltas[start:end], coords[start:end])
  4904. * out.extend(contour) # <<<<<<<<<<<<<<
  4905. * start = end
  4906. *
  4907. */
  4908. __pyx_t_4 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_v_contour); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 156, __pyx_L1_error)
  4909. /* "fontTools/varLib/iup.py":157
  4910. * contour = iup_contour(deltas[start:end], coords[start:end])
  4911. * out.extend(contour)
  4912. * start = end # <<<<<<<<<<<<<<
  4913. *
  4914. * return out
  4915. */
  4916. __Pyx_INCREF(__pyx_v_end);
  4917. __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_end);
  4918. /* "fontTools/varLib/iup.py":153
  4919. * out = []
  4920. * start = 0
  4921. * for end in ends: # <<<<<<<<<<<<<<
  4922. * end += 1
  4923. * contour = iup_contour(deltas[start:end], coords[start:end])
  4924. */
  4925. }
  4926. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4927. /* "fontTools/varLib/iup.py":159
  4928. * start = end
  4929. *
  4930. * return out # <<<<<<<<<<<<<<
  4931. *
  4932. *
  4933. */
  4934. __Pyx_XDECREF(__pyx_r);
  4935. __Pyx_INCREF(__pyx_v_out);
  4936. __pyx_r = __pyx_v_out;
  4937. goto __pyx_L0;
  4938. /* "fontTools/varLib/iup.py":139
  4939. *
  4940. *
  4941. * def iup_delta( # <<<<<<<<<<<<<<
  4942. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  4943. * ) -> _DeltaSegment:
  4944. */
  4945. /* function exit code */
  4946. __pyx_L1_error:;
  4947. __Pyx_XDECREF(__pyx_t_2);
  4948. __Pyx_XDECREF(__pyx_t_3);
  4949. __Pyx_XDECREF(__pyx_t_7);
  4950. __Pyx_XDECREF(__pyx_t_8);
  4951. __Pyx_XDECREF(__pyx_t_9);
  4952. __Pyx_XDECREF(__pyx_t_11);
  4953. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4954. __pyx_r = NULL;
  4955. __pyx_L0:;
  4956. __Pyx_XDECREF(__pyx_v_n);
  4957. __Pyx_XDECREF(__pyx_v_out);
  4958. __Pyx_XDECREF(__pyx_v_start);
  4959. __Pyx_XDECREF(__pyx_v_end);
  4960. __Pyx_XDECREF(__pyx_v_contour);
  4961. __Pyx_XDECREF(__pyx_v_ends);
  4962. __Pyx_XGIVEREF(__pyx_r);
  4963. __Pyx_RefNannyFinishContext();
  4964. return __pyx_r;
  4965. }
  4966. 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 */
  4967. /* "fontTools/varLib/iup.py":193
  4968. *
  4969. * return all(
  4970. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  4971. * for (x, y), (p, q) in zip(deltas, interp)
  4972. * )
  4973. */
  4974. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  4975. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  4976. PyObject *__pyx_r = NULL;
  4977. __Pyx_RefNannyDeclarations
  4978. int __pyx_lineno = 0;
  4979. const char *__pyx_filename = NULL;
  4980. int __pyx_clineno = 0;
  4981. __Pyx_RefNannySetupContext("genexpr", 0);
  4982. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  4983. if (unlikely(!__pyx_cur_scope)) {
  4984. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)Py_None);
  4985. __Pyx_INCREF(Py_None);
  4986. __PYX_ERR(0, 193, __pyx_L1_error)
  4987. } else {
  4988. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  4989. }
  4990. __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;
  4991. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4992. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  4993. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  4994. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4995. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  4996. {
  4997. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_can_iup_in_between_locals_genexp, __pyx_n_s_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 193, __pyx_L1_error)
  4998. __Pyx_DECREF(__pyx_cur_scope);
  4999. __Pyx_RefNannyFinishContext();
  5000. return (PyObject *) gen;
  5001. }
  5002. /* function exit code */
  5003. __pyx_L1_error:;
  5004. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5005. __pyx_r = NULL;
  5006. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  5007. __Pyx_XGIVEREF(__pyx_r);
  5008. __Pyx_RefNannyFinishContext();
  5009. return __pyx_r;
  5010. }
  5011. 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 */
  5012. {
  5013. 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);
  5014. PyObject *__pyx_r = NULL;
  5015. PyObject *__pyx_t_1 = NULL;
  5016. Py_ssize_t __pyx_t_2;
  5017. PyObject *(*__pyx_t_3)(PyObject *);
  5018. PyObject *__pyx_t_4 = NULL;
  5019. PyObject *__pyx_t_5 = NULL;
  5020. PyObject *__pyx_t_6 = NULL;
  5021. PyObject *__pyx_t_7 = NULL;
  5022. PyObject *(*__pyx_t_8)(PyObject *);
  5023. PyObject *__pyx_t_9 = NULL;
  5024. PyObject *__pyx_t_10 = NULL;
  5025. double __pyx_t_11;
  5026. double __pyx_t_12;
  5027. int __pyx_t_13;
  5028. int __pyx_t_14;
  5029. int __pyx_lineno = 0;
  5030. const char *__pyx_filename = NULL;
  5031. int __pyx_clineno = 0;
  5032. __Pyx_RefNannyDeclarations
  5033. __Pyx_RefNannySetupContext("genexpr", 0);
  5034. switch (__pyx_generator->resume_label) {
  5035. case 0: goto __pyx_L3_first_run;
  5036. default: /* CPython raises the right error here */
  5037. __Pyx_RefNannyFinishContext();
  5038. return NULL;
  5039. }
  5040. __pyx_L3_first_run:;
  5041. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 193, __pyx_L1_error)
  5042. /* "fontTools/varLib/iup.py":194
  5043. * return all(
  5044. * abs(complex(x - p, y - q)) <= tolerance
  5045. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  5046. * )
  5047. *
  5048. */
  5049. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 194, __pyx_L1_error) }
  5050. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  5051. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  5052. __pyx_t_2 = 0;
  5053. __pyx_t_3 = NULL;
  5054. } else {
  5055. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
  5056. __Pyx_GOTREF(__pyx_t_1);
  5057. __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
  5058. }
  5059. for (;;) {
  5060. if (likely(!__pyx_t_3)) {
  5061. if (likely(PyList_CheckExact(__pyx_t_1))) {
  5062. {
  5063. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  5064. #if !CYTHON_ASSUME_SAFE_MACROS
  5065. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 194, __pyx_L1_error)
  5066. #endif
  5067. if (__pyx_t_2 >= __pyx_temp) break;
  5068. }
  5069. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5070. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 194, __pyx_L1_error)
  5071. #else
  5072. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
  5073. __Pyx_GOTREF(__pyx_t_4);
  5074. #endif
  5075. } else {
  5076. {
  5077. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  5078. #if !CYTHON_ASSUME_SAFE_MACROS
  5079. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 194, __pyx_L1_error)
  5080. #endif
  5081. if (__pyx_t_2 >= __pyx_temp) break;
  5082. }
  5083. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5084. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 194, __pyx_L1_error)
  5085. #else
  5086. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
  5087. __Pyx_GOTREF(__pyx_t_4);
  5088. #endif
  5089. }
  5090. } else {
  5091. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  5092. if (unlikely(!__pyx_t_4)) {
  5093. PyObject* exc_type = PyErr_Occurred();
  5094. if (exc_type) {
  5095. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5096. else __PYX_ERR(0, 194, __pyx_L1_error)
  5097. }
  5098. break;
  5099. }
  5100. __Pyx_GOTREF(__pyx_t_4);
  5101. }
  5102. if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
  5103. PyObject* sequence = __pyx_t_4;
  5104. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5105. if (unlikely(size != 2)) {
  5106. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5107. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5108. __PYX_ERR(0, 194, __pyx_L1_error)
  5109. }
  5110. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5111. if (likely(PyTuple_CheckExact(sequence))) {
  5112. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  5113. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  5114. } else {
  5115. __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
  5116. __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
  5117. }
  5118. __Pyx_INCREF(__pyx_t_5);
  5119. __Pyx_INCREF(__pyx_t_6);
  5120. #else
  5121. __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
  5122. __Pyx_GOTREF(__pyx_t_5);
  5123. __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
  5124. __Pyx_GOTREF(__pyx_t_6);
  5125. #endif
  5126. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5127. } else {
  5128. Py_ssize_t index = -1;
  5129. __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
  5130. __Pyx_GOTREF(__pyx_t_7);
  5131. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5132. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  5133. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
  5134. __Pyx_GOTREF(__pyx_t_5);
  5135. index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
  5136. __Pyx_GOTREF(__pyx_t_6);
  5137. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
  5138. __pyx_t_8 = NULL;
  5139. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5140. goto __pyx_L7_unpacking_done;
  5141. __pyx_L6_unpacking_failed:;
  5142. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5143. __pyx_t_8 = NULL;
  5144. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  5145. __PYX_ERR(0, 194, __pyx_L1_error)
  5146. __pyx_L7_unpacking_done:;
  5147. }
  5148. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  5149. PyObject* sequence = __pyx_t_5;
  5150. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5151. if (unlikely(size != 2)) {
  5152. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5153. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5154. __PYX_ERR(0, 194, __pyx_L1_error)
  5155. }
  5156. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5157. if (likely(PyTuple_CheckExact(sequence))) {
  5158. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  5159. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  5160. } else {
  5161. __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
  5162. __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
  5163. }
  5164. __Pyx_INCREF(__pyx_t_7);
  5165. __Pyx_INCREF(__pyx_t_9);
  5166. #else
  5167. __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
  5168. __Pyx_GOTREF(__pyx_t_7);
  5169. __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error)
  5170. __Pyx_GOTREF(__pyx_t_9);
  5171. #endif
  5172. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5173. } else {
  5174. Py_ssize_t index = -1;
  5175. __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 194, __pyx_L1_error)
  5176. __Pyx_GOTREF(__pyx_t_10);
  5177. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5178. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  5179. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
  5180. __Pyx_GOTREF(__pyx_t_7);
  5181. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
  5182. __Pyx_GOTREF(__pyx_t_9);
  5183. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
  5184. __pyx_t_8 = NULL;
  5185. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5186. goto __pyx_L9_unpacking_done;
  5187. __pyx_L8_unpacking_failed:;
  5188. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5189. __pyx_t_8 = NULL;
  5190. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  5191. __PYX_ERR(0, 194, __pyx_L1_error)
  5192. __pyx_L9_unpacking_done:;
  5193. }
  5194. __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
  5195. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5196. __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
  5197. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5198. __pyx_cur_scope->__pyx_v_x = __pyx_t_11;
  5199. __pyx_cur_scope->__pyx_v_y = __pyx_t_12;
  5200. if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
  5201. PyObject* sequence = __pyx_t_6;
  5202. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5203. if (unlikely(size != 2)) {
  5204. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5205. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5206. __PYX_ERR(0, 194, __pyx_L1_error)
  5207. }
  5208. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5209. if (likely(PyTuple_CheckExact(sequence))) {
  5210. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  5211. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  5212. } else {
  5213. __pyx_t_9 = PyList_GET_ITEM(sequence, 0);
  5214. __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
  5215. }
  5216. __Pyx_INCREF(__pyx_t_9);
  5217. __Pyx_INCREF(__pyx_t_7);
  5218. #else
  5219. __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error)
  5220. __Pyx_GOTREF(__pyx_t_9);
  5221. __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
  5222. __Pyx_GOTREF(__pyx_t_7);
  5223. #endif
  5224. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5225. } else {
  5226. Py_ssize_t index = -1;
  5227. __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 194, __pyx_L1_error)
  5228. __Pyx_GOTREF(__pyx_t_10);
  5229. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5230. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  5231. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
  5232. __Pyx_GOTREF(__pyx_t_9);
  5233. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
  5234. __Pyx_GOTREF(__pyx_t_7);
  5235. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
  5236. __pyx_t_8 = NULL;
  5237. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5238. goto __pyx_L11_unpacking_done;
  5239. __pyx_L10_unpacking_failed:;
  5240. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5241. __pyx_t_8 = NULL;
  5242. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  5243. __PYX_ERR(0, 194, __pyx_L1_error)
  5244. __pyx_L11_unpacking_done:;
  5245. }
  5246. __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
  5247. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  5248. __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
  5249. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5250. __pyx_cur_scope->__pyx_v_p = __pyx_t_12;
  5251. __pyx_cur_scope->__pyx_v_q = __pyx_t_11;
  5252. /* "fontTools/varLib/iup.py":193
  5253. *
  5254. * return all(
  5255. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5256. * for (x, y), (p, q) in zip(deltas, interp)
  5257. * )
  5258. */
  5259. __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_x - __pyx_cur_scope->__pyx_v_p)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
  5260. __Pyx_GOTREF(__pyx_t_4);
  5261. __pyx_t_6 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_y - __pyx_cur_scope->__pyx_v_q)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
  5262. __Pyx_GOTREF(__pyx_t_6);
  5263. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
  5264. __Pyx_GOTREF(__pyx_t_5);
  5265. __Pyx_GIVEREF(__pyx_t_4);
  5266. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error);
  5267. __Pyx_GIVEREF(__pyx_t_6);
  5268. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error);
  5269. __pyx_t_4 = 0;
  5270. __pyx_t_6 = 0;
  5271. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
  5272. __Pyx_GOTREF(__pyx_t_6);
  5273. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5274. __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
  5275. __Pyx_GOTREF(__pyx_t_5);
  5276. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5277. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 193, __pyx_L1_error) }
  5278. __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance, Py_LE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
  5279. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5280. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 193, __pyx_L1_error)
  5281. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5282. __pyx_t_14 = (!__pyx_t_13);
  5283. if (__pyx_t_14) {
  5284. /* "fontTools/varLib/iup.py":192
  5285. * deltas = deltas[i + 1 : j]
  5286. *
  5287. * return all( # <<<<<<<<<<<<<<
  5288. * abs(complex(x - p, y - q)) <= tolerance
  5289. * for (x, y), (p, q) in zip(deltas, interp)
  5290. */
  5291. __Pyx_XDECREF(__pyx_r);
  5292. /* "fontTools/varLib/iup.py":193
  5293. *
  5294. * return all(
  5295. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5296. * for (x, y), (p, q) in zip(deltas, interp)
  5297. * )
  5298. */
  5299. __Pyx_INCREF(Py_False);
  5300. __pyx_r = Py_False;
  5301. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5302. goto __pyx_L0;
  5303. }
  5304. /* "fontTools/varLib/iup.py":194
  5305. * return all(
  5306. * abs(complex(x - p, y - q)) <= tolerance
  5307. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  5308. * )
  5309. *
  5310. */
  5311. }
  5312. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5313. /*else*/ {
  5314. /* "fontTools/varLib/iup.py":192
  5315. * deltas = deltas[i + 1 : j]
  5316. *
  5317. * return all( # <<<<<<<<<<<<<<
  5318. * abs(complex(x - p, y - q)) <= tolerance
  5319. * for (x, y), (p, q) in zip(deltas, interp)
  5320. */
  5321. __Pyx_XDECREF(__pyx_r);
  5322. /* "fontTools/varLib/iup.py":193
  5323. *
  5324. * return all(
  5325. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5326. * for (x, y), (p, q) in zip(deltas, interp)
  5327. * )
  5328. */
  5329. __Pyx_INCREF(Py_True);
  5330. __pyx_r = Py_True;
  5331. goto __pyx_L0;
  5332. }
  5333. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  5334. /* function exit code */
  5335. goto __pyx_L0;
  5336. __pyx_L1_error:;
  5337. __Pyx_Generator_Replace_StopIteration(0);
  5338. __Pyx_XDECREF(__pyx_t_1);
  5339. __Pyx_XDECREF(__pyx_t_4);
  5340. __Pyx_XDECREF(__pyx_t_5);
  5341. __Pyx_XDECREF(__pyx_t_6);
  5342. __Pyx_XDECREF(__pyx_t_7);
  5343. __Pyx_XDECREF(__pyx_t_9);
  5344. __Pyx_XDECREF(__pyx_t_10);
  5345. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5346. __pyx_L0:;
  5347. __Pyx_XGIVEREF(__pyx_r);
  5348. #if !CYTHON_USE_EXC_INFO_STACK
  5349. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  5350. #endif
  5351. __pyx_generator->resume_label = -1;
  5352. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  5353. __Pyx_RefNannyFinishContext();
  5354. return __pyx_r;
  5355. }
  5356. /* "fontTools/varLib/iup.py":165
  5357. *
  5358. *
  5359. * @cython.cfunc # <<<<<<<<<<<<<<
  5360. * @cython.inline
  5361. * @cython.locals(
  5362. */
  5363. 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) {
  5364. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *__pyx_cur_scope;
  5365. PyObject *__pyx_v_interp = NULL;
  5366. PyObject *__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator = 0;
  5367. int __pyx_r;
  5368. __Pyx_RefNannyDeclarations
  5369. int __pyx_t_1;
  5370. PyObject *__pyx_t_2 = NULL;
  5371. PyObject *__pyx_t_3 = NULL;
  5372. PyObject *__pyx_t_4 = NULL;
  5373. PyObject *__pyx_t_5 = NULL;
  5374. PyObject *__pyx_t_6 = NULL;
  5375. PyObject *__pyx_t_7 = NULL;
  5376. int __pyx_t_8;
  5377. int __pyx_lineno = 0;
  5378. const char *__pyx_filename = NULL;
  5379. int __pyx_clineno = 0;
  5380. __Pyx_RefNannySetupContext("can_iup_in_between", 0);
  5381. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, __pyx_empty_tuple, NULL);
  5382. if (unlikely(!__pyx_cur_scope)) {
  5383. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between *)Py_None);
  5384. __Pyx_INCREF(Py_None);
  5385. __PYX_ERR(0, 165, __pyx_L1_error)
  5386. } else {
  5387. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  5388. }
  5389. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  5390. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  5391. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  5392. __Pyx_INCREF(__pyx_v_deltas);
  5393. /* "fontTools/varLib/iup.py":188
  5394. * provided error tolerance."""
  5395. *
  5396. * assert j - i >= 2 # <<<<<<<<<<<<<<
  5397. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5398. * deltas = deltas[i + 1 : j]
  5399. */
  5400. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5401. if (unlikely(__pyx_assertions_enabled())) {
  5402. __pyx_t_1 = ((__pyx_v_j - __pyx_v_i) >= 2);
  5403. if (unlikely(!__pyx_t_1)) {
  5404. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  5405. __PYX_ERR(0, 188, __pyx_L1_error)
  5406. }
  5407. }
  5408. #else
  5409. if ((1)); else __PYX_ERR(0, 188, __pyx_L1_error)
  5410. #endif
  5411. /* "fontTools/varLib/iup.py":189
  5412. *
  5413. * assert j - i >= 2
  5414. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j]) # <<<<<<<<<<<<<<
  5415. * deltas = deltas[i + 1 : j]
  5416. *
  5417. */
  5418. __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, 189, __pyx_L1_error)
  5419. __Pyx_GOTREF(__pyx_t_2);
  5420. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_coords, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
  5421. __Pyx_GOTREF(__pyx_t_3);
  5422. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_deltas, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
  5423. __Pyx_GOTREF(__pyx_t_4);
  5424. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_coords, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
  5425. __Pyx_GOTREF(__pyx_t_5);
  5426. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_deltas, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error)
  5427. __Pyx_GOTREF(__pyx_t_6);
  5428. __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, 189, __pyx_L1_error)
  5429. __Pyx_GOTREF(__pyx_t_7);
  5430. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5431. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5432. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5433. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5434. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5435. __pyx_v_interp = __pyx_t_7;
  5436. __pyx_t_7 = 0;
  5437. /* "fontTools/varLib/iup.py":190
  5438. * assert j - i >= 2
  5439. * interp = iup_segment(coords[i + 1 : j], coords[i], deltas[i], coords[j], deltas[j])
  5440. * deltas = deltas[i + 1 : j] # <<<<<<<<<<<<<<
  5441. *
  5442. * return all(
  5443. */
  5444. __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, 190, __pyx_L1_error)
  5445. __Pyx_GOTREF(__pyx_t_7);
  5446. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_7);
  5447. __pyx_t_7 = 0;
  5448. /* "fontTools/varLib/iup.py":194
  5449. * return all(
  5450. * abs(complex(x - p, y - q)) <= tolerance
  5451. * for (x, y), (p, q) in zip(deltas, interp) # <<<<<<<<<<<<<<
  5452. * )
  5453. *
  5454. */
  5455. __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
  5456. __Pyx_GOTREF(__pyx_t_7);
  5457. __Pyx_INCREF(__pyx_v_deltas);
  5458. __Pyx_GIVEREF(__pyx_v_deltas);
  5459. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_deltas)) __PYX_ERR(0, 194, __pyx_L1_error);
  5460. __Pyx_INCREF(__pyx_v_interp);
  5461. __Pyx_GIVEREF(__pyx_v_interp);
  5462. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_interp)) __PYX_ERR(0, 194, __pyx_L1_error);
  5463. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
  5464. __Pyx_GOTREF(__pyx_t_6);
  5465. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5466. /* "fontTools/varLib/iup.py":193
  5467. *
  5468. * return all(
  5469. * abs(complex(x - p, y - q)) <= tolerance # <<<<<<<<<<<<<<
  5470. * for (x, y), (p, q) in zip(deltas, interp)
  5471. * )
  5472. */
  5473. __pyx_t_7 = __pyx_pf_9fontTools_6varLib_3iup_18can_iup_in_between_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error)
  5474. __Pyx_GOTREF(__pyx_t_7);
  5475. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5476. __pyx_t_6 = __Pyx_Generator_Next(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
  5477. __Pyx_GOTREF(__pyx_t_6);
  5478. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5479. __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error)
  5480. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5481. __pyx_r = __pyx_t_8;
  5482. goto __pyx_L0;
  5483. /* "fontTools/varLib/iup.py":165
  5484. *
  5485. *
  5486. * @cython.cfunc # <<<<<<<<<<<<<<
  5487. * @cython.inline
  5488. * @cython.locals(
  5489. */
  5490. /* function exit code */
  5491. __pyx_L1_error:;
  5492. __Pyx_XDECREF(__pyx_t_2);
  5493. __Pyx_XDECREF(__pyx_t_3);
  5494. __Pyx_XDECREF(__pyx_t_4);
  5495. __Pyx_XDECREF(__pyx_t_5);
  5496. __Pyx_XDECREF(__pyx_t_6);
  5497. __Pyx_XDECREF(__pyx_t_7);
  5498. __Pyx_AddTraceback("fontTools.varLib.iup.can_iup_in_between", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5499. __pyx_r = -1;
  5500. __pyx_L0:;
  5501. __Pyx_XDECREF(__pyx_v_interp);
  5502. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_18can_iup_in_between_2generator);
  5503. __Pyx_XDECREF(__pyx_v_deltas);
  5504. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  5505. __Pyx_RefNannyFinishContext();
  5506. return __pyx_r;
  5507. }
  5508. /* "fontTools/varLib/iup.py":198
  5509. *
  5510. *
  5511. * @cython.locals( # <<<<<<<<<<<<<<
  5512. * cj=cython.double,
  5513. * dj=cython.double,
  5514. */
  5515. /* Python wrapper */
  5516. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set(PyObject *__pyx_self,
  5517. #if CYTHON_METH_FASTCALL
  5518. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5519. #else
  5520. PyObject *__pyx_args, PyObject *__pyx_kwds
  5521. #endif
  5522. ); /*proto*/
  5523. 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\nThe forced set is a conservative set of points on the contour that must be encoded\n explicitly (ie. cannot be interpolated). Calculating this set allows for significantly\n speeding up the dynamic-programming, as well as resolve circularity in DP.\n\n The set is precise; that is, if an index is in the returned set, then there is no way\n that IUP can generate delta for that point, given `coords` and `deltas`.\n ");
  5524. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set = {"_iup_contour_bound_forced_set", (PyCFunction)(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};
  5525. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set(PyObject *__pyx_self,
  5526. #if CYTHON_METH_FASTCALL
  5527. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5528. #else
  5529. PyObject *__pyx_args, PyObject *__pyx_kwds
  5530. #endif
  5531. ) {
  5532. PyObject *__pyx_v_deltas = 0;
  5533. PyObject *__pyx_v_coords = 0;
  5534. PyObject *__pyx_v_tolerance = 0;
  5535. #if !CYTHON_METH_FASTCALL
  5536. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5537. #endif
  5538. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5539. PyObject* values[3] = {0,0,0};
  5540. int __pyx_lineno = 0;
  5541. const char *__pyx_filename = NULL;
  5542. int __pyx_clineno = 0;
  5543. PyObject *__pyx_r = 0;
  5544. __Pyx_RefNannyDeclarations
  5545. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set (wrapper)", 0);
  5546. #if !CYTHON_METH_FASTCALL
  5547. #if CYTHON_ASSUME_SAFE_MACROS
  5548. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5549. #else
  5550. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5551. #endif
  5552. #endif
  5553. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5554. {
  5555. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,&__pyx_n_s_tolerance,0};
  5556. values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0)));
  5557. if (__pyx_kwds) {
  5558. Py_ssize_t kw_args;
  5559. switch (__pyx_nargs) {
  5560. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  5561. CYTHON_FALLTHROUGH;
  5562. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  5563. CYTHON_FALLTHROUGH;
  5564. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  5565. CYTHON_FALLTHROUGH;
  5566. case 0: break;
  5567. default: goto __pyx_L5_argtuple_error;
  5568. }
  5569. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  5570. switch (__pyx_nargs) {
  5571. case 0:
  5572. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  5573. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  5574. kw_args--;
  5575. }
  5576. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error)
  5577. else goto __pyx_L5_argtuple_error;
  5578. CYTHON_FALLTHROUGH;
  5579. case 1:
  5580. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  5581. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  5582. kw_args--;
  5583. }
  5584. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error)
  5585. else {
  5586. __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, 1); __PYX_ERR(0, 198, __pyx_L3_error)
  5587. }
  5588. CYTHON_FALLTHROUGH;
  5589. case 2:
  5590. if (kw_args > 0) {
  5591. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tolerance);
  5592. if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  5593. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L3_error)
  5594. }
  5595. }
  5596. if (unlikely(kw_args > 0)) {
  5597. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5598. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_iup_contour_bound_forced_set") < 0)) __PYX_ERR(0, 198, __pyx_L3_error)
  5599. }
  5600. } else {
  5601. switch (__pyx_nargs) {
  5602. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  5603. CYTHON_FALLTHROUGH;
  5604. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  5605. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  5606. break;
  5607. default: goto __pyx_L5_argtuple_error;
  5608. }
  5609. }
  5610. __pyx_v_deltas = values[0];
  5611. __pyx_v_coords = values[1];
  5612. __pyx_v_tolerance = values[2];
  5613. }
  5614. goto __pyx_L6_skip;
  5615. __pyx_L5_argtuple_error:;
  5616. __Pyx_RaiseArgtupleInvalid("_iup_contour_bound_forced_set", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 198, __pyx_L3_error)
  5617. __pyx_L6_skip:;
  5618. goto __pyx_L4_argument_unpacking_done;
  5619. __pyx_L3_error:;
  5620. {
  5621. Py_ssize_t __pyx_temp;
  5622. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5623. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  5624. }
  5625. }
  5626. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5627. __Pyx_RefNannyFinishContext();
  5628. return NULL;
  5629. __pyx_L4_argument_unpacking_done:;
  5630. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_4_iup_contour_bound_forced_set(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  5631. /* function exit code */
  5632. {
  5633. Py_ssize_t __pyx_temp;
  5634. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5635. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  5636. }
  5637. }
  5638. __Pyx_RefNannyFinishContext();
  5639. return __pyx_r;
  5640. }
  5641. 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) {
  5642. double __pyx_v_cj;
  5643. double __pyx_v_dj;
  5644. double __pyx_v_lcj;
  5645. double __pyx_v_ldj;
  5646. double __pyx_v_ncj;
  5647. double __pyx_v_ndj;
  5648. int __pyx_v_force;
  5649. PyObject *__pyx_v_forced = 0;
  5650. PyObject *__pyx_v_n = NULL;
  5651. PyObject *__pyx_v_i = NULL;
  5652. PyObject *__pyx_v_ld = NULL;
  5653. PyObject *__pyx_v_lc = NULL;
  5654. PyObject *__pyx_v_d = NULL;
  5655. PyObject *__pyx_v_c = NULL;
  5656. PyObject *__pyx_v_nd = NULL;
  5657. PyObject *__pyx_v_nc = NULL;
  5658. PyObject *__pyx_v_j = NULL;
  5659. double __pyx_v_c1;
  5660. double __pyx_v_c2;
  5661. double __pyx_v_d1;
  5662. double __pyx_v_d2;
  5663. PyObject *__pyx_r = NULL;
  5664. __Pyx_RefNannyDeclarations
  5665. Py_ssize_t __pyx_t_1;
  5666. Py_ssize_t __pyx_t_2;
  5667. int __pyx_t_3;
  5668. PyObject *__pyx_t_4 = NULL;
  5669. PyObject *__pyx_t_5 = NULL;
  5670. PyObject *(*__pyx_t_6)(PyObject *);
  5671. PyObject *__pyx_t_7 = NULL;
  5672. PyObject *__pyx_t_8 = NULL;
  5673. double __pyx_t_9;
  5674. double __pyx_t_10;
  5675. int __pyx_t_11;
  5676. double __pyx_t_12;
  5677. PyObject *__pyx_t_13 = NULL;
  5678. PyObject *__pyx_t_14 = NULL;
  5679. PyObject *__pyx_t_15 = NULL;
  5680. int __pyx_t_16;
  5681. int __pyx_lineno = 0;
  5682. const char *__pyx_filename = NULL;
  5683. int __pyx_clineno = 0;
  5684. __Pyx_RefNannySetupContext("_iup_contour_bound_forced_set", 1);
  5685. /* "fontTools/varLib/iup.py":218
  5686. * that IUP can generate delta for that point, given `coords` and `deltas`.
  5687. * """
  5688. * assert len(deltas) == len(coords) # <<<<<<<<<<<<<<
  5689. *
  5690. * n = len(deltas)
  5691. */
  5692. #ifndef CYTHON_WITHOUT_ASSERTIONS
  5693. if (unlikely(__pyx_assertions_enabled())) {
  5694. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 218, __pyx_L1_error)
  5695. __pyx_t_2 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 218, __pyx_L1_error)
  5696. __pyx_t_3 = (__pyx_t_1 == __pyx_t_2);
  5697. if (unlikely(!__pyx_t_3)) {
  5698. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  5699. __PYX_ERR(0, 218, __pyx_L1_error)
  5700. }
  5701. }
  5702. #else
  5703. if ((1)); else __PYX_ERR(0, 218, __pyx_L1_error)
  5704. #endif
  5705. /* "fontTools/varLib/iup.py":220
  5706. * assert len(deltas) == len(coords)
  5707. *
  5708. * n = len(deltas) # <<<<<<<<<<<<<<
  5709. * forced = set()
  5710. * # Track "last" and "next" points on the contour as we sweep.
  5711. */
  5712. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 220, __pyx_L1_error)
  5713. __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
  5714. __Pyx_GOTREF(__pyx_t_4);
  5715. __pyx_v_n = __pyx_t_4;
  5716. __pyx_t_4 = 0;
  5717. /* "fontTools/varLib/iup.py":221
  5718. *
  5719. * n = len(deltas)
  5720. * forced = set() # <<<<<<<<<<<<<<
  5721. * # Track "last" and "next" points on the contour as we sweep.
  5722. * for i in range(len(deltas) - 1, -1, -1):
  5723. */
  5724. __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
  5725. __Pyx_GOTREF(__pyx_t_4);
  5726. __pyx_v_forced = ((PyObject*)__pyx_t_4);
  5727. __pyx_t_4 = 0;
  5728. /* "fontTools/varLib/iup.py":223
  5729. * forced = set()
  5730. * # Track "last" and "next" points on the contour as we sweep.
  5731. * for i in range(len(deltas) - 1, -1, -1): # <<<<<<<<<<<<<<
  5732. * ld, lc = deltas[i - 1], coords[i - 1]
  5733. * d, c = deltas[i], coords[i]
  5734. */
  5735. __pyx_t_2 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 223, __pyx_L1_error)
  5736. __pyx_t_4 = PyInt_FromSsize_t((__pyx_t_2 - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  5737. __Pyx_GOTREF(__pyx_t_4);
  5738. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error)
  5739. __Pyx_GOTREF(__pyx_t_5);
  5740. __Pyx_GIVEREF(__pyx_t_4);
  5741. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error);
  5742. __Pyx_INCREF(__pyx_int_neg_1);
  5743. __Pyx_GIVEREF(__pyx_int_neg_1);
  5744. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_neg_1)) __PYX_ERR(0, 223, __pyx_L1_error);
  5745. __Pyx_INCREF(__pyx_int_neg_1);
  5746. __Pyx_GIVEREF(__pyx_int_neg_1);
  5747. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_neg_1)) __PYX_ERR(0, 223, __pyx_L1_error);
  5748. __pyx_t_4 = 0;
  5749. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  5750. __Pyx_GOTREF(__pyx_t_4);
  5751. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5752. if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
  5753. __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
  5754. __pyx_t_2 = 0;
  5755. __pyx_t_6 = NULL;
  5756. } else {
  5757. __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error)
  5758. __Pyx_GOTREF(__pyx_t_5);
  5759. __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error)
  5760. }
  5761. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5762. for (;;) {
  5763. if (likely(!__pyx_t_6)) {
  5764. if (likely(PyList_CheckExact(__pyx_t_5))) {
  5765. {
  5766. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  5767. #if !CYTHON_ASSUME_SAFE_MACROS
  5768. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5769. #endif
  5770. if (__pyx_t_2 >= __pyx_temp) break;
  5771. }
  5772. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5773. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5774. #else
  5775. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  5776. __Pyx_GOTREF(__pyx_t_4);
  5777. #endif
  5778. } else {
  5779. {
  5780. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  5781. #if !CYTHON_ASSUME_SAFE_MACROS
  5782. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5783. #endif
  5784. if (__pyx_t_2 >= __pyx_temp) break;
  5785. }
  5786. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5787. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 223, __pyx_L1_error)
  5788. #else
  5789. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  5790. __Pyx_GOTREF(__pyx_t_4);
  5791. #endif
  5792. }
  5793. } else {
  5794. __pyx_t_4 = __pyx_t_6(__pyx_t_5);
  5795. if (unlikely(!__pyx_t_4)) {
  5796. PyObject* exc_type = PyErr_Occurred();
  5797. if (exc_type) {
  5798. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5799. else __PYX_ERR(0, 223, __pyx_L1_error)
  5800. }
  5801. break;
  5802. }
  5803. __Pyx_GOTREF(__pyx_t_4);
  5804. }
  5805. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
  5806. __pyx_t_4 = 0;
  5807. /* "fontTools/varLib/iup.py":224
  5808. * # Track "last" and "next" points on the contour as we sweep.
  5809. * for i in range(len(deltas) - 1, -1, -1):
  5810. * ld, lc = deltas[i - 1], coords[i - 1] # <<<<<<<<<<<<<<
  5811. * d, c = deltas[i], coords[i]
  5812. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5813. */
  5814. __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
  5815. __Pyx_GOTREF(__pyx_t_4);
  5816. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
  5817. __Pyx_GOTREF(__pyx_t_7);
  5818. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5819. __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
  5820. __Pyx_GOTREF(__pyx_t_4);
  5821. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error)
  5822. __Pyx_GOTREF(__pyx_t_8);
  5823. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5824. __Pyx_XDECREF_SET(__pyx_v_ld, __pyx_t_7);
  5825. __pyx_t_7 = 0;
  5826. __Pyx_XDECREF_SET(__pyx_v_lc, __pyx_t_8);
  5827. __pyx_t_8 = 0;
  5828. /* "fontTools/varLib/iup.py":225
  5829. * for i in range(len(deltas) - 1, -1, -1):
  5830. * ld, lc = deltas[i - 1], coords[i - 1]
  5831. * d, c = deltas[i], coords[i] # <<<<<<<<<<<<<<
  5832. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5833. *
  5834. */
  5835. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 225, __pyx_L1_error)
  5836. __Pyx_GOTREF(__pyx_t_8);
  5837. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 225, __pyx_L1_error)
  5838. __Pyx_GOTREF(__pyx_t_7);
  5839. __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_8);
  5840. __pyx_t_8 = 0;
  5841. __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_7);
  5842. __pyx_t_7 = 0;
  5843. /* "fontTools/varLib/iup.py":226
  5844. * ld, lc = deltas[i - 1], coords[i - 1]
  5845. * d, c = deltas[i], coords[i]
  5846. * nd, nc = deltas[i - n + 1], coords[i - n + 1] # <<<<<<<<<<<<<<
  5847. *
  5848. * for j in (0, 1): # For X and for Y
  5849. */
  5850. __pyx_t_7 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error)
  5851. __Pyx_GOTREF(__pyx_t_7);
  5852. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 226, __pyx_L1_error)
  5853. __Pyx_GOTREF(__pyx_t_8);
  5854. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5855. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error)
  5856. __Pyx_GOTREF(__pyx_t_7);
  5857. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5858. __pyx_t_8 = PyNumber_Subtract(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 226, __pyx_L1_error)
  5859. __Pyx_GOTREF(__pyx_t_8);
  5860. __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  5861. __Pyx_GOTREF(__pyx_t_4);
  5862. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5863. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 226, __pyx_L1_error)
  5864. __Pyx_GOTREF(__pyx_t_8);
  5865. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5866. __Pyx_XDECREF_SET(__pyx_v_nd, __pyx_t_7);
  5867. __pyx_t_7 = 0;
  5868. __Pyx_XDECREF_SET(__pyx_v_nc, __pyx_t_8);
  5869. __pyx_t_8 = 0;
  5870. /* "fontTools/varLib/iup.py":228
  5871. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  5872. *
  5873. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  5874. * cj = c[j]
  5875. * dj = d[j]
  5876. */
  5877. __pyx_t_8 = __pyx_tuple_; __Pyx_INCREF(__pyx_t_8);
  5878. __pyx_t_1 = 0;
  5879. for (;;) {
  5880. if (__pyx_t_1 >= 2) break;
  5881. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5882. __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 228, __pyx_L1_error)
  5883. #else
  5884. __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 228, __pyx_L1_error)
  5885. __Pyx_GOTREF(__pyx_t_7);
  5886. #endif
  5887. __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_7);
  5888. __pyx_t_7 = 0;
  5889. /* "fontTools/varLib/iup.py":229
  5890. *
  5891. * for j in (0, 1): # For X and for Y
  5892. * cj = c[j] # <<<<<<<<<<<<<<
  5893. * dj = d[j]
  5894. * lcj = lc[j]
  5895. */
  5896. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_c, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L1_error)
  5897. __Pyx_GOTREF(__pyx_t_7);
  5898. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error)
  5899. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5900. __pyx_v_cj = __pyx_t_9;
  5901. /* "fontTools/varLib/iup.py":230
  5902. * for j in (0, 1): # For X and for Y
  5903. * cj = c[j]
  5904. * dj = d[j] # <<<<<<<<<<<<<<
  5905. * lcj = lc[j]
  5906. * ldj = ld[j]
  5907. */
  5908. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_d, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
  5909. __Pyx_GOTREF(__pyx_t_7);
  5910. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error)
  5911. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5912. __pyx_v_dj = __pyx_t_9;
  5913. /* "fontTools/varLib/iup.py":231
  5914. * cj = c[j]
  5915. * dj = d[j]
  5916. * lcj = lc[j] # <<<<<<<<<<<<<<
  5917. * ldj = ld[j]
  5918. * ncj = nc[j]
  5919. */
  5920. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_lc, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
  5921. __Pyx_GOTREF(__pyx_t_7);
  5922. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
  5923. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5924. __pyx_v_lcj = __pyx_t_9;
  5925. /* "fontTools/varLib/iup.py":232
  5926. * dj = d[j]
  5927. * lcj = lc[j]
  5928. * ldj = ld[j] # <<<<<<<<<<<<<<
  5929. * ncj = nc[j]
  5930. * ndj = nd[j]
  5931. */
  5932. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_ld, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
  5933. __Pyx_GOTREF(__pyx_t_7);
  5934. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
  5935. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5936. __pyx_v_ldj = __pyx_t_9;
  5937. /* "fontTools/varLib/iup.py":233
  5938. * lcj = lc[j]
  5939. * ldj = ld[j]
  5940. * ncj = nc[j] # <<<<<<<<<<<<<<
  5941. * ndj = nd[j]
  5942. *
  5943. */
  5944. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_nc, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
  5945. __Pyx_GOTREF(__pyx_t_7);
  5946. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
  5947. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5948. __pyx_v_ncj = __pyx_t_9;
  5949. /* "fontTools/varLib/iup.py":234
  5950. * ldj = ld[j]
  5951. * ncj = nc[j]
  5952. * ndj = nd[j] # <<<<<<<<<<<<<<
  5953. *
  5954. * if lcj <= ncj:
  5955. */
  5956. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_nd, __pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
  5957. __Pyx_GOTREF(__pyx_t_7);
  5958. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
  5959. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5960. __pyx_v_ndj = __pyx_t_9;
  5961. /* "fontTools/varLib/iup.py":236
  5962. * ndj = nd[j]
  5963. *
  5964. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5965. * c1, c2 = lcj, ncj
  5966. * d1, d2 = ldj, ndj
  5967. */
  5968. __pyx_t_3 = (__pyx_v_lcj <= __pyx_v_ncj);
  5969. if (__pyx_t_3) {
  5970. /* "fontTools/varLib/iup.py":237
  5971. *
  5972. * if lcj <= ncj:
  5973. * c1, c2 = lcj, ncj # <<<<<<<<<<<<<<
  5974. * d1, d2 = ldj, ndj
  5975. * else:
  5976. */
  5977. __pyx_t_9 = __pyx_v_lcj;
  5978. __pyx_t_10 = __pyx_v_ncj;
  5979. __pyx_v_c1 = __pyx_t_9;
  5980. __pyx_v_c2 = __pyx_t_10;
  5981. /* "fontTools/varLib/iup.py":238
  5982. * if lcj <= ncj:
  5983. * c1, c2 = lcj, ncj
  5984. * d1, d2 = ldj, ndj # <<<<<<<<<<<<<<
  5985. * else:
  5986. * c1, c2 = ncj, lcj
  5987. */
  5988. __pyx_t_10 = __pyx_v_ldj;
  5989. __pyx_t_9 = __pyx_v_ndj;
  5990. __pyx_v_d1 = __pyx_t_10;
  5991. __pyx_v_d2 = __pyx_t_9;
  5992. /* "fontTools/varLib/iup.py":236
  5993. * ndj = nd[j]
  5994. *
  5995. * if lcj <= ncj: # <<<<<<<<<<<<<<
  5996. * c1, c2 = lcj, ncj
  5997. * d1, d2 = ldj, ndj
  5998. */
  5999. goto __pyx_L7;
  6000. }
  6001. /* "fontTools/varLib/iup.py":240
  6002. * d1, d2 = ldj, ndj
  6003. * else:
  6004. * c1, c2 = ncj, lcj # <<<<<<<<<<<<<<
  6005. * d1, d2 = ndj, ldj
  6006. *
  6007. */
  6008. /*else*/ {
  6009. __pyx_t_9 = __pyx_v_ncj;
  6010. __pyx_t_10 = __pyx_v_lcj;
  6011. __pyx_v_c1 = __pyx_t_9;
  6012. __pyx_v_c2 = __pyx_t_10;
  6013. /* "fontTools/varLib/iup.py":241
  6014. * else:
  6015. * c1, c2 = ncj, lcj
  6016. * d1, d2 = ndj, ldj # <<<<<<<<<<<<<<
  6017. *
  6018. * force = False
  6019. */
  6020. __pyx_t_10 = __pyx_v_ndj;
  6021. __pyx_t_9 = __pyx_v_ldj;
  6022. __pyx_v_d1 = __pyx_t_10;
  6023. __pyx_v_d2 = __pyx_t_9;
  6024. }
  6025. __pyx_L7:;
  6026. /* "fontTools/varLib/iup.py":243
  6027. * d1, d2 = ndj, ldj
  6028. *
  6029. * force = False # <<<<<<<<<<<<<<
  6030. *
  6031. * # If the two coordinates are the same, then the interpolation
  6032. */
  6033. __pyx_v_force = 0;
  6034. /* "fontTools/varLib/iup.py":250
  6035. * #
  6036. * # This test has to be before the next one.
  6037. * if c1 == c2: # <<<<<<<<<<<<<<
  6038. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  6039. * force = True
  6040. */
  6041. __pyx_t_3 = (__pyx_v_c1 == __pyx_v_c2);
  6042. if (__pyx_t_3) {
  6043. /* "fontTools/varLib/iup.py":251
  6044. * # This test has to be before the next one.
  6045. * if c1 == c2:
  6046. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  6047. * force = True
  6048. *
  6049. */
  6050. __pyx_t_7 = PyFloat_FromDouble(fabs((__pyx_v_d1 - __pyx_v_d2))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
  6051. __Pyx_GOTREF(__pyx_t_7);
  6052. __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  6053. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6054. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 251, __pyx_L1_error)
  6055. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6056. if (__pyx_t_11) {
  6057. } else {
  6058. __pyx_t_3 = __pyx_t_11;
  6059. goto __pyx_L10_bool_binop_done;
  6060. }
  6061. __pyx_t_4 = PyFloat_FromDouble(fabs(__pyx_v_dj)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  6062. __Pyx_GOTREF(__pyx_t_4);
  6063. __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
  6064. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6065. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 251, __pyx_L1_error)
  6066. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6067. __pyx_t_3 = __pyx_t_11;
  6068. __pyx_L10_bool_binop_done:;
  6069. if (__pyx_t_3) {
  6070. /* "fontTools/varLib/iup.py":252
  6071. * if c1 == c2:
  6072. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  6073. * force = True # <<<<<<<<<<<<<<
  6074. *
  6075. * # If coordinate for current point is between coordinate of adjacent
  6076. */
  6077. __pyx_v_force = 1;
  6078. /* "fontTools/varLib/iup.py":251
  6079. * # This test has to be before the next one.
  6080. * if c1 == c2:
  6081. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance: # <<<<<<<<<<<<<<
  6082. * force = True
  6083. *
  6084. */
  6085. }
  6086. /* "fontTools/varLib/iup.py":250
  6087. * #
  6088. * # This test has to be before the next one.
  6089. * if c1 == c2: # <<<<<<<<<<<<<<
  6090. * if abs(d1 - d2) > tolerance and abs(dj) > tolerance:
  6091. * force = True
  6092. */
  6093. goto __pyx_L8;
  6094. }
  6095. /* "fontTools/varLib/iup.py":259
  6096. * # allowance), then there is no way that current point can be IUP-ed.
  6097. * # Mark it forced.
  6098. * elif c1 <= cj <= c2: # and c1 != c2 # <<<<<<<<<<<<<<
  6099. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  6100. * force = True
  6101. */
  6102. __pyx_t_3 = (__pyx_v_c1 <= __pyx_v_cj);
  6103. if (__pyx_t_3) {
  6104. __pyx_t_3 = (__pyx_v_cj <= __pyx_v_c2);
  6105. }
  6106. if (__pyx_t_3) {
  6107. /* "fontTools/varLib/iup.py":260
  6108. * # Mark it forced.
  6109. * elif c1 <= cj <= c2: # and c1 != c2
  6110. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance): # <<<<<<<<<<<<<<
  6111. * force = True
  6112. *
  6113. */
  6114. __pyx_t_9 = __pyx_v_d2;
  6115. __pyx_t_10 = __pyx_v_d1;
  6116. __pyx_t_3 = (__pyx_t_9 < __pyx_t_10);
  6117. if (__pyx_t_3) {
  6118. __pyx_t_12 = __pyx_t_9;
  6119. } else {
  6120. __pyx_t_12 = __pyx_t_10;
  6121. }
  6122. __pyx_t_7 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
  6123. __Pyx_GOTREF(__pyx_t_7);
  6124. __pyx_t_4 = PyNumber_Subtract(__pyx_t_7, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
  6125. __Pyx_GOTREF(__pyx_t_4);
  6126. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6127. __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error)
  6128. __Pyx_GOTREF(__pyx_t_7);
  6129. __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_LE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 260, __pyx_L1_error)
  6130. if (__Pyx_PyObject_IsTrue(__pyx_t_13)) {
  6131. __Pyx_DECREF(__pyx_t_13);
  6132. __pyx_t_12 = __pyx_v_d2;
  6133. __pyx_t_9 = __pyx_v_d1;
  6134. __pyx_t_3 = (__pyx_t_12 > __pyx_t_9);
  6135. if (__pyx_t_3) {
  6136. __pyx_t_10 = __pyx_t_12;
  6137. } else {
  6138. __pyx_t_10 = __pyx_t_9;
  6139. }
  6140. __pyx_t_14 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 260, __pyx_L1_error)
  6141. __Pyx_GOTREF(__pyx_t_14);
  6142. __pyx_t_15 = PyNumber_Add(__pyx_t_14, __pyx_v_tolerance); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 260, __pyx_L1_error)
  6143. __Pyx_GOTREF(__pyx_t_15);
  6144. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  6145. __pyx_t_13 = PyObject_RichCompare(__pyx_t_7, __pyx_t_15, Py_LE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 260, __pyx_L1_error)
  6146. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  6147. }
  6148. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6149. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6150. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 260, __pyx_L1_error)
  6151. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6152. __pyx_t_11 = (!__pyx_t_3);
  6153. if (__pyx_t_11) {
  6154. /* "fontTools/varLib/iup.py":261
  6155. * elif c1 <= cj <= c2: # and c1 != c2
  6156. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  6157. * force = True # <<<<<<<<<<<<<<
  6158. *
  6159. * # Otherwise, the delta should either match the closest, or have the
  6160. */
  6161. __pyx_v_force = 1;
  6162. /* "fontTools/varLib/iup.py":260
  6163. * # Mark it forced.
  6164. * elif c1 <= cj <= c2: # and c1 != c2
  6165. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance): # <<<<<<<<<<<<<<
  6166. * force = True
  6167. *
  6168. */
  6169. }
  6170. /* "fontTools/varLib/iup.py":259
  6171. * # allowance), then there is no way that current point can be IUP-ed.
  6172. * # Mark it forced.
  6173. * elif c1 <= cj <= c2: # and c1 != c2 # <<<<<<<<<<<<<<
  6174. * if not (min(d1, d2) - tolerance <= dj <= max(d1, d2) + tolerance):
  6175. * force = True
  6176. */
  6177. goto __pyx_L8;
  6178. }
  6179. /* "fontTools/varLib/iup.py":266
  6180. * # same sign as the interpolation of the two deltas.
  6181. * else: # cj < c1 or c2 < cj
  6182. * if d1 != d2: # <<<<<<<<<<<<<<
  6183. * if cj < c1:
  6184. * if (
  6185. */
  6186. /*else*/ {
  6187. __pyx_t_11 = (__pyx_v_d1 != __pyx_v_d2);
  6188. if (__pyx_t_11) {
  6189. /* "fontTools/varLib/iup.py":267
  6190. * else: # cj < c1 or c2 < cj
  6191. * if d1 != d2:
  6192. * if cj < c1: # <<<<<<<<<<<<<<
  6193. * if (
  6194. * abs(dj) > tolerance
  6195. */
  6196. __pyx_t_11 = (__pyx_v_cj < __pyx_v_c1);
  6197. if (__pyx_t_11) {
  6198. /* "fontTools/varLib/iup.py":269
  6199. * if cj < c1:
  6200. * if (
  6201. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  6202. * and abs(dj - d1) > tolerance
  6203. * and ((dj - tolerance < d1) != (d1 < d2))
  6204. */
  6205. __pyx_t_13 = PyFloat_FromDouble(fabs(__pyx_v_dj)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 269, __pyx_L1_error)
  6206. __Pyx_GOTREF(__pyx_t_13);
  6207. __pyx_t_7 = PyObject_RichCompare(__pyx_t_13, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 269, __pyx_L1_error)
  6208. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6209. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 269, __pyx_L1_error)
  6210. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6211. if (__pyx_t_3) {
  6212. } else {
  6213. __pyx_t_11 = __pyx_t_3;
  6214. goto __pyx_L16_bool_binop_done;
  6215. }
  6216. /* "fontTools/varLib/iup.py":270
  6217. * if (
  6218. * abs(dj) > tolerance
  6219. * and abs(dj - d1) > tolerance # <<<<<<<<<<<<<<
  6220. * and ((dj - tolerance < d1) != (d1 < d2))
  6221. * ):
  6222. */
  6223. __pyx_t_7 = PyFloat_FromDouble(fabs((__pyx_v_dj - __pyx_v_d1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 270, __pyx_L1_error)
  6224. __Pyx_GOTREF(__pyx_t_7);
  6225. __pyx_t_13 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 270, __pyx_L1_error)
  6226. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6227. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 270, __pyx_L1_error)
  6228. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6229. if (__pyx_t_3) {
  6230. } else {
  6231. __pyx_t_11 = __pyx_t_3;
  6232. goto __pyx_L16_bool_binop_done;
  6233. }
  6234. /* "fontTools/varLib/iup.py":271
  6235. * abs(dj) > tolerance
  6236. * and abs(dj - d1) > tolerance
  6237. * and ((dj - tolerance < d1) != (d1 < d2)) # <<<<<<<<<<<<<<
  6238. * ):
  6239. * force = True
  6240. */
  6241. __pyx_t_13 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 271, __pyx_L1_error)
  6242. __Pyx_GOTREF(__pyx_t_13);
  6243. __pyx_t_7 = PyNumber_Subtract(__pyx_t_13, __pyx_v_tolerance); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
  6244. __Pyx_GOTREF(__pyx_t_7);
  6245. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6246. __pyx_t_13 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 271, __pyx_L1_error)
  6247. __Pyx_GOTREF(__pyx_t_13);
  6248. __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
  6249. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6250. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6251. __pyx_t_13 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 271, __pyx_L1_error)
  6252. __Pyx_GOTREF(__pyx_t_13);
  6253. __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_13, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
  6254. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6255. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6256. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 271, __pyx_L1_error)
  6257. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6258. __pyx_t_11 = __pyx_t_3;
  6259. __pyx_L16_bool_binop_done:;
  6260. /* "fontTools/varLib/iup.py":268
  6261. * if d1 != d2:
  6262. * if cj < c1:
  6263. * if ( # <<<<<<<<<<<<<<
  6264. * abs(dj) > tolerance
  6265. * and abs(dj - d1) > tolerance
  6266. */
  6267. if (__pyx_t_11) {
  6268. /* "fontTools/varLib/iup.py":273
  6269. * and ((dj - tolerance < d1) != (d1 < d2))
  6270. * ):
  6271. * force = True # <<<<<<<<<<<<<<
  6272. * else: # c2 < cj
  6273. * if (
  6274. */
  6275. __pyx_v_force = 1;
  6276. /* "fontTools/varLib/iup.py":268
  6277. * if d1 != d2:
  6278. * if cj < c1:
  6279. * if ( # <<<<<<<<<<<<<<
  6280. * abs(dj) > tolerance
  6281. * and abs(dj - d1) > tolerance
  6282. */
  6283. }
  6284. /* "fontTools/varLib/iup.py":267
  6285. * else: # cj < c1 or c2 < cj
  6286. * if d1 != d2:
  6287. * if cj < c1: # <<<<<<<<<<<<<<
  6288. * if (
  6289. * abs(dj) > tolerance
  6290. */
  6291. goto __pyx_L14;
  6292. }
  6293. /* "fontTools/varLib/iup.py":275
  6294. * force = True
  6295. * else: # c2 < cj
  6296. * if ( # <<<<<<<<<<<<<<
  6297. * abs(dj) > tolerance
  6298. * and abs(dj - d2) > tolerance
  6299. */
  6300. /*else*/ {
  6301. /* "fontTools/varLib/iup.py":276
  6302. * else: # c2 < cj
  6303. * if (
  6304. * abs(dj) > tolerance # <<<<<<<<<<<<<<
  6305. * and abs(dj - d2) > tolerance
  6306. * and ((d2 < dj + tolerance) != (d1 < d2))
  6307. */
  6308. __pyx_t_7 = PyFloat_FromDouble(fabs(__pyx_v_dj)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 276, __pyx_L1_error)
  6309. __Pyx_GOTREF(__pyx_t_7);
  6310. __pyx_t_13 = PyObject_RichCompare(__pyx_t_7, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 276, __pyx_L1_error)
  6311. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6312. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 276, __pyx_L1_error)
  6313. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6314. if (__pyx_t_3) {
  6315. } else {
  6316. __pyx_t_11 = __pyx_t_3;
  6317. goto __pyx_L20_bool_binop_done;
  6318. }
  6319. /* "fontTools/varLib/iup.py":277
  6320. * if (
  6321. * abs(dj) > tolerance
  6322. * and abs(dj - d2) > tolerance # <<<<<<<<<<<<<<
  6323. * and ((d2 < dj + tolerance) != (d1 < d2))
  6324. * ):
  6325. */
  6326. __pyx_t_13 = PyFloat_FromDouble(fabs((__pyx_v_dj - __pyx_v_d2))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 277, __pyx_L1_error)
  6327. __Pyx_GOTREF(__pyx_t_13);
  6328. __pyx_t_7 = PyObject_RichCompare(__pyx_t_13, __pyx_v_tolerance, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 277, __pyx_L1_error)
  6329. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6330. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 277, __pyx_L1_error)
  6331. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6332. if (__pyx_t_3) {
  6333. } else {
  6334. __pyx_t_11 = __pyx_t_3;
  6335. goto __pyx_L20_bool_binop_done;
  6336. }
  6337. /* "fontTools/varLib/iup.py":278
  6338. * abs(dj) > tolerance
  6339. * and abs(dj - d2) > tolerance
  6340. * and ((d2 < dj + tolerance) != (d1 < d2)) # <<<<<<<<<<<<<<
  6341. * ):
  6342. * force = True
  6343. */
  6344. __pyx_t_7 = PyFloat_FromDouble(__pyx_v_d2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
  6345. __Pyx_GOTREF(__pyx_t_7);
  6346. __pyx_t_13 = PyFloat_FromDouble(__pyx_v_dj); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 278, __pyx_L1_error)
  6347. __Pyx_GOTREF(__pyx_t_13);
  6348. __pyx_t_4 = PyNumber_Add(__pyx_t_13, __pyx_v_tolerance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error)
  6349. __Pyx_GOTREF(__pyx_t_4);
  6350. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6351. __pyx_t_13 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 278, __pyx_L1_error)
  6352. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6353. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6354. __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_d1 < __pyx_v_d2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error)
  6355. __Pyx_GOTREF(__pyx_t_4);
  6356. __pyx_t_7 = PyObject_RichCompare(__pyx_t_13, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
  6357. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  6358. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6359. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 278, __pyx_L1_error)
  6360. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6361. __pyx_t_11 = __pyx_t_3;
  6362. __pyx_L20_bool_binop_done:;
  6363. /* "fontTools/varLib/iup.py":275
  6364. * force = True
  6365. * else: # c2 < cj
  6366. * if ( # <<<<<<<<<<<<<<
  6367. * abs(dj) > tolerance
  6368. * and abs(dj - d2) > tolerance
  6369. */
  6370. if (__pyx_t_11) {
  6371. /* "fontTools/varLib/iup.py":280
  6372. * and ((d2 < dj + tolerance) != (d1 < d2))
  6373. * ):
  6374. * force = True # <<<<<<<<<<<<<<
  6375. *
  6376. * if force:
  6377. */
  6378. __pyx_v_force = 1;
  6379. /* "fontTools/varLib/iup.py":275
  6380. * force = True
  6381. * else: # c2 < cj
  6382. * if ( # <<<<<<<<<<<<<<
  6383. * abs(dj) > tolerance
  6384. * and abs(dj - d2) > tolerance
  6385. */
  6386. }
  6387. }
  6388. __pyx_L14:;
  6389. /* "fontTools/varLib/iup.py":266
  6390. * # same sign as the interpolation of the two deltas.
  6391. * else: # cj < c1 or c2 < cj
  6392. * if d1 != d2: # <<<<<<<<<<<<<<
  6393. * if cj < c1:
  6394. * if (
  6395. */
  6396. }
  6397. }
  6398. __pyx_L8:;
  6399. /* "fontTools/varLib/iup.py":282
  6400. * force = True
  6401. *
  6402. * if force: # <<<<<<<<<<<<<<
  6403. * forced.add(i)
  6404. * break
  6405. */
  6406. __pyx_t_11 = (__pyx_v_force != 0);
  6407. if (__pyx_t_11) {
  6408. /* "fontTools/varLib/iup.py":283
  6409. *
  6410. * if force:
  6411. * forced.add(i) # <<<<<<<<<<<<<<
  6412. * break
  6413. *
  6414. */
  6415. __pyx_t_16 = PySet_Add(__pyx_v_forced, __pyx_v_i); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 283, __pyx_L1_error)
  6416. /* "fontTools/varLib/iup.py":284
  6417. * if force:
  6418. * forced.add(i)
  6419. * break # <<<<<<<<<<<<<<
  6420. *
  6421. * return forced
  6422. */
  6423. goto __pyx_L6_break;
  6424. /* "fontTools/varLib/iup.py":282
  6425. * force = True
  6426. *
  6427. * if force: # <<<<<<<<<<<<<<
  6428. * forced.add(i)
  6429. * break
  6430. */
  6431. }
  6432. /* "fontTools/varLib/iup.py":228
  6433. * nd, nc = deltas[i - n + 1], coords[i - n + 1]
  6434. *
  6435. * for j in (0, 1): # For X and for Y # <<<<<<<<<<<<<<
  6436. * cj = c[j]
  6437. * dj = d[j]
  6438. */
  6439. }
  6440. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6441. goto __pyx_L24_for_end;
  6442. __pyx_L6_break:;
  6443. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6444. goto __pyx_L24_for_end;
  6445. __pyx_L24_for_end:;
  6446. /* "fontTools/varLib/iup.py":223
  6447. * forced = set()
  6448. * # Track "last" and "next" points on the contour as we sweep.
  6449. * for i in range(len(deltas) - 1, -1, -1): # <<<<<<<<<<<<<<
  6450. * ld, lc = deltas[i - 1], coords[i - 1]
  6451. * d, c = deltas[i], coords[i]
  6452. */
  6453. }
  6454. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6455. /* "fontTools/varLib/iup.py":286
  6456. * break
  6457. *
  6458. * return forced # <<<<<<<<<<<<<<
  6459. *
  6460. *
  6461. */
  6462. __Pyx_XDECREF(__pyx_r);
  6463. __Pyx_INCREF(__pyx_v_forced);
  6464. __pyx_r = __pyx_v_forced;
  6465. goto __pyx_L0;
  6466. /* "fontTools/varLib/iup.py":198
  6467. *
  6468. *
  6469. * @cython.locals( # <<<<<<<<<<<<<<
  6470. * cj=cython.double,
  6471. * dj=cython.double,
  6472. */
  6473. /* function exit code */
  6474. __pyx_L1_error:;
  6475. __Pyx_XDECREF(__pyx_t_4);
  6476. __Pyx_XDECREF(__pyx_t_5);
  6477. __Pyx_XDECREF(__pyx_t_7);
  6478. __Pyx_XDECREF(__pyx_t_8);
  6479. __Pyx_XDECREF(__pyx_t_13);
  6480. __Pyx_XDECREF(__pyx_t_14);
  6481. __Pyx_XDECREF(__pyx_t_15);
  6482. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_bound_forced_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6483. __pyx_r = NULL;
  6484. __pyx_L0:;
  6485. __Pyx_XDECREF(__pyx_v_forced);
  6486. __Pyx_XDECREF(__pyx_v_n);
  6487. __Pyx_XDECREF(__pyx_v_i);
  6488. __Pyx_XDECREF(__pyx_v_ld);
  6489. __Pyx_XDECREF(__pyx_v_lc);
  6490. __Pyx_XDECREF(__pyx_v_d);
  6491. __Pyx_XDECREF(__pyx_v_c);
  6492. __Pyx_XDECREF(__pyx_v_nd);
  6493. __Pyx_XDECREF(__pyx_v_nc);
  6494. __Pyx_XDECREF(__pyx_v_j);
  6495. __Pyx_XGIVEREF(__pyx_r);
  6496. __Pyx_RefNannyFinishContext();
  6497. return __pyx_r;
  6498. }
  6499. /* "fontTools/varLib/iup.py":289
  6500. *
  6501. *
  6502. * @cython.locals( # <<<<<<<<<<<<<<
  6503. * i=cython.int,
  6504. * j=cython.int,
  6505. */
  6506. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  6507. PyObject *__pyx_r = NULL;
  6508. __Pyx_RefNannyDeclarations
  6509. PyObject *__pyx_t_1 = NULL;
  6510. PyObject *__pyx_t_2 = NULL;
  6511. int __pyx_lineno = 0;
  6512. const char *__pyx_filename = NULL;
  6513. int __pyx_clineno = 0;
  6514. __Pyx_RefNannySetupContext("__defaults__", 1);
  6515. __Pyx_XDECREF(__pyx_r);
  6516. /* "fontTools/varLib/iup.py":302
  6517. * coords: _PointSegment,
  6518. * forced=set(),
  6519. * tolerance: Real = 0, # <<<<<<<<<<<<<<
  6520. * lookback: Integral = None,
  6521. * ):
  6522. */
  6523. __pyx_t_1 = PyFloat_FromDouble(((double)0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  6524. __Pyx_GOTREF(__pyx_t_1);
  6525. /* "fontTools/varLib/iup.py":289
  6526. *
  6527. *
  6528. * @cython.locals( # <<<<<<<<<<<<<<
  6529. * i=cython.int,
  6530. * j=cython.int,
  6531. */
  6532. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
  6533. __Pyx_GOTREF(__pyx_t_2);
  6534. __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_forced);
  6535. __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_forced);
  6536. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_forced)) __PYX_ERR(0, 289, __pyx_L1_error);
  6537. __Pyx_GIVEREF(__pyx_t_1);
  6538. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error);
  6539. __Pyx_INCREF(Py_None);
  6540. __Pyx_GIVEREF(Py_None);
  6541. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None)) __PYX_ERR(0, 289, __pyx_L1_error);
  6542. __pyx_t_1 = 0;
  6543. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
  6544. __Pyx_GOTREF(__pyx_t_1);
  6545. __Pyx_GIVEREF(__pyx_t_2);
  6546. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error);
  6547. __Pyx_INCREF(Py_None);
  6548. __Pyx_GIVEREF(Py_None);
  6549. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None)) __PYX_ERR(0, 289, __pyx_L1_error);
  6550. __pyx_t_2 = 0;
  6551. __pyx_r = __pyx_t_1;
  6552. __pyx_t_1 = 0;
  6553. goto __pyx_L0;
  6554. /* function exit code */
  6555. __pyx_L1_error:;
  6556. __Pyx_XDECREF(__pyx_t_1);
  6557. __Pyx_XDECREF(__pyx_t_2);
  6558. __Pyx_AddTraceback("fontTools.varLib.iup.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6559. __pyx_r = NULL;
  6560. __pyx_L0:;
  6561. __Pyx_XGIVEREF(__pyx_r);
  6562. __Pyx_RefNannyFinishContext();
  6563. return __pyx_r;
  6564. }
  6565. /* Python wrapper */
  6566. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp(PyObject *__pyx_self,
  6567. #if CYTHON_METH_FASTCALL
  6568. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6569. #else
  6570. PyObject *__pyx_args, PyObject *__pyx_kwds
  6571. #endif
  6572. ); /*proto*/
  6573. 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)\nStraightforward Dynamic-Programming. For each index i, find least-costly encoding of\n points 0 to i where i is explicitly encoded. We find this by considering all previous\n explicit points j and check whether interpolation can fill points between j and i.\n\n Note that solution always encodes last point explicitly. Higher-level is responsible\n for removing that restriction.\n\n As major speedup, we stop looking further whenever we see a \"forced\" point.");
  6574. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp = {"_iup_contour_optimize_dp", (PyCFunction)(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};
  6575. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp(PyObject *__pyx_self,
  6576. #if CYTHON_METH_FASTCALL
  6577. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6578. #else
  6579. PyObject *__pyx_args, PyObject *__pyx_kwds
  6580. #endif
  6581. ) {
  6582. PyObject *__pyx_v_deltas = 0;
  6583. PyObject *__pyx_v_coords = 0;
  6584. PyObject *__pyx_v_forced = 0;
  6585. double __pyx_v_tolerance;
  6586. PyObject *__pyx_v_lookback = 0;
  6587. #if !CYTHON_METH_FASTCALL
  6588. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6589. #endif
  6590. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6591. PyObject* values[5] = {0,0,0,0,0};
  6592. int __pyx_lineno = 0;
  6593. const char *__pyx_filename = NULL;
  6594. int __pyx_clineno = 0;
  6595. PyObject *__pyx_r = 0;
  6596. __Pyx_RefNannyDeclarations
  6597. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp (wrapper)", 0);
  6598. #if !CYTHON_METH_FASTCALL
  6599. #if CYTHON_ASSUME_SAFE_MACROS
  6600. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6601. #else
  6602. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6603. #endif
  6604. #endif
  6605. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6606. {
  6607. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,&__pyx_n_s_forced,&__pyx_n_s_tolerance,&__pyx_n_s_lookback,0};
  6608. __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
  6609. values[2] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_forced);
  6610. /* "fontTools/varLib/iup.py":303
  6611. * forced=set(),
  6612. * tolerance: Real = 0,
  6613. * lookback: Integral = None, # <<<<<<<<<<<<<<
  6614. * ):
  6615. * """Straightforward Dynamic-Programming. For each index i, find least-costly encoding of
  6616. */
  6617. values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
  6618. if (__pyx_kwds) {
  6619. Py_ssize_t kw_args;
  6620. switch (__pyx_nargs) {
  6621. case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
  6622. CYTHON_FALLTHROUGH;
  6623. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  6624. CYTHON_FALLTHROUGH;
  6625. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  6626. CYTHON_FALLTHROUGH;
  6627. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  6628. CYTHON_FALLTHROUGH;
  6629. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  6630. CYTHON_FALLTHROUGH;
  6631. case 0: break;
  6632. default: goto __pyx_L5_argtuple_error;
  6633. }
  6634. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  6635. switch (__pyx_nargs) {
  6636. case 0:
  6637. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  6638. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  6639. kw_args--;
  6640. }
  6641. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error)
  6642. else goto __pyx_L5_argtuple_error;
  6643. CYTHON_FALLTHROUGH;
  6644. case 1:
  6645. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  6646. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  6647. kw_args--;
  6648. }
  6649. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error)
  6650. else {
  6651. __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, 1); __PYX_ERR(0, 289, __pyx_L3_error)
  6652. }
  6653. CYTHON_FALLTHROUGH;
  6654. case 2:
  6655. if (kw_args > 0) {
  6656. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_forced);
  6657. if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  6658. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error)
  6659. }
  6660. CYTHON_FALLTHROUGH;
  6661. case 3:
  6662. if (kw_args > 0) {
  6663. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tolerance);
  6664. if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  6665. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error)
  6666. }
  6667. CYTHON_FALLTHROUGH;
  6668. case 4:
  6669. if (kw_args > 0) {
  6670. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lookback);
  6671. if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  6672. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error)
  6673. }
  6674. }
  6675. if (unlikely(kw_args > 0)) {
  6676. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6677. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_iup_contour_optimize_dp") < 0)) __PYX_ERR(0, 289, __pyx_L3_error)
  6678. }
  6679. } else {
  6680. switch (__pyx_nargs) {
  6681. case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
  6682. CYTHON_FALLTHROUGH;
  6683. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  6684. CYTHON_FALLTHROUGH;
  6685. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  6686. CYTHON_FALLTHROUGH;
  6687. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  6688. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  6689. break;
  6690. default: goto __pyx_L5_argtuple_error;
  6691. }
  6692. }
  6693. __pyx_v_deltas = values[0];
  6694. __pyx_v_coords = values[1];
  6695. __pyx_v_forced = ((PyObject*)values[2]);
  6696. if (values[3]) {
  6697. __pyx_v_tolerance = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
  6698. } else {
  6699. __pyx_v_tolerance = ((double)((double)0.0));
  6700. }
  6701. __pyx_v_lookback = values[4];
  6702. }
  6703. goto __pyx_L6_skip;
  6704. __pyx_L5_argtuple_error:;
  6705. __Pyx_RaiseArgtupleInvalid("_iup_contour_optimize_dp", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 289, __pyx_L3_error)
  6706. __pyx_L6_skip:;
  6707. goto __pyx_L4_argument_unpacking_done;
  6708. __pyx_L3_error:;
  6709. {
  6710. Py_ssize_t __pyx_temp;
  6711. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6712. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  6713. }
  6714. }
  6715. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6716. __Pyx_RefNannyFinishContext();
  6717. return NULL;
  6718. __pyx_L4_argument_unpacking_done:;
  6719. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_forced), (&PySet_Type), 1, "forced", 1))) __PYX_ERR(0, 301, __pyx_L1_error)
  6720. __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);
  6721. /* "fontTools/varLib/iup.py":289
  6722. *
  6723. *
  6724. * @cython.locals( # <<<<<<<<<<<<<<
  6725. * i=cython.int,
  6726. * j=cython.int,
  6727. */
  6728. /* function exit code */
  6729. goto __pyx_L0;
  6730. __pyx_L1_error:;
  6731. __pyx_r = NULL;
  6732. __pyx_L0:;
  6733. {
  6734. Py_ssize_t __pyx_temp;
  6735. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6736. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  6737. }
  6738. }
  6739. __Pyx_RefNannyFinishContext();
  6740. return __pyx_r;
  6741. }
  6742. 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) {
  6743. int __pyx_v_i;
  6744. int __pyx_v_j;
  6745. double __pyx_v_best_cost;
  6746. double __pyx_v_cost;
  6747. Py_ssize_t __pyx_v_n;
  6748. PyObject *__pyx_v_costs = NULL;
  6749. PyObject *__pyx_v_chain = NULL;
  6750. PyObject *__pyx_r = NULL;
  6751. __Pyx_RefNannyDeclarations
  6752. Py_ssize_t __pyx_t_1;
  6753. int __pyx_t_2;
  6754. PyObject *__pyx_t_3 = NULL;
  6755. PyObject *__pyx_t_4 = NULL;
  6756. PyObject *__pyx_t_5 = NULL;
  6757. PyObject *__pyx_t_6 = NULL;
  6758. Py_ssize_t __pyx_t_7;
  6759. int __pyx_t_8;
  6760. double __pyx_t_9;
  6761. long __pyx_t_10;
  6762. long __pyx_t_11;
  6763. int __pyx_t_12;
  6764. int __pyx_t_13;
  6765. int __pyx_t_14;
  6766. int __pyx_lineno = 0;
  6767. const char *__pyx_filename = NULL;
  6768. int __pyx_clineno = 0;
  6769. __Pyx_RefNannySetupContext("_iup_contour_optimize_dp", 0);
  6770. __Pyx_INCREF(__pyx_v_lookback);
  6771. /* "fontTools/varLib/iup.py":314
  6772. * As major speedup, we stop looking further whenever we see a "forced" point."""
  6773. *
  6774. * n = len(deltas) # <<<<<<<<<<<<<<
  6775. * if lookback is None:
  6776. * lookback = n
  6777. */
  6778. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 314, __pyx_L1_error)
  6779. __pyx_v_n = __pyx_t_1;
  6780. /* "fontTools/varLib/iup.py":315
  6781. *
  6782. * n = len(deltas)
  6783. * if lookback is None: # <<<<<<<<<<<<<<
  6784. * lookback = n
  6785. * lookback = min(lookback, MAX_LOOKBACK)
  6786. */
  6787. __pyx_t_2 = (__pyx_v_lookback == Py_None);
  6788. if (__pyx_t_2) {
  6789. /* "fontTools/varLib/iup.py":316
  6790. * n = len(deltas)
  6791. * if lookback is None:
  6792. * lookback = n # <<<<<<<<<<<<<<
  6793. * lookback = min(lookback, MAX_LOOKBACK)
  6794. * costs = {-1: 0}
  6795. */
  6796. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  6797. __Pyx_GOTREF(__pyx_t_3);
  6798. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6799. __pyx_t_3 = 0;
  6800. /* "fontTools/varLib/iup.py":315
  6801. *
  6802. * n = len(deltas)
  6803. * if lookback is None: # <<<<<<<<<<<<<<
  6804. * lookback = n
  6805. * lookback = min(lookback, MAX_LOOKBACK)
  6806. */
  6807. }
  6808. /* "fontTools/varLib/iup.py":317
  6809. * if lookback is None:
  6810. * lookback = n
  6811. * lookback = min(lookback, MAX_LOOKBACK) # <<<<<<<<<<<<<<
  6812. * costs = {-1: 0}
  6813. * chain = {-1: None}
  6814. */
  6815. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MAX_LOOKBACK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
  6816. __Pyx_GOTREF(__pyx_t_3);
  6817. __Pyx_INCREF(__pyx_v_lookback);
  6818. __pyx_t_4 = __pyx_v_lookback;
  6819. __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, 317, __pyx_L1_error)
  6820. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 317, __pyx_L1_error)
  6821. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6822. if (__pyx_t_2) {
  6823. __Pyx_INCREF(__pyx_t_3);
  6824. __pyx_t_5 = __pyx_t_3;
  6825. } else {
  6826. __Pyx_INCREF(__pyx_t_4);
  6827. __pyx_t_5 = __pyx_t_4;
  6828. }
  6829. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6830. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6831. __pyx_t_3 = __pyx_t_5;
  6832. __Pyx_INCREF(__pyx_t_3);
  6833. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6834. __Pyx_DECREF_SET(__pyx_v_lookback, __pyx_t_3);
  6835. __pyx_t_3 = 0;
  6836. /* "fontTools/varLib/iup.py":318
  6837. * lookback = n
  6838. * lookback = min(lookback, MAX_LOOKBACK)
  6839. * costs = {-1: 0} # <<<<<<<<<<<<<<
  6840. * chain = {-1: None}
  6841. * for i in range(0, n):
  6842. */
  6843. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
  6844. __Pyx_GOTREF(__pyx_t_3);
  6845. if (PyDict_SetItem(__pyx_t_3, __pyx_int_neg_1, __pyx_int_0) < 0) __PYX_ERR(0, 318, __pyx_L1_error)
  6846. __pyx_v_costs = ((PyObject*)__pyx_t_3);
  6847. __pyx_t_3 = 0;
  6848. /* "fontTools/varLib/iup.py":319
  6849. * lookback = min(lookback, MAX_LOOKBACK)
  6850. * costs = {-1: 0}
  6851. * chain = {-1: None} # <<<<<<<<<<<<<<
  6852. * for i in range(0, n):
  6853. * best_cost = costs[i - 1] + 1
  6854. */
  6855. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
  6856. __Pyx_GOTREF(__pyx_t_3);
  6857. if (PyDict_SetItem(__pyx_t_3, __pyx_int_neg_1, Py_None) < 0) __PYX_ERR(0, 319, __pyx_L1_error)
  6858. __pyx_v_chain = ((PyObject*)__pyx_t_3);
  6859. __pyx_t_3 = 0;
  6860. /* "fontTools/varLib/iup.py":320
  6861. * costs = {-1: 0}
  6862. * chain = {-1: None}
  6863. * for i in range(0, n): # <<<<<<<<<<<<<<
  6864. * best_cost = costs[i - 1] + 1
  6865. *
  6866. */
  6867. __pyx_t_1 = __pyx_v_n;
  6868. __pyx_t_7 = __pyx_t_1;
  6869. for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
  6870. __pyx_v_i = __pyx_t_8;
  6871. /* "fontTools/varLib/iup.py":321
  6872. * chain = {-1: None}
  6873. * for i in range(0, n):
  6874. * best_cost = costs[i - 1] + 1 # <<<<<<<<<<<<<<
  6875. *
  6876. * costs[i] = best_cost
  6877. */
  6878. __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
  6879. __Pyx_GOTREF(__pyx_t_3);
  6880. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 321, __pyx_L1_error)
  6881. __Pyx_GOTREF(__pyx_t_5);
  6882. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6883. __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
  6884. __Pyx_GOTREF(__pyx_t_3);
  6885. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6886. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error)
  6887. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6888. __pyx_v_best_cost = __pyx_t_9;
  6889. /* "fontTools/varLib/iup.py":323
  6890. * best_cost = costs[i - 1] + 1
  6891. *
  6892. * costs[i] = best_cost # <<<<<<<<<<<<<<
  6893. * chain[i] = i - 1
  6894. *
  6895. */
  6896. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_best_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
  6897. __Pyx_GOTREF(__pyx_t_3);
  6898. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
  6899. __Pyx_GOTREF(__pyx_t_5);
  6900. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 323, __pyx_L1_error)
  6901. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6902. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6903. /* "fontTools/varLib/iup.py":324
  6904. *
  6905. * costs[i] = best_cost
  6906. * chain[i] = i - 1 # <<<<<<<<<<<<<<
  6907. *
  6908. * if i - 1 in forced:
  6909. */
  6910. __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
  6911. __Pyx_GOTREF(__pyx_t_3);
  6912. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L1_error)
  6913. __Pyx_GOTREF(__pyx_t_5);
  6914. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 324, __pyx_L1_error)
  6915. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6916. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6917. /* "fontTools/varLib/iup.py":326
  6918. * chain[i] = i - 1
  6919. *
  6920. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6921. * continue
  6922. *
  6923. */
  6924. __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
  6925. __Pyx_GOTREF(__pyx_t_3);
  6926. if (unlikely(__pyx_v_forced == Py_None)) {
  6927. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6928. __PYX_ERR(0, 326, __pyx_L1_error)
  6929. }
  6930. __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_forced, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 326, __pyx_L1_error)
  6931. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6932. if (__pyx_t_2) {
  6933. /* "fontTools/varLib/iup.py":327
  6934. *
  6935. * if i - 1 in forced:
  6936. * continue # <<<<<<<<<<<<<<
  6937. *
  6938. * for j in range(i - 2, max(i - lookback, -2), -1):
  6939. */
  6940. goto __pyx_L4_continue;
  6941. /* "fontTools/varLib/iup.py":326
  6942. * chain[i] = i - 1
  6943. *
  6944. * if i - 1 in forced: # <<<<<<<<<<<<<<
  6945. * continue
  6946. *
  6947. */
  6948. }
  6949. /* "fontTools/varLib/iup.py":329
  6950. * continue
  6951. *
  6952. * for j in range(i - 2, max(i - lookback, -2), -1): # <<<<<<<<<<<<<<
  6953. * cost = costs[j] + 1
  6954. *
  6955. */
  6956. __pyx_t_10 = -2L;
  6957. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error)
  6958. __Pyx_GOTREF(__pyx_t_3);
  6959. __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_v_lookback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 329, __pyx_L1_error)
  6960. __Pyx_GOTREF(__pyx_t_5);
  6961. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6962. __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
  6963. __Pyx_GOTREF(__pyx_t_4);
  6964. __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, 329, __pyx_L1_error)
  6965. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6966. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 329, __pyx_L1_error)
  6967. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6968. if (__pyx_t_2) {
  6969. __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
  6970. __Pyx_GOTREF(__pyx_t_6);
  6971. __pyx_t_3 = __pyx_t_6;
  6972. __pyx_t_6 = 0;
  6973. } else {
  6974. __Pyx_INCREF(__pyx_t_5);
  6975. __pyx_t_3 = __pyx_t_5;
  6976. }
  6977. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6978. __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error)
  6979. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6980. __pyx_t_11 = __pyx_t_10;
  6981. for (__pyx_t_12 = (__pyx_v_i - 2); __pyx_t_12 > __pyx_t_11; __pyx_t_12-=1) {
  6982. __pyx_v_j = __pyx_t_12;
  6983. /* "fontTools/varLib/iup.py":330
  6984. *
  6985. * for j in range(i - 2, max(i - lookback, -2), -1):
  6986. * cost = costs[j] + 1 # <<<<<<<<<<<<<<
  6987. *
  6988. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  6989. */
  6990. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  6991. __Pyx_GOTREF(__pyx_t_3);
  6992. __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_costs, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
  6993. __Pyx_GOTREF(__pyx_t_5);
  6994. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6995. __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  6996. __Pyx_GOTREF(__pyx_t_3);
  6997. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6998. __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L1_error)
  6999. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7000. __pyx_v_cost = __pyx_t_9;
  7001. /* "fontTools/varLib/iup.py":332
  7002. * cost = costs[j] + 1
  7003. *
  7004. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  7005. * costs[i] = best_cost = cost
  7006. * chain[i] = j
  7007. */
  7008. __pyx_t_13 = (__pyx_v_cost < __pyx_v_best_cost);
  7009. if (__pyx_t_13) {
  7010. } else {
  7011. __pyx_t_2 = __pyx_t_13;
  7012. goto __pyx_L10_bool_binop_done;
  7013. }
  7014. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tolerance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
  7015. __Pyx_GOTREF(__pyx_t_3);
  7016. __pyx_t_14 = __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_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L1_error)
  7017. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7018. __pyx_t_13 = (__pyx_t_14 != 0);
  7019. __pyx_t_2 = __pyx_t_13;
  7020. __pyx_L10_bool_binop_done:;
  7021. if (__pyx_t_2) {
  7022. /* "fontTools/varLib/iup.py":333
  7023. *
  7024. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  7025. * costs[i] = best_cost = cost # <<<<<<<<<<<<<<
  7026. * chain[i] = j
  7027. *
  7028. */
  7029. __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cost); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  7030. __Pyx_GOTREF(__pyx_t_3);
  7031. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
  7032. __Pyx_GOTREF(__pyx_t_5);
  7033. if (unlikely((PyDict_SetItem(__pyx_v_costs, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 333, __pyx_L1_error)
  7034. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7035. __pyx_v_best_cost = __pyx_v_cost;
  7036. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7037. /* "fontTools/varLib/iup.py":334
  7038. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance):
  7039. * costs[i] = best_cost = cost
  7040. * chain[i] = j # <<<<<<<<<<<<<<
  7041. *
  7042. * if j in forced:
  7043. */
  7044. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error)
  7045. __Pyx_GOTREF(__pyx_t_3);
  7046. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
  7047. __Pyx_GOTREF(__pyx_t_5);
  7048. if (unlikely((PyDict_SetItem(__pyx_v_chain, __pyx_t_5, __pyx_t_3) < 0))) __PYX_ERR(0, 334, __pyx_L1_error)
  7049. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7050. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7051. /* "fontTools/varLib/iup.py":332
  7052. * cost = costs[j] + 1
  7053. *
  7054. * if cost < best_cost and can_iup_in_between(deltas, coords, j, i, tolerance): # <<<<<<<<<<<<<<
  7055. * costs[i] = best_cost = cost
  7056. * chain[i] = j
  7057. */
  7058. }
  7059. /* "fontTools/varLib/iup.py":336
  7060. * chain[i] = j
  7061. *
  7062. * if j in forced: # <<<<<<<<<<<<<<
  7063. * break
  7064. *
  7065. */
  7066. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
  7067. __Pyx_GOTREF(__pyx_t_3);
  7068. if (unlikely(__pyx_v_forced == Py_None)) {
  7069. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  7070. __PYX_ERR(0, 336, __pyx_L1_error)
  7071. }
  7072. __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_forced, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 336, __pyx_L1_error)
  7073. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7074. if (__pyx_t_2) {
  7075. /* "fontTools/varLib/iup.py":337
  7076. *
  7077. * if j in forced:
  7078. * break # <<<<<<<<<<<<<<
  7079. *
  7080. * return chain, costs
  7081. */
  7082. goto __pyx_L8_break;
  7083. /* "fontTools/varLib/iup.py":336
  7084. * chain[i] = j
  7085. *
  7086. * if j in forced: # <<<<<<<<<<<<<<
  7087. * break
  7088. *
  7089. */
  7090. }
  7091. }
  7092. __pyx_L8_break:;
  7093. __pyx_L4_continue:;
  7094. }
  7095. /* "fontTools/varLib/iup.py":339
  7096. * break
  7097. *
  7098. * return chain, costs # <<<<<<<<<<<<<<
  7099. *
  7100. *
  7101. */
  7102. __Pyx_XDECREF(__pyx_r);
  7103. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
  7104. __Pyx_GOTREF(__pyx_t_3);
  7105. __Pyx_INCREF(__pyx_v_chain);
  7106. __Pyx_GIVEREF(__pyx_v_chain);
  7107. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chain)) __PYX_ERR(0, 339, __pyx_L1_error);
  7108. __Pyx_INCREF(__pyx_v_costs);
  7109. __Pyx_GIVEREF(__pyx_v_costs);
  7110. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_costs)) __PYX_ERR(0, 339, __pyx_L1_error);
  7111. __pyx_r = __pyx_t_3;
  7112. __pyx_t_3 = 0;
  7113. goto __pyx_L0;
  7114. /* "fontTools/varLib/iup.py":289
  7115. *
  7116. *
  7117. * @cython.locals( # <<<<<<<<<<<<<<
  7118. * i=cython.int,
  7119. * j=cython.int,
  7120. */
  7121. /* function exit code */
  7122. __pyx_L1_error:;
  7123. __Pyx_XDECREF(__pyx_t_3);
  7124. __Pyx_XDECREF(__pyx_t_4);
  7125. __Pyx_XDECREF(__pyx_t_5);
  7126. __Pyx_XDECREF(__pyx_t_6);
  7127. __Pyx_AddTraceback("fontTools.varLib.iup._iup_contour_optimize_dp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7128. __pyx_r = NULL;
  7129. __pyx_L0:;
  7130. __Pyx_XDECREF(__pyx_v_costs);
  7131. __Pyx_XDECREF(__pyx_v_chain);
  7132. __Pyx_XDECREF(__pyx_v_lookback);
  7133. __Pyx_XGIVEREF(__pyx_r);
  7134. __Pyx_RefNannyFinishContext();
  7135. return __pyx_r;
  7136. }
  7137. /* "fontTools/varLib/iup.py":342
  7138. *
  7139. *
  7140. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  7141. * """Rotate list by k items forward. Ie. item at position 0 will be
  7142. * at position k in returned list. Negative k is allowed."""
  7143. */
  7144. /* Python wrapper */
  7145. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_9_rot_list(PyObject *__pyx_self,
  7146. #if CYTHON_METH_FASTCALL
  7147. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7148. #else
  7149. PyObject *__pyx_args, PyObject *__pyx_kwds
  7150. #endif
  7151. ); /*proto*/
  7152. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_8_rot_list, "_rot_list(list l: list, int k: int)\nRotate list by k items forward. Ie. item at position 0 will be\n at position k in returned list. Negative k is allowed.");
  7153. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_9_rot_list = {"_rot_list", (PyCFunction)(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};
  7154. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_9_rot_list(PyObject *__pyx_self,
  7155. #if CYTHON_METH_FASTCALL
  7156. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7157. #else
  7158. PyObject *__pyx_args, PyObject *__pyx_kwds
  7159. #endif
  7160. ) {
  7161. PyObject *__pyx_v_l = 0;
  7162. PyObject *__pyx_v_k = 0;
  7163. #if !CYTHON_METH_FASTCALL
  7164. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7165. #endif
  7166. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7167. PyObject* values[2] = {0,0};
  7168. int __pyx_lineno = 0;
  7169. const char *__pyx_filename = NULL;
  7170. int __pyx_clineno = 0;
  7171. PyObject *__pyx_r = 0;
  7172. __Pyx_RefNannyDeclarations
  7173. __Pyx_RefNannySetupContext("_rot_list (wrapper)", 0);
  7174. #if !CYTHON_METH_FASTCALL
  7175. #if CYTHON_ASSUME_SAFE_MACROS
  7176. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7177. #else
  7178. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7179. #endif
  7180. #endif
  7181. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7182. {
  7183. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_l,&__pyx_n_s_k,0};
  7184. if (__pyx_kwds) {
  7185. Py_ssize_t kw_args;
  7186. switch (__pyx_nargs) {
  7187. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7188. CYTHON_FALLTHROUGH;
  7189. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7190. CYTHON_FALLTHROUGH;
  7191. case 0: break;
  7192. default: goto __pyx_L5_argtuple_error;
  7193. }
  7194. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  7195. switch (__pyx_nargs) {
  7196. case 0:
  7197. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_l)) != 0)) {
  7198. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  7199. kw_args--;
  7200. }
  7201. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 342, __pyx_L3_error)
  7202. else goto __pyx_L5_argtuple_error;
  7203. CYTHON_FALLTHROUGH;
  7204. case 1:
  7205. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_k)) != 0)) {
  7206. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  7207. kw_args--;
  7208. }
  7209. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 342, __pyx_L3_error)
  7210. else {
  7211. __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, 1); __PYX_ERR(0, 342, __pyx_L3_error)
  7212. }
  7213. }
  7214. if (unlikely(kw_args > 0)) {
  7215. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7216. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_rot_list") < 0)) __PYX_ERR(0, 342, __pyx_L3_error)
  7217. }
  7218. } else if (unlikely(__pyx_nargs != 2)) {
  7219. goto __pyx_L5_argtuple_error;
  7220. } else {
  7221. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7222. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7223. }
  7224. __pyx_v_l = ((PyObject*)values[0]);
  7225. __pyx_v_k = ((PyObject*)values[1]);
  7226. }
  7227. goto __pyx_L6_skip;
  7228. __pyx_L5_argtuple_error:;
  7229. __Pyx_RaiseArgtupleInvalid("_rot_list", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 342, __pyx_L3_error)
  7230. __pyx_L6_skip:;
  7231. goto __pyx_L4_argument_unpacking_done;
  7232. __pyx_L3_error:;
  7233. {
  7234. Py_ssize_t __pyx_temp;
  7235. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7236. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7237. }
  7238. }
  7239. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7240. __Pyx_RefNannyFinishContext();
  7241. return NULL;
  7242. __pyx_L4_argument_unpacking_done:;
  7243. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l), (&PyList_Type), 0, "l", 1))) __PYX_ERR(0, 342, __pyx_L1_error)
  7244. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyInt_Type), 0, "k", 1))) __PYX_ERR(0, 342, __pyx_L1_error)
  7245. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_8_rot_list(__pyx_self, __pyx_v_l, __pyx_v_k);
  7246. /* function exit code */
  7247. goto __pyx_L0;
  7248. __pyx_L1_error:;
  7249. __pyx_r = NULL;
  7250. __pyx_L0:;
  7251. {
  7252. Py_ssize_t __pyx_temp;
  7253. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7254. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7255. }
  7256. }
  7257. __Pyx_RefNannyFinishContext();
  7258. return __pyx_r;
  7259. }
  7260. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_8_rot_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l, PyObject *__pyx_v_k) {
  7261. PyObject *__pyx_v_n = NULL;
  7262. PyObject *__pyx_r = NULL;
  7263. __Pyx_RefNannyDeclarations
  7264. Py_ssize_t __pyx_t_1;
  7265. PyObject *__pyx_t_2 = NULL;
  7266. int __pyx_t_3;
  7267. int __pyx_t_4;
  7268. Py_ssize_t __pyx_t_5;
  7269. PyObject *__pyx_t_6 = NULL;
  7270. PyObject *__pyx_t_7 = NULL;
  7271. int __pyx_lineno = 0;
  7272. const char *__pyx_filename = NULL;
  7273. int __pyx_clineno = 0;
  7274. __Pyx_RefNannySetupContext("_rot_list", 0);
  7275. __Pyx_INCREF(__pyx_v_k);
  7276. /* "fontTools/varLib/iup.py":345
  7277. * """Rotate list by k items forward. Ie. item at position 0 will be
  7278. * at position k in returned list. Negative k is allowed."""
  7279. * n = len(l) # <<<<<<<<<<<<<<
  7280. * k %= n
  7281. * if not k:
  7282. */
  7283. __pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_l); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 345, __pyx_L1_error)
  7284. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error)
  7285. __Pyx_GOTREF(__pyx_t_2);
  7286. __pyx_v_n = __pyx_t_2;
  7287. __pyx_t_2 = 0;
  7288. /* "fontTools/varLib/iup.py":346
  7289. * at position k in returned list. Negative k is allowed."""
  7290. * n = len(l)
  7291. * k %= n # <<<<<<<<<<<<<<
  7292. * if not k:
  7293. * return l
  7294. */
  7295. __pyx_t_2 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
  7296. __Pyx_GOTREF(__pyx_t_2);
  7297. if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_2))) __PYX_ERR(0, 346, __pyx_L1_error)
  7298. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_2));
  7299. __pyx_t_2 = 0;
  7300. /* "fontTools/varLib/iup.py":347
  7301. * n = len(l)
  7302. * k %= n
  7303. * if not k: # <<<<<<<<<<<<<<
  7304. * return l
  7305. * return l[n - k :] + l[: n - k]
  7306. */
  7307. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 347, __pyx_L1_error)
  7308. __pyx_t_4 = (!__pyx_t_3);
  7309. if (__pyx_t_4) {
  7310. /* "fontTools/varLib/iup.py":348
  7311. * k %= n
  7312. * if not k:
  7313. * return l # <<<<<<<<<<<<<<
  7314. * return l[n - k :] + l[: n - k]
  7315. *
  7316. */
  7317. __Pyx_XDECREF(__pyx_r);
  7318. __Pyx_INCREF(__pyx_v_l);
  7319. __pyx_r = __pyx_v_l;
  7320. goto __pyx_L0;
  7321. /* "fontTools/varLib/iup.py":347
  7322. * n = len(l)
  7323. * k %= n
  7324. * if not k: # <<<<<<<<<<<<<<
  7325. * return l
  7326. * return l[n - k :] + l[: n - k]
  7327. */
  7328. }
  7329. /* "fontTools/varLib/iup.py":349
  7330. * if not k:
  7331. * return l
  7332. * return l[n - k :] + l[: n - k] # <<<<<<<<<<<<<<
  7333. *
  7334. *
  7335. */
  7336. __Pyx_XDECREF(__pyx_r);
  7337. __pyx_t_2 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  7338. __Pyx_GOTREF(__pyx_t_2);
  7339. __pyx_t_4 = (__pyx_t_2 == Py_None);
  7340. if (__pyx_t_4) {
  7341. __pyx_t_1 = 0;
  7342. } else {
  7343. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error)
  7344. __pyx_t_1 = __pyx_t_5;
  7345. }
  7346. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7347. __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_l, __pyx_t_1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
  7348. __Pyx_GOTREF(__pyx_t_2);
  7349. __pyx_t_6 = PyNumber_Subtract(__pyx_v_n, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 349, __pyx_L1_error)
  7350. __Pyx_GOTREF(__pyx_t_6);
  7351. __pyx_t_4 = (__pyx_t_6 == Py_None);
  7352. if (__pyx_t_4) {
  7353. __pyx_t_1 = PY_SSIZE_T_MAX;
  7354. } else {
  7355. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error)
  7356. __pyx_t_1 = __pyx_t_5;
  7357. }
  7358. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7359. __pyx_t_6 = __Pyx_PyList_GetSlice(__pyx_v_l, 0, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 349, __pyx_L1_error)
  7360. __Pyx_GOTREF(__pyx_t_6);
  7361. __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 349, __pyx_L1_error)
  7362. __Pyx_GOTREF(__pyx_t_7);
  7363. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7364. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7365. __pyx_r = __pyx_t_7;
  7366. __pyx_t_7 = 0;
  7367. goto __pyx_L0;
  7368. /* "fontTools/varLib/iup.py":342
  7369. *
  7370. *
  7371. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  7372. * """Rotate list by k items forward. Ie. item at position 0 will be
  7373. * at position k in returned list. Negative k is allowed."""
  7374. */
  7375. /* function exit code */
  7376. __pyx_L1_error:;
  7377. __Pyx_XDECREF(__pyx_t_2);
  7378. __Pyx_XDECREF(__pyx_t_6);
  7379. __Pyx_XDECREF(__pyx_t_7);
  7380. __Pyx_AddTraceback("fontTools.varLib.iup._rot_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7381. __pyx_r = NULL;
  7382. __pyx_L0:;
  7383. __Pyx_XDECREF(__pyx_v_n);
  7384. __Pyx_XDECREF(__pyx_v_k);
  7385. __Pyx_XGIVEREF(__pyx_r);
  7386. __Pyx_RefNannyFinishContext();
  7387. return __pyx_r;
  7388. }
  7389. /* "fontTools/varLib/iup.py":352
  7390. *
  7391. *
  7392. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  7393. * k %= n
  7394. * if not k:
  7395. */
  7396. /* Python wrapper */
  7397. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_11_rot_set(PyObject *__pyx_self,
  7398. #if CYTHON_METH_FASTCALL
  7399. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7400. #else
  7401. PyObject *__pyx_args, PyObject *__pyx_kwds
  7402. #endif
  7403. ); /*proto*/
  7404. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_10_rot_set, "_rot_set(set s: set, int k: int, int n: int)");
  7405. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_11_rot_set = {"_rot_set", (PyCFunction)(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};
  7406. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_11_rot_set(PyObject *__pyx_self,
  7407. #if CYTHON_METH_FASTCALL
  7408. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7409. #else
  7410. PyObject *__pyx_args, PyObject *__pyx_kwds
  7411. #endif
  7412. ) {
  7413. PyObject *__pyx_v_s = 0;
  7414. PyObject *__pyx_v_k = 0;
  7415. PyObject *__pyx_v_n = 0;
  7416. #if !CYTHON_METH_FASTCALL
  7417. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7418. #endif
  7419. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7420. PyObject* values[3] = {0,0,0};
  7421. int __pyx_lineno = 0;
  7422. const char *__pyx_filename = NULL;
  7423. int __pyx_clineno = 0;
  7424. PyObject *__pyx_r = 0;
  7425. __Pyx_RefNannyDeclarations
  7426. __Pyx_RefNannySetupContext("_rot_set (wrapper)", 0);
  7427. #if !CYTHON_METH_FASTCALL
  7428. #if CYTHON_ASSUME_SAFE_MACROS
  7429. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7430. #else
  7431. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7432. #endif
  7433. #endif
  7434. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7435. {
  7436. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_k,&__pyx_n_s_n,0};
  7437. if (__pyx_kwds) {
  7438. Py_ssize_t kw_args;
  7439. switch (__pyx_nargs) {
  7440. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  7441. CYTHON_FALLTHROUGH;
  7442. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7443. CYTHON_FALLTHROUGH;
  7444. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7445. CYTHON_FALLTHROUGH;
  7446. case 0: break;
  7447. default: goto __pyx_L5_argtuple_error;
  7448. }
  7449. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  7450. switch (__pyx_nargs) {
  7451. case 0:
  7452. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s)) != 0)) {
  7453. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  7454. kw_args--;
  7455. }
  7456. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error)
  7457. else goto __pyx_L5_argtuple_error;
  7458. CYTHON_FALLTHROUGH;
  7459. case 1:
  7460. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_k)) != 0)) {
  7461. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  7462. kw_args--;
  7463. }
  7464. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error)
  7465. else {
  7466. __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, 1); __PYX_ERR(0, 352, __pyx_L3_error)
  7467. }
  7468. CYTHON_FALLTHROUGH;
  7469. case 2:
  7470. if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {
  7471. (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
  7472. kw_args--;
  7473. }
  7474. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error)
  7475. else {
  7476. __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, 2); __PYX_ERR(0, 352, __pyx_L3_error)
  7477. }
  7478. }
  7479. if (unlikely(kw_args > 0)) {
  7480. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7481. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_rot_set") < 0)) __PYX_ERR(0, 352, __pyx_L3_error)
  7482. }
  7483. } else if (unlikely(__pyx_nargs != 3)) {
  7484. goto __pyx_L5_argtuple_error;
  7485. } else {
  7486. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7487. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7488. values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  7489. }
  7490. __pyx_v_s = ((PyObject*)values[0]);
  7491. __pyx_v_k = ((PyObject*)values[1]);
  7492. __pyx_v_n = ((PyObject*)values[2]);
  7493. }
  7494. goto __pyx_L6_skip;
  7495. __pyx_L5_argtuple_error:;
  7496. __Pyx_RaiseArgtupleInvalid("_rot_set", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 352, __pyx_L3_error)
  7497. __pyx_L6_skip:;
  7498. goto __pyx_L4_argument_unpacking_done;
  7499. __pyx_L3_error:;
  7500. {
  7501. Py_ssize_t __pyx_temp;
  7502. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7503. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7504. }
  7505. }
  7506. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7507. __Pyx_RefNannyFinishContext();
  7508. return NULL;
  7509. __pyx_L4_argument_unpacking_done:;
  7510. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PySet_Type), 0, "s", 1))) __PYX_ERR(0, 352, __pyx_L1_error)
  7511. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_k), (&PyInt_Type), 0, "k", 1))) __PYX_ERR(0, 352, __pyx_L1_error)
  7512. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), (&PyInt_Type), 0, "n", 1))) __PYX_ERR(0, 352, __pyx_L1_error)
  7513. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_10_rot_set(__pyx_self, __pyx_v_s, __pyx_v_k, __pyx_v_n);
  7514. /* function exit code */
  7515. goto __pyx_L0;
  7516. __pyx_L1_error:;
  7517. __pyx_r = NULL;
  7518. __pyx_L0:;
  7519. {
  7520. Py_ssize_t __pyx_temp;
  7521. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7522. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7523. }
  7524. }
  7525. __Pyx_RefNannyFinishContext();
  7526. return __pyx_r;
  7527. }
  7528. 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) {
  7529. PyObject *__pyx_8genexpr2__pyx_v_v = NULL;
  7530. PyObject *__pyx_r = NULL;
  7531. __Pyx_RefNannyDeclarations
  7532. PyObject *__pyx_t_1 = NULL;
  7533. int __pyx_t_2;
  7534. int __pyx_t_3;
  7535. PyObject *__pyx_t_4 = NULL;
  7536. Py_ssize_t __pyx_t_5;
  7537. Py_ssize_t __pyx_t_6;
  7538. int __pyx_t_7;
  7539. PyObject *__pyx_t_8 = NULL;
  7540. int __pyx_t_9;
  7541. PyObject *__pyx_t_10 = NULL;
  7542. int __pyx_lineno = 0;
  7543. const char *__pyx_filename = NULL;
  7544. int __pyx_clineno = 0;
  7545. __Pyx_RefNannySetupContext("_rot_set", 0);
  7546. __Pyx_INCREF(__pyx_v_k);
  7547. /* "fontTools/varLib/iup.py":353
  7548. *
  7549. * def _rot_set(s: set, k: int, n: int):
  7550. * k %= n # <<<<<<<<<<<<<<
  7551. * if not k:
  7552. * return s
  7553. */
  7554. __pyx_t_1 = PyNumber_InPlaceRemainder(__pyx_v_k, __pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
  7555. __Pyx_GOTREF(__pyx_t_1);
  7556. __Pyx_DECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_1));
  7557. __pyx_t_1 = 0;
  7558. /* "fontTools/varLib/iup.py":354
  7559. * def _rot_set(s: set, k: int, n: int):
  7560. * k %= n
  7561. * if not k: # <<<<<<<<<<<<<<
  7562. * return s
  7563. * return {(v + k) % n for v in s}
  7564. */
  7565. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_k); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 354, __pyx_L1_error)
  7566. __pyx_t_3 = (!__pyx_t_2);
  7567. if (__pyx_t_3) {
  7568. /* "fontTools/varLib/iup.py":355
  7569. * k %= n
  7570. * if not k:
  7571. * return s # <<<<<<<<<<<<<<
  7572. * return {(v + k) % n for v in s}
  7573. *
  7574. */
  7575. __Pyx_XDECREF(__pyx_r);
  7576. __Pyx_INCREF(__pyx_v_s);
  7577. __pyx_r = __pyx_v_s;
  7578. goto __pyx_L0;
  7579. /* "fontTools/varLib/iup.py":354
  7580. * def _rot_set(s: set, k: int, n: int):
  7581. * k %= n
  7582. * if not k: # <<<<<<<<<<<<<<
  7583. * return s
  7584. * return {(v + k) % n for v in s}
  7585. */
  7586. }
  7587. /* "fontTools/varLib/iup.py":356
  7588. * if not k:
  7589. * return s
  7590. * return {(v + k) % n for v in s} # <<<<<<<<<<<<<<
  7591. *
  7592. *
  7593. */
  7594. __Pyx_XDECREF(__pyx_r);
  7595. { /* enter inner scope */
  7596. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L6_error)
  7597. __Pyx_GOTREF(__pyx_t_1);
  7598. __pyx_t_5 = 0;
  7599. __pyx_t_8 = __Pyx_set_iterator(__pyx_v_s, 1, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L6_error)
  7600. __Pyx_GOTREF(__pyx_t_8);
  7601. __Pyx_XDECREF(__pyx_t_4);
  7602. __pyx_t_4 = __pyx_t_8;
  7603. __pyx_t_8 = 0;
  7604. while (1) {
  7605. __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_4, __pyx_t_6, &__pyx_t_5, &__pyx_t_8, __pyx_t_7);
  7606. if (unlikely(__pyx_t_9 == 0)) break;
  7607. if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 356, __pyx_L6_error)
  7608. __Pyx_GOTREF(__pyx_t_8);
  7609. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_v, __pyx_t_8);
  7610. __pyx_t_8 = 0;
  7611. __pyx_t_8 = PyNumber_Add(__pyx_8genexpr2__pyx_v_v, __pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L6_error)
  7612. __Pyx_GOTREF(__pyx_t_8);
  7613. __pyx_t_10 = PyNumber_Remainder(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 356, __pyx_L6_error)
  7614. __Pyx_GOTREF(__pyx_t_10);
  7615. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7616. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 356, __pyx_L6_error)
  7617. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7618. }
  7619. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7620. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7621. goto __pyx_L9_exit_scope;
  7622. __pyx_L6_error:;
  7623. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v); __pyx_8genexpr2__pyx_v_v = 0;
  7624. goto __pyx_L1_error;
  7625. __pyx_L9_exit_scope:;
  7626. } /* exit inner scope */
  7627. __pyx_r = __pyx_t_1;
  7628. __pyx_t_1 = 0;
  7629. goto __pyx_L0;
  7630. /* "fontTools/varLib/iup.py":352
  7631. *
  7632. *
  7633. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  7634. * k %= n
  7635. * if not k:
  7636. */
  7637. /* function exit code */
  7638. __pyx_L1_error:;
  7639. __Pyx_XDECREF(__pyx_t_1);
  7640. __Pyx_XDECREF(__pyx_t_4);
  7641. __Pyx_XDECREF(__pyx_t_8);
  7642. __Pyx_XDECREF(__pyx_t_10);
  7643. __Pyx_AddTraceback("fontTools.varLib.iup._rot_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7644. __pyx_r = NULL;
  7645. __pyx_L0:;
  7646. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_v);
  7647. __Pyx_XDECREF(__pyx_v_k);
  7648. __Pyx_XGIVEREF(__pyx_r);
  7649. __Pyx_RefNannyFinishContext();
  7650. return __pyx_r;
  7651. }
  7652. /* "fontTools/varLib/iup.py":359
  7653. *
  7654. *
  7655. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  7656. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  7657. * ) -> _DeltaOrNoneSegment:
  7658. */
  7659. /* Python wrapper */
  7660. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize(PyObject *__pyx_self,
  7661. #if CYTHON_METH_FASTCALL
  7662. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7663. #else
  7664. PyObject *__pyx_args, PyObject *__pyx_kwds
  7665. #endif
  7666. ); /*proto*/
  7667. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_12iup_contour_optimize, "iup_contour_optimize(deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0) -> _DeltaOrNoneSegment\nFor contour with coordinates `coords`, optimize a set of delta\n values `deltas` within error `tolerance`.\n\n Returns delta vector that has most number of None items instead of\n the input delta.\n ");
  7668. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_13iup_contour_optimize = {"iup_contour_optimize", (PyCFunction)(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};
  7669. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_13iup_contour_optimize(PyObject *__pyx_self,
  7670. #if CYTHON_METH_FASTCALL
  7671. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7672. #else
  7673. PyObject *__pyx_args, PyObject *__pyx_kwds
  7674. #endif
  7675. ) {
  7676. PyObject *__pyx_v_deltas = 0;
  7677. PyObject *__pyx_v_coords = 0;
  7678. PyObject *__pyx_v_tolerance = 0;
  7679. #if !CYTHON_METH_FASTCALL
  7680. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7681. #endif
  7682. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7683. PyObject* values[3] = {0,0,0};
  7684. int __pyx_lineno = 0;
  7685. const char *__pyx_filename = NULL;
  7686. int __pyx_clineno = 0;
  7687. PyObject *__pyx_r = 0;
  7688. __Pyx_RefNannyDeclarations
  7689. __Pyx_RefNannySetupContext("iup_contour_optimize (wrapper)", 0);
  7690. #if !CYTHON_METH_FASTCALL
  7691. #if CYTHON_ASSUME_SAFE_MACROS
  7692. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7693. #else
  7694. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7695. #endif
  7696. #endif
  7697. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7698. {
  7699. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,&__pyx_n_s_tolerance,0};
  7700. values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_0_0)));
  7701. if (__pyx_kwds) {
  7702. Py_ssize_t kw_args;
  7703. switch (__pyx_nargs) {
  7704. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  7705. CYTHON_FALLTHROUGH;
  7706. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7707. CYTHON_FALLTHROUGH;
  7708. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7709. CYTHON_FALLTHROUGH;
  7710. case 0: break;
  7711. default: goto __pyx_L5_argtuple_error;
  7712. }
  7713. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  7714. switch (__pyx_nargs) {
  7715. case 0:
  7716. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  7717. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  7718. kw_args--;
  7719. }
  7720. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
  7721. else goto __pyx_L5_argtuple_error;
  7722. CYTHON_FALLTHROUGH;
  7723. case 1:
  7724. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  7725. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  7726. kw_args--;
  7727. }
  7728. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
  7729. else {
  7730. __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, 1); __PYX_ERR(0, 359, __pyx_L3_error)
  7731. }
  7732. CYTHON_FALLTHROUGH;
  7733. case 2:
  7734. if (kw_args > 0) {
  7735. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tolerance);
  7736. if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  7737. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
  7738. }
  7739. }
  7740. if (unlikely(kw_args > 0)) {
  7741. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7742. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iup_contour_optimize") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
  7743. }
  7744. } else {
  7745. switch (__pyx_nargs) {
  7746. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  7747. CYTHON_FALLTHROUGH;
  7748. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  7749. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  7750. break;
  7751. default: goto __pyx_L5_argtuple_error;
  7752. }
  7753. }
  7754. __pyx_v_deltas = values[0];
  7755. __pyx_v_coords = values[1];
  7756. __pyx_v_tolerance = values[2];
  7757. }
  7758. goto __pyx_L6_skip;
  7759. __pyx_L5_argtuple_error:;
  7760. __Pyx_RaiseArgtupleInvalid("iup_contour_optimize", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 359, __pyx_L3_error)
  7761. __pyx_L6_skip:;
  7762. goto __pyx_L4_argument_unpacking_done;
  7763. __pyx_L3_error:;
  7764. {
  7765. Py_ssize_t __pyx_temp;
  7766. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7767. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7768. }
  7769. }
  7770. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7771. __Pyx_RefNannyFinishContext();
  7772. return NULL;
  7773. __pyx_L4_argument_unpacking_done:;
  7774. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_12iup_contour_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_tolerance);
  7775. /* function exit code */
  7776. {
  7777. Py_ssize_t __pyx_temp;
  7778. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7779. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  7780. }
  7781. }
  7782. __Pyx_RefNannyFinishContext();
  7783. return __pyx_r;
  7784. }
  7785. 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 */
  7786. /* "fontTools/varLib/iup.py":374
  7787. *
  7788. * # If all are within tolerance distance of 0, encode nothing:
  7789. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  7790. * return [None] * n
  7791. *
  7792. */
  7793. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7794. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  7795. PyObject *__pyx_r = NULL;
  7796. __Pyx_RefNannyDeclarations
  7797. int __pyx_lineno = 0;
  7798. const char *__pyx_filename = NULL;
  7799. int __pyx_clineno = 0;
  7800. __Pyx_RefNannySetupContext("genexpr", 0);
  7801. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  7802. if (unlikely(!__pyx_cur_scope)) {
  7803. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)Py_None);
  7804. __Pyx_INCREF(Py_None);
  7805. __PYX_ERR(0, 374, __pyx_L1_error)
  7806. } else {
  7807. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7808. }
  7809. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7810. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7811. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7812. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7813. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7814. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7815. {
  7816. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iup_contour_optimize_locals_gene, __pyx_n_s_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 374, __pyx_L1_error)
  7817. __Pyx_DECREF(__pyx_cur_scope);
  7818. __Pyx_RefNannyFinishContext();
  7819. return (PyObject *) gen;
  7820. }
  7821. /* function exit code */
  7822. __pyx_L1_error:;
  7823. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7824. __pyx_r = NULL;
  7825. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  7826. __Pyx_XGIVEREF(__pyx_r);
  7827. __Pyx_RefNannyFinishContext();
  7828. return __pyx_r;
  7829. }
  7830. 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 */
  7831. {
  7832. 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);
  7833. PyObject *__pyx_r = NULL;
  7834. PyObject *__pyx_t_1 = NULL;
  7835. Py_ssize_t __pyx_t_2;
  7836. PyObject *(*__pyx_t_3)(PyObject *);
  7837. PyObject *__pyx_t_4 = NULL;
  7838. PyObject *__pyx_t_5 = NULL;
  7839. int __pyx_t_6;
  7840. int __pyx_t_7;
  7841. int __pyx_lineno = 0;
  7842. const char *__pyx_filename = NULL;
  7843. int __pyx_clineno = 0;
  7844. __Pyx_RefNannyDeclarations
  7845. __Pyx_RefNannySetupContext("genexpr", 0);
  7846. switch (__pyx_generator->resume_label) {
  7847. case 0: goto __pyx_L3_first_run;
  7848. default: /* CPython raises the right error here */
  7849. __Pyx_RefNannyFinishContext();
  7850. return NULL;
  7851. }
  7852. __pyx_L3_first_run:;
  7853. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 374, __pyx_L1_error)
  7854. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 374, __pyx_L1_error) }
  7855. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  7856. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  7857. __pyx_t_2 = 0;
  7858. __pyx_t_3 = NULL;
  7859. } else {
  7860. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
  7861. __Pyx_GOTREF(__pyx_t_1);
  7862. __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
  7863. }
  7864. for (;;) {
  7865. if (likely(!__pyx_t_3)) {
  7866. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7867. {
  7868. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  7869. #if !CYTHON_ASSUME_SAFE_MACROS
  7870. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  7871. #endif
  7872. if (__pyx_t_2 >= __pyx_temp) break;
  7873. }
  7874. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7875. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  7876. #else
  7877. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
  7878. __Pyx_GOTREF(__pyx_t_4);
  7879. #endif
  7880. } else {
  7881. {
  7882. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  7883. #if !CYTHON_ASSUME_SAFE_MACROS
  7884. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  7885. #endif
  7886. if (__pyx_t_2 >= __pyx_temp) break;
  7887. }
  7888. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7889. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  7890. #else
  7891. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
  7892. __Pyx_GOTREF(__pyx_t_4);
  7893. #endif
  7894. }
  7895. } else {
  7896. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7897. if (unlikely(!__pyx_t_4)) {
  7898. PyObject* exc_type = PyErr_Occurred();
  7899. if (exc_type) {
  7900. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  7901. else __PYX_ERR(0, 374, __pyx_L1_error)
  7902. }
  7903. break;
  7904. }
  7905. __Pyx_GOTREF(__pyx_t_4);
  7906. }
  7907. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);
  7908. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_4);
  7909. __Pyx_GIVEREF(__pyx_t_4);
  7910. __pyx_t_4 = 0;
  7911. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_cur_scope->__pyx_v_p); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
  7912. __Pyx_GOTREF(__pyx_t_4);
  7913. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 374, __pyx_L1_error)
  7914. __Pyx_GOTREF(__pyx_t_5);
  7915. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7916. __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
  7917. __Pyx_GOTREF(__pyx_t_4);
  7918. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7919. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tolerance)) { __Pyx_RaiseClosureNameError("tolerance"); __PYX_ERR(0, 374, __pyx_L1_error) }
  7920. __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, 374, __pyx_L1_error)
  7921. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7922. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  7923. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7924. __pyx_t_7 = (!__pyx_t_6);
  7925. if (__pyx_t_7) {
  7926. __Pyx_XDECREF(__pyx_r);
  7927. __Pyx_INCREF(Py_False);
  7928. __pyx_r = Py_False;
  7929. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7930. goto __pyx_L0;
  7931. }
  7932. }
  7933. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7934. /*else*/ {
  7935. __Pyx_XDECREF(__pyx_r);
  7936. __Pyx_INCREF(Py_True);
  7937. __pyx_r = Py_True;
  7938. goto __pyx_L0;
  7939. }
  7940. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  7941. /* function exit code */
  7942. goto __pyx_L0;
  7943. __pyx_L1_error:;
  7944. __Pyx_Generator_Replace_StopIteration(0);
  7945. __Pyx_XDECREF(__pyx_t_1);
  7946. __Pyx_XDECREF(__pyx_t_4);
  7947. __Pyx_XDECREF(__pyx_t_5);
  7948. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7949. __pyx_L0:;
  7950. __Pyx_XGIVEREF(__pyx_r);
  7951. #if !CYTHON_USE_EXC_INFO_STACK
  7952. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  7953. #endif
  7954. __pyx_generator->resume_label = -1;
  7955. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  7956. __Pyx_RefNannyFinishContext();
  7957. return __pyx_r;
  7958. }
  7959. 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 */
  7960. /* "fontTools/varLib/iup.py":383
  7961. * # If all deltas are exactly the same, return just one (the first one):
  7962. * d0 = deltas[0]
  7963. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  7964. * return [d0] + [None] * (n - 1)
  7965. *
  7966. */
  7967. static PyObject *__pyx_pf_9fontTools_6varLib_3iup_20iup_contour_optimize_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  7968. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  7969. PyObject *__pyx_r = NULL;
  7970. __Pyx_RefNannyDeclarations
  7971. int __pyx_lineno = 0;
  7972. const char *__pyx_filename = NULL;
  7973. int __pyx_clineno = 0;
  7974. __Pyx_RefNannySetupContext("genexpr", 0);
  7975. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  7976. if (unlikely(!__pyx_cur_scope)) {
  7977. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)Py_None);
  7978. __Pyx_INCREF(Py_None);
  7979. __PYX_ERR(0, 383, __pyx_L1_error)
  7980. } else {
  7981. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  7982. }
  7983. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *) __pyx_self;
  7984. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7985. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  7986. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  7987. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7988. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  7989. {
  7990. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iup_contour_optimize_locals_gene, __pyx_n_s_fontTools_varLib_iup); if (unlikely(!gen)) __PYX_ERR(0, 383, __pyx_L1_error)
  7991. __Pyx_DECREF(__pyx_cur_scope);
  7992. __Pyx_RefNannyFinishContext();
  7993. return (PyObject *) gen;
  7994. }
  7995. /* function exit code */
  7996. __pyx_L1_error:;
  7997. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7998. __pyx_r = NULL;
  7999. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  8000. __Pyx_XGIVEREF(__pyx_r);
  8001. __Pyx_RefNannyFinishContext();
  8002. return __pyx_r;
  8003. }
  8004. 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 */
  8005. {
  8006. 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);
  8007. PyObject *__pyx_r = NULL;
  8008. PyObject *__pyx_t_1 = NULL;
  8009. Py_ssize_t __pyx_t_2;
  8010. PyObject *(*__pyx_t_3)(PyObject *);
  8011. PyObject *__pyx_t_4 = NULL;
  8012. int __pyx_t_5;
  8013. int __pyx_t_6;
  8014. int __pyx_lineno = 0;
  8015. const char *__pyx_filename = NULL;
  8016. int __pyx_clineno = 0;
  8017. __Pyx_RefNannyDeclarations
  8018. __Pyx_RefNannySetupContext("genexpr", 0);
  8019. switch (__pyx_generator->resume_label) {
  8020. case 0: goto __pyx_L3_first_run;
  8021. default: /* CPython raises the right error here */
  8022. __Pyx_RefNannyFinishContext();
  8023. return NULL;
  8024. }
  8025. __pyx_L3_first_run:;
  8026. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 383, __pyx_L1_error)
  8027. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 383, __pyx_L1_error) }
  8028. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  8029. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  8030. __pyx_t_2 = 0;
  8031. __pyx_t_3 = NULL;
  8032. } else {
  8033. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
  8034. __Pyx_GOTREF(__pyx_t_1);
  8035. __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
  8036. }
  8037. for (;;) {
  8038. if (likely(!__pyx_t_3)) {
  8039. if (likely(PyList_CheckExact(__pyx_t_1))) {
  8040. {
  8041. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  8042. #if !CYTHON_ASSUME_SAFE_MACROS
  8043. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8044. #endif
  8045. if (__pyx_t_2 >= __pyx_temp) break;
  8046. }
  8047. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8048. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8049. #else
  8050. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error)
  8051. __Pyx_GOTREF(__pyx_t_4);
  8052. #endif
  8053. } else {
  8054. {
  8055. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  8056. #if !CYTHON_ASSUME_SAFE_MACROS
  8057. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8058. #endif
  8059. if (__pyx_t_2 >= __pyx_temp) break;
  8060. }
  8061. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8062. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8063. #else
  8064. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error)
  8065. __Pyx_GOTREF(__pyx_t_4);
  8066. #endif
  8067. }
  8068. } else {
  8069. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  8070. if (unlikely(!__pyx_t_4)) {
  8071. PyObject* exc_type = PyErr_Occurred();
  8072. if (exc_type) {
  8073. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  8074. else __PYX_ERR(0, 383, __pyx_L1_error)
  8075. }
  8076. break;
  8077. }
  8078. __Pyx_GOTREF(__pyx_t_4);
  8079. }
  8080. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_d);
  8081. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_d, __pyx_t_4);
  8082. __Pyx_GIVEREF(__pyx_t_4);
  8083. __pyx_t_4 = 0;
  8084. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_d0)) { __Pyx_RaiseClosureNameError("d0"); __PYX_ERR(0, 383, __pyx_L1_error) }
  8085. __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, 383, __pyx_L1_error)
  8086. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8087. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8088. __pyx_t_6 = (!__pyx_t_5);
  8089. if (__pyx_t_6) {
  8090. __Pyx_XDECREF(__pyx_r);
  8091. __Pyx_INCREF(Py_False);
  8092. __pyx_r = Py_False;
  8093. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8094. goto __pyx_L0;
  8095. }
  8096. }
  8097. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8098. /*else*/ {
  8099. __Pyx_XDECREF(__pyx_r);
  8100. __Pyx_INCREF(Py_True);
  8101. __pyx_r = Py_True;
  8102. goto __pyx_L0;
  8103. }
  8104. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  8105. /* function exit code */
  8106. goto __pyx_L0;
  8107. __pyx_L1_error:;
  8108. __Pyx_Generator_Replace_StopIteration(0);
  8109. __Pyx_XDECREF(__pyx_t_1);
  8110. __Pyx_XDECREF(__pyx_t_4);
  8111. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8112. __pyx_L0:;
  8113. __Pyx_XGIVEREF(__pyx_r);
  8114. #if !CYTHON_USE_EXC_INFO_STACK
  8115. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  8116. #endif
  8117. __pyx_generator->resume_label = -1;
  8118. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  8119. __Pyx_RefNannyFinishContext();
  8120. return __pyx_r;
  8121. }
  8122. /* "fontTools/varLib/iup.py":359
  8123. *
  8124. *
  8125. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  8126. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  8127. * ) -> _DeltaOrNoneSegment:
  8128. */
  8129. 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) {
  8130. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *__pyx_cur_scope;
  8131. PyObject *__pyx_v_n = NULL;
  8132. PyObject *__pyx_v_forced = NULL;
  8133. PyObject *__pyx_v_k = NULL;
  8134. PyObject *__pyx_v_chain = NULL;
  8135. PyObject *__pyx_v_costs = NULL;
  8136. PyObject *__pyx_v_solution = NULL;
  8137. PyObject *__pyx_v_i = NULL;
  8138. PyObject *__pyx_v_best_sol = NULL;
  8139. PyObject *__pyx_v_best_cost = NULL;
  8140. PyObject *__pyx_v_start = NULL;
  8141. PyObject *__pyx_v_cost = NULL;
  8142. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1 = 0;
  8143. PyObject *__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2 = 0;
  8144. PyObject *__pyx_8genexpr5__pyx_v_i = NULL;
  8145. PyObject *__pyx_8genexpr6__pyx_v_i = NULL;
  8146. PyObject *__pyx_r = NULL;
  8147. __Pyx_RefNannyDeclarations
  8148. Py_ssize_t __pyx_t_1;
  8149. PyObject *__pyx_t_2 = NULL;
  8150. PyObject *__pyx_t_3 = NULL;
  8151. int __pyx_t_4;
  8152. PyObject *__pyx_t_5 = NULL;
  8153. int __pyx_t_6;
  8154. PyObject *__pyx_t_7 = NULL;
  8155. PyObject *(*__pyx_t_8)(PyObject *);
  8156. int __pyx_t_9;
  8157. PyObject *(*__pyx_t_10)(PyObject *);
  8158. PyObject *__pyx_t_11 = NULL;
  8159. int __pyx_lineno = 0;
  8160. const char *__pyx_filename = NULL;
  8161. int __pyx_clineno = 0;
  8162. __Pyx_RefNannySetupContext("iup_contour_optimize", 0);
  8163. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, __pyx_empty_tuple, NULL);
  8164. if (unlikely(!__pyx_cur_scope)) {
  8165. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize *)Py_None);
  8166. __Pyx_INCREF(Py_None);
  8167. __PYX_ERR(0, 359, __pyx_L1_error)
  8168. } else {
  8169. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  8170. }
  8171. __pyx_cur_scope->__pyx_v_tolerance = __pyx_v_tolerance;
  8172. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tolerance);
  8173. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tolerance);
  8174. __Pyx_INCREF(__pyx_v_deltas);
  8175. __Pyx_INCREF(__pyx_v_coords);
  8176. /* "fontTools/varLib/iup.py":369
  8177. * """
  8178. *
  8179. * n = len(deltas) # <<<<<<<<<<<<<<
  8180. *
  8181. * # Get the easy cases out of the way:
  8182. */
  8183. __pyx_t_1 = PyObject_Length(__pyx_v_deltas); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 369, __pyx_L1_error)
  8184. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
  8185. __Pyx_GOTREF(__pyx_t_2);
  8186. __pyx_v_n = __pyx_t_2;
  8187. __pyx_t_2 = 0;
  8188. /* "fontTools/varLib/iup.py":374
  8189. *
  8190. * # If all are within tolerance distance of 0, encode nothing:
  8191. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  8192. * return [None] * n
  8193. *
  8194. */
  8195. __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, 374, __pyx_L1_error)
  8196. __Pyx_GOTREF(__pyx_t_2);
  8197. __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
  8198. __Pyx_GOTREF(__pyx_t_3);
  8199. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8200. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  8201. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8202. if (__pyx_t_4) {
  8203. /* "fontTools/varLib/iup.py":375
  8204. * # If all are within tolerance distance of 0, encode nothing:
  8205. * if all(abs(complex(*p)) <= tolerance for p in deltas):
  8206. * return [None] * n # <<<<<<<<<<<<<<
  8207. *
  8208. * # If there's exactly one point, return it:
  8209. */
  8210. __Pyx_XDECREF(__pyx_r);
  8211. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  8212. __Pyx_GOTREF(__pyx_t_3);
  8213. __Pyx_INCREF(Py_None);
  8214. __Pyx_GIVEREF(Py_None);
  8215. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(0, 375, __pyx_L1_error);
  8216. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_n); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 375, __pyx_L1_error)
  8217. __Pyx_GOTREF(__pyx_temp);
  8218. __Pyx_DECREF(__pyx_t_3);
  8219. __pyx_t_3 = __pyx_temp;
  8220. }
  8221. __pyx_r = __pyx_t_3;
  8222. __pyx_t_3 = 0;
  8223. goto __pyx_L0;
  8224. /* "fontTools/varLib/iup.py":374
  8225. *
  8226. * # If all are within tolerance distance of 0, encode nothing:
  8227. * if all(abs(complex(*p)) <= tolerance for p in deltas): # <<<<<<<<<<<<<<
  8228. * return [None] * n
  8229. *
  8230. */
  8231. }
  8232. /* "fontTools/varLib/iup.py":378
  8233. *
  8234. * # If there's exactly one point, return it:
  8235. * if n == 1: # <<<<<<<<<<<<<<
  8236. * return deltas
  8237. *
  8238. */
  8239. __pyx_t_4 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_n, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 378, __pyx_L1_error)
  8240. if (__pyx_t_4) {
  8241. /* "fontTools/varLib/iup.py":379
  8242. * # If there's exactly one point, return it:
  8243. * if n == 1:
  8244. * return deltas # <<<<<<<<<<<<<<
  8245. *
  8246. * # If all deltas are exactly the same, return just one (the first one):
  8247. */
  8248. __Pyx_XDECREF(__pyx_r);
  8249. __Pyx_INCREF(__pyx_v_deltas);
  8250. __pyx_r = __pyx_v_deltas;
  8251. goto __pyx_L0;
  8252. /* "fontTools/varLib/iup.py":378
  8253. *
  8254. * # If there's exactly one point, return it:
  8255. * if n == 1: # <<<<<<<<<<<<<<
  8256. * return deltas
  8257. *
  8258. */
  8259. }
  8260. /* "fontTools/varLib/iup.py":382
  8261. *
  8262. * # If all deltas are exactly the same, return just one (the first one):
  8263. * d0 = deltas[0] # <<<<<<<<<<<<<<
  8264. * if all(d0 == d for d in deltas):
  8265. * return [d0] + [None] * (n - 1)
  8266. */
  8267. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_deltas, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
  8268. __Pyx_GOTREF(__pyx_t_3);
  8269. __Pyx_GIVEREF(__pyx_t_3);
  8270. __pyx_cur_scope->__pyx_v_d0 = __pyx_t_3;
  8271. __pyx_t_3 = 0;
  8272. /* "fontTools/varLib/iup.py":383
  8273. * # If all deltas are exactly the same, return just one (the first one):
  8274. * d0 = deltas[0]
  8275. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  8276. * return [d0] + [None] * (n - 1)
  8277. *
  8278. */
  8279. __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, 383, __pyx_L1_error)
  8280. __Pyx_GOTREF(__pyx_t_3);
  8281. __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
  8282. __Pyx_GOTREF(__pyx_t_2);
  8283. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8284. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 383, __pyx_L1_error)
  8285. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8286. if (__pyx_t_4) {
  8287. /* "fontTools/varLib/iup.py":384
  8288. * d0 = deltas[0]
  8289. * if all(d0 == d for d in deltas):
  8290. * return [d0] + [None] * (n - 1) # <<<<<<<<<<<<<<
  8291. *
  8292. * # Else, solve the general problem using Dynamic Programming.
  8293. */
  8294. __Pyx_XDECREF(__pyx_r);
  8295. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
  8296. __Pyx_GOTREF(__pyx_t_2);
  8297. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_d0);
  8298. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_d0);
  8299. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_d0)) __PYX_ERR(0, 384, __pyx_L1_error);
  8300. __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  8301. __Pyx_GOTREF(__pyx_t_3);
  8302. __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
  8303. __Pyx_GOTREF(__pyx_t_5);
  8304. __Pyx_INCREF(Py_None);
  8305. __Pyx_GIVEREF(Py_None);
  8306. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, Py_None)) __PYX_ERR(0, 384, __pyx_L1_error);
  8307. { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 384, __pyx_L1_error)
  8308. __Pyx_GOTREF(__pyx_temp);
  8309. __Pyx_DECREF(__pyx_t_5);
  8310. __pyx_t_5 = __pyx_temp;
  8311. }
  8312. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8313. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  8314. __Pyx_GOTREF(__pyx_t_3);
  8315. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8316. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8317. __pyx_r = __pyx_t_3;
  8318. __pyx_t_3 = 0;
  8319. goto __pyx_L0;
  8320. /* "fontTools/varLib/iup.py":383
  8321. * # If all deltas are exactly the same, return just one (the first one):
  8322. * d0 = deltas[0]
  8323. * if all(d0 == d for d in deltas): # <<<<<<<<<<<<<<
  8324. * return [d0] + [None] * (n - 1)
  8325. *
  8326. */
  8327. }
  8328. /* "fontTools/varLib/iup.py":388
  8329. * # Else, solve the general problem using Dynamic Programming.
  8330. *
  8331. * forced = _iup_contour_bound_forced_set(deltas, coords, tolerance) # <<<<<<<<<<<<<<
  8332. * # The _iup_contour_optimize_dp() routine returns the optimal encoding
  8333. * # solution given the constraint that the last point is always encoded.
  8334. */
  8335. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_iup_contour_bound_forced_set); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
  8336. __Pyx_GOTREF(__pyx_t_5);
  8337. __pyx_t_2 = NULL;
  8338. __pyx_t_6 = 0;
  8339. #if CYTHON_UNPACK_METHODS
  8340. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8341. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
  8342. if (likely(__pyx_t_2)) {
  8343. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8344. __Pyx_INCREF(__pyx_t_2);
  8345. __Pyx_INCREF(function);
  8346. __Pyx_DECREF_SET(__pyx_t_5, function);
  8347. __pyx_t_6 = 1;
  8348. }
  8349. }
  8350. #endif
  8351. {
  8352. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_deltas, __pyx_v_coords, __pyx_cur_scope->__pyx_v_tolerance};
  8353. __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 3+__pyx_t_6);
  8354. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8355. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  8356. __Pyx_GOTREF(__pyx_t_3);
  8357. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8358. }
  8359. __pyx_v_forced = __pyx_t_3;
  8360. __pyx_t_3 = 0;
  8361. /* "fontTools/varLib/iup.py":397
  8362. * # if the font size changes (reduced); that would mean the forced-set
  8363. * # has members it should not have.
  8364. * if forced: # <<<<<<<<<<<<<<
  8365. * # Forced set is non-empty: rotate the contour start point
  8366. * # such that the last point in the list is a forced point.
  8367. */
  8368. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_forced); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 397, __pyx_L1_error)
  8369. if (__pyx_t_4) {
  8370. /* "fontTools/varLib/iup.py":400
  8371. * # Forced set is non-empty: rotate the contour start point
  8372. * # such that the last point in the list is a forced point.
  8373. * k = (n - 1) - max(forced) # <<<<<<<<<<<<<<
  8374. * assert k >= 0
  8375. *
  8376. */
  8377. __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)
  8378. __Pyx_GOTREF(__pyx_t_3);
  8379. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_forced); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
  8380. __Pyx_GOTREF(__pyx_t_5);
  8381. __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
  8382. __Pyx_GOTREF(__pyx_t_2);
  8383. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8384. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8385. __pyx_v_k = __pyx_t_2;
  8386. __pyx_t_2 = 0;
  8387. /* "fontTools/varLib/iup.py":401
  8388. * # such that the last point in the list is a forced point.
  8389. * k = (n - 1) - max(forced)
  8390. * assert k >= 0 # <<<<<<<<<<<<<<
  8391. *
  8392. * deltas = _rot_list(deltas, k)
  8393. */
  8394. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8395. if (unlikely(__pyx_assertions_enabled())) {
  8396. __pyx_t_2 = PyObject_RichCompare(__pyx_v_k, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
  8397. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
  8398. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8399. if (unlikely(!__pyx_t_4)) {
  8400. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  8401. __PYX_ERR(0, 401, __pyx_L1_error)
  8402. }
  8403. }
  8404. #else
  8405. if ((1)); else __PYX_ERR(0, 401, __pyx_L1_error)
  8406. #endif
  8407. /* "fontTools/varLib/iup.py":403
  8408. * assert k >= 0
  8409. *
  8410. * deltas = _rot_list(deltas, k) # <<<<<<<<<<<<<<
  8411. * coords = _rot_list(coords, k)
  8412. * forced = _rot_set(forced, k, n)
  8413. */
  8414. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_rot_list); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
  8415. __Pyx_GOTREF(__pyx_t_5);
  8416. __pyx_t_3 = NULL;
  8417. __pyx_t_6 = 0;
  8418. #if CYTHON_UNPACK_METHODS
  8419. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8420. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  8421. if (likely(__pyx_t_3)) {
  8422. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8423. __Pyx_INCREF(__pyx_t_3);
  8424. __Pyx_INCREF(function);
  8425. __Pyx_DECREF_SET(__pyx_t_5, function);
  8426. __pyx_t_6 = 1;
  8427. }
  8428. }
  8429. #endif
  8430. {
  8431. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_deltas, __pyx_v_k};
  8432. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
  8433. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8434. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
  8435. __Pyx_GOTREF(__pyx_t_2);
  8436. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8437. }
  8438. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_2);
  8439. __pyx_t_2 = 0;
  8440. /* "fontTools/varLib/iup.py":404
  8441. *
  8442. * deltas = _rot_list(deltas, k)
  8443. * coords = _rot_list(coords, k) # <<<<<<<<<<<<<<
  8444. * forced = _rot_set(forced, k, n)
  8445. *
  8446. */
  8447. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_rot_list); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error)
  8448. __Pyx_GOTREF(__pyx_t_5);
  8449. __pyx_t_3 = NULL;
  8450. __pyx_t_6 = 0;
  8451. #if CYTHON_UNPACK_METHODS
  8452. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8453. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  8454. if (likely(__pyx_t_3)) {
  8455. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8456. __Pyx_INCREF(__pyx_t_3);
  8457. __Pyx_INCREF(function);
  8458. __Pyx_DECREF_SET(__pyx_t_5, function);
  8459. __pyx_t_6 = 1;
  8460. }
  8461. }
  8462. #endif
  8463. {
  8464. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_coords, __pyx_v_k};
  8465. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
  8466. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8467. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
  8468. __Pyx_GOTREF(__pyx_t_2);
  8469. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8470. }
  8471. __Pyx_DECREF_SET(__pyx_v_coords, __pyx_t_2);
  8472. __pyx_t_2 = 0;
  8473. /* "fontTools/varLib/iup.py":405
  8474. * deltas = _rot_list(deltas, k)
  8475. * coords = _rot_list(coords, k)
  8476. * forced = _rot_set(forced, k, n) # <<<<<<<<<<<<<<
  8477. *
  8478. * # Debugging: Pass a set() instead of forced variable to the next call
  8479. */
  8480. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_rot_set); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L1_error)
  8481. __Pyx_GOTREF(__pyx_t_5);
  8482. __pyx_t_3 = NULL;
  8483. __pyx_t_6 = 0;
  8484. #if CYTHON_UNPACK_METHODS
  8485. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8486. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  8487. if (likely(__pyx_t_3)) {
  8488. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8489. __Pyx_INCREF(__pyx_t_3);
  8490. __Pyx_INCREF(function);
  8491. __Pyx_DECREF_SET(__pyx_t_5, function);
  8492. __pyx_t_6 = 1;
  8493. }
  8494. }
  8495. #endif
  8496. {
  8497. PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_forced, __pyx_v_k, __pyx_v_n};
  8498. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 3+__pyx_t_6);
  8499. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8500. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
  8501. __Pyx_GOTREF(__pyx_t_2);
  8502. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8503. }
  8504. __Pyx_DECREF_SET(__pyx_v_forced, __pyx_t_2);
  8505. __pyx_t_2 = 0;
  8506. /* "fontTools/varLib/iup.py":409
  8507. * # Debugging: Pass a set() instead of forced variable to the next call
  8508. * # to exercise forced-set computation for under-counting.
  8509. * chain, costs = _iup_contour_optimize_dp(deltas, coords, forced, tolerance) # <<<<<<<<<<<<<<
  8510. *
  8511. * # Assemble solution.
  8512. */
  8513. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_iup_contour_optimize_dp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  8514. __Pyx_GOTREF(__pyx_t_5);
  8515. __pyx_t_3 = NULL;
  8516. __pyx_t_6 = 0;
  8517. #if CYTHON_UNPACK_METHODS
  8518. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8519. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  8520. if (likely(__pyx_t_3)) {
  8521. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8522. __Pyx_INCREF(__pyx_t_3);
  8523. __Pyx_INCREF(function);
  8524. __Pyx_DECREF_SET(__pyx_t_5, function);
  8525. __pyx_t_6 = 1;
  8526. }
  8527. }
  8528. #endif
  8529. {
  8530. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_deltas, __pyx_v_coords, __pyx_v_forced, __pyx_cur_scope->__pyx_v_tolerance};
  8531. __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
  8532. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8533. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
  8534. __Pyx_GOTREF(__pyx_t_2);
  8535. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8536. }
  8537. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  8538. PyObject* sequence = __pyx_t_2;
  8539. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8540. if (unlikely(size != 2)) {
  8541. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8542. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8543. __PYX_ERR(0, 409, __pyx_L1_error)
  8544. }
  8545. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8546. if (likely(PyTuple_CheckExact(sequence))) {
  8547. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  8548. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
  8549. } else {
  8550. __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
  8551. __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
  8552. }
  8553. __Pyx_INCREF(__pyx_t_5);
  8554. __Pyx_INCREF(__pyx_t_3);
  8555. #else
  8556. __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  8557. __Pyx_GOTREF(__pyx_t_5);
  8558. __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
  8559. __Pyx_GOTREF(__pyx_t_3);
  8560. #endif
  8561. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8562. } else {
  8563. Py_ssize_t index = -1;
  8564. __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 409, __pyx_L1_error)
  8565. __Pyx_GOTREF(__pyx_t_7);
  8566. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8567. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  8568. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
  8569. __Pyx_GOTREF(__pyx_t_5);
  8570. index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
  8571. __Pyx_GOTREF(__pyx_t_3);
  8572. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
  8573. __pyx_t_8 = NULL;
  8574. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8575. goto __pyx_L8_unpacking_done;
  8576. __pyx_L7_unpacking_failed:;
  8577. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8578. __pyx_t_8 = NULL;
  8579. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8580. __PYX_ERR(0, 409, __pyx_L1_error)
  8581. __pyx_L8_unpacking_done:;
  8582. }
  8583. __pyx_v_chain = __pyx_t_5;
  8584. __pyx_t_5 = 0;
  8585. __pyx_v_costs = __pyx_t_3;
  8586. __pyx_t_3 = 0;
  8587. /* "fontTools/varLib/iup.py":412
  8588. *
  8589. * # Assemble solution.
  8590. * solution = set() # <<<<<<<<<<<<<<
  8591. * i = n - 1
  8592. * while i is not None:
  8593. */
  8594. __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  8595. __Pyx_GOTREF(__pyx_t_2);
  8596. __pyx_v_solution = ((PyObject*)__pyx_t_2);
  8597. __pyx_t_2 = 0;
  8598. /* "fontTools/varLib/iup.py":413
  8599. * # Assemble solution.
  8600. * solution = set()
  8601. * i = n - 1 # <<<<<<<<<<<<<<
  8602. * while i is not None:
  8603. * solution.add(i)
  8604. */
  8605. __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  8606. __Pyx_GOTREF(__pyx_t_2);
  8607. __pyx_v_i = __pyx_t_2;
  8608. __pyx_t_2 = 0;
  8609. /* "fontTools/varLib/iup.py":414
  8610. * solution = set()
  8611. * i = n - 1
  8612. * while i is not None: # <<<<<<<<<<<<<<
  8613. * solution.add(i)
  8614. * i = chain[i]
  8615. */
  8616. while (1) {
  8617. __pyx_t_4 = (__pyx_v_i != Py_None);
  8618. if (!__pyx_t_4) break;
  8619. /* "fontTools/varLib/iup.py":415
  8620. * i = n - 1
  8621. * while i is not None:
  8622. * solution.add(i) # <<<<<<<<<<<<<<
  8623. * i = chain[i]
  8624. * solution.remove(-1)
  8625. */
  8626. __pyx_t_9 = PySet_Add(__pyx_v_solution, __pyx_v_i); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 415, __pyx_L1_error)
  8627. /* "fontTools/varLib/iup.py":416
  8628. * while i is not None:
  8629. * solution.add(i)
  8630. * i = chain[i] # <<<<<<<<<<<<<<
  8631. * solution.remove(-1)
  8632. *
  8633. */
  8634. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
  8635. __Pyx_GOTREF(__pyx_t_2);
  8636. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
  8637. __pyx_t_2 = 0;
  8638. }
  8639. /* "fontTools/varLib/iup.py":417
  8640. * solution.add(i)
  8641. * i = chain[i]
  8642. * solution.remove(-1) # <<<<<<<<<<<<<<
  8643. *
  8644. * # if not forced <= solution:
  8645. */
  8646. __pyx_t_9 = __Pyx_PySet_Remove(__pyx_v_solution, __pyx_int_neg_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 417, __pyx_L1_error)
  8647. /* "fontTools/varLib/iup.py":423
  8648. * # print("deltas", deltas)
  8649. * # print("len", len(deltas))
  8650. * assert forced <= solution, (forced, solution) # <<<<<<<<<<<<<<
  8651. *
  8652. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8653. */
  8654. #ifndef CYTHON_WITHOUT_ASSERTIONS
  8655. if (unlikely(__pyx_assertions_enabled())) {
  8656. __pyx_t_2 = PyObject_RichCompare(__pyx_v_forced, __pyx_v_solution, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  8657. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 423, __pyx_L1_error)
  8658. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8659. if (unlikely(!__pyx_t_4)) {
  8660. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  8661. __Pyx_GOTREF(__pyx_t_2);
  8662. __Pyx_INCREF(__pyx_v_forced);
  8663. __Pyx_GIVEREF(__pyx_v_forced);
  8664. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_forced)) __PYX_ERR(0, 423, __pyx_L1_error);
  8665. __Pyx_INCREF(__pyx_v_solution);
  8666. __Pyx_GIVEREF(__pyx_v_solution);
  8667. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_solution)) __PYX_ERR(0, 423, __pyx_L1_error);
  8668. __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
  8669. __Pyx_GOTREF(__pyx_t_3);
  8670. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8671. __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_3, 0, 0);
  8672. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8673. __PYX_ERR(0, 423, __pyx_L1_error)
  8674. }
  8675. }
  8676. #else
  8677. if ((1)); else __PYX_ERR(0, 423, __pyx_L1_error)
  8678. #endif
  8679. /* "fontTools/varLib/iup.py":425
  8680. * assert forced <= solution, (forced, solution)
  8681. *
  8682. * deltas = [deltas[i] if i in solution else None for i in range(n)] # <<<<<<<<<<<<<<
  8683. *
  8684. * deltas = _rot_list(deltas, -k)
  8685. */
  8686. { /* enter inner scope */
  8687. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L13_error)
  8688. __Pyx_GOTREF(__pyx_t_3);
  8689. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L13_error)
  8690. __Pyx_GOTREF(__pyx_t_2);
  8691. if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
  8692. __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5);
  8693. __pyx_t_1 = 0;
  8694. __pyx_t_10 = NULL;
  8695. } else {
  8696. __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L13_error)
  8697. __Pyx_GOTREF(__pyx_t_5);
  8698. __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L13_error)
  8699. }
  8700. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8701. for (;;) {
  8702. if (likely(!__pyx_t_10)) {
  8703. if (likely(PyList_CheckExact(__pyx_t_5))) {
  8704. {
  8705. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  8706. #if !CYTHON_ASSUME_SAFE_MACROS
  8707. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 425, __pyx_L13_error)
  8708. #endif
  8709. if (__pyx_t_1 >= __pyx_temp) break;
  8710. }
  8711. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8712. __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 425, __pyx_L13_error)
  8713. #else
  8714. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L13_error)
  8715. __Pyx_GOTREF(__pyx_t_2);
  8716. #endif
  8717. } else {
  8718. {
  8719. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  8720. #if !CYTHON_ASSUME_SAFE_MACROS
  8721. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 425, __pyx_L13_error)
  8722. #endif
  8723. if (__pyx_t_1 >= __pyx_temp) break;
  8724. }
  8725. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8726. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 425, __pyx_L13_error)
  8727. #else
  8728. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L13_error)
  8729. __Pyx_GOTREF(__pyx_t_2);
  8730. #endif
  8731. }
  8732. } else {
  8733. __pyx_t_2 = __pyx_t_10(__pyx_t_5);
  8734. if (unlikely(!__pyx_t_2)) {
  8735. PyObject* exc_type = PyErr_Occurred();
  8736. if (exc_type) {
  8737. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  8738. else __PYX_ERR(0, 425, __pyx_L13_error)
  8739. }
  8740. break;
  8741. }
  8742. __Pyx_GOTREF(__pyx_t_2);
  8743. }
  8744. __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_i, __pyx_t_2);
  8745. __pyx_t_2 = 0;
  8746. __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, 425, __pyx_L13_error)
  8747. if (__pyx_t_4) {
  8748. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_8genexpr5__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 425, __pyx_L13_error)
  8749. __Pyx_GOTREF(__pyx_t_7);
  8750. __pyx_t_2 = __pyx_t_7;
  8751. __pyx_t_7 = 0;
  8752. } else {
  8753. __Pyx_INCREF(Py_None);
  8754. __pyx_t_2 = Py_None;
  8755. }
  8756. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 425, __pyx_L13_error)
  8757. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8758. }
  8759. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8760. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8761. goto __pyx_L17_exit_scope;
  8762. __pyx_L13_error:;
  8763. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i); __pyx_8genexpr5__pyx_v_i = 0;
  8764. goto __pyx_L1_error;
  8765. __pyx_L17_exit_scope:;
  8766. } /* exit inner scope */
  8767. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8768. __pyx_t_3 = 0;
  8769. /* "fontTools/varLib/iup.py":427
  8770. * deltas = [deltas[i] if i in solution else None for i in range(n)]
  8771. *
  8772. * deltas = _rot_list(deltas, -k) # <<<<<<<<<<<<<<
  8773. * else:
  8774. * # Repeat the contour an extra time, solve the new case, then look for solutions of the
  8775. */
  8776. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_rot_list); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  8777. __Pyx_GOTREF(__pyx_t_5);
  8778. __pyx_t_2 = PyNumber_Negative(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
  8779. __Pyx_GOTREF(__pyx_t_2);
  8780. __pyx_t_7 = NULL;
  8781. __pyx_t_6 = 0;
  8782. #if CYTHON_UNPACK_METHODS
  8783. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8784. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
  8785. if (likely(__pyx_t_7)) {
  8786. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8787. __Pyx_INCREF(__pyx_t_7);
  8788. __Pyx_INCREF(function);
  8789. __Pyx_DECREF_SET(__pyx_t_5, function);
  8790. __pyx_t_6 = 1;
  8791. }
  8792. }
  8793. #endif
  8794. {
  8795. PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_deltas, __pyx_t_2};
  8796. __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
  8797. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  8798. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8799. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
  8800. __Pyx_GOTREF(__pyx_t_3);
  8801. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8802. }
  8803. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_3);
  8804. __pyx_t_3 = 0;
  8805. /* "fontTools/varLib/iup.py":397
  8806. * # if the font size changes (reduced); that would mean the forced-set
  8807. * # has members it should not have.
  8808. * if forced: # <<<<<<<<<<<<<<
  8809. * # Forced set is non-empty: rotate the contour start point
  8810. * # such that the last point in the list is a forced point.
  8811. */
  8812. goto __pyx_L6;
  8813. }
  8814. /* "fontTools/varLib/iup.py":432
  8815. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8816. * # this always produces the optimal solution...
  8817. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8818. * deltas + deltas, coords + coords, forced, tolerance, n
  8819. * )
  8820. */
  8821. /*else*/ {
  8822. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_iup_contour_optimize_dp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L1_error)
  8823. __Pyx_GOTREF(__pyx_t_5);
  8824. /* "fontTools/varLib/iup.py":433
  8825. * # this always produces the optimal solution...
  8826. * chain, costs = _iup_contour_optimize_dp(
  8827. * deltas + deltas, coords + coords, forced, tolerance, n # <<<<<<<<<<<<<<
  8828. * )
  8829. * best_sol, best_cost = None, n + 1
  8830. */
  8831. __pyx_t_2 = PyNumber_Add(__pyx_v_deltas, __pyx_v_deltas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error)
  8832. __Pyx_GOTREF(__pyx_t_2);
  8833. __pyx_t_7 = PyNumber_Add(__pyx_v_coords, __pyx_v_coords); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error)
  8834. __Pyx_GOTREF(__pyx_t_7);
  8835. __pyx_t_11 = NULL;
  8836. __pyx_t_6 = 0;
  8837. #if CYTHON_UNPACK_METHODS
  8838. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  8839. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
  8840. if (likely(__pyx_t_11)) {
  8841. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  8842. __Pyx_INCREF(__pyx_t_11);
  8843. __Pyx_INCREF(function);
  8844. __Pyx_DECREF_SET(__pyx_t_5, function);
  8845. __pyx_t_6 = 1;
  8846. }
  8847. }
  8848. #endif
  8849. {
  8850. PyObject *__pyx_callargs[6] = {__pyx_t_11, __pyx_t_2, __pyx_t_7, __pyx_v_forced, __pyx_cur_scope->__pyx_v_tolerance, __pyx_v_n};
  8851. __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 5+__pyx_t_6);
  8852. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  8853. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8854. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  8855. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error)
  8856. __Pyx_GOTREF(__pyx_t_3);
  8857. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8858. }
  8859. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  8860. PyObject* sequence = __pyx_t_3;
  8861. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8862. if (unlikely(size != 2)) {
  8863. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8864. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8865. __PYX_ERR(0, 432, __pyx_L1_error)
  8866. }
  8867. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8868. if (likely(PyTuple_CheckExact(sequence))) {
  8869. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
  8870. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  8871. } else {
  8872. __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
  8873. __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
  8874. }
  8875. __Pyx_INCREF(__pyx_t_5);
  8876. __Pyx_INCREF(__pyx_t_7);
  8877. #else
  8878. __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L1_error)
  8879. __Pyx_GOTREF(__pyx_t_5);
  8880. __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L1_error)
  8881. __Pyx_GOTREF(__pyx_t_7);
  8882. #endif
  8883. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8884. } else {
  8885. Py_ssize_t index = -1;
  8886. __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
  8887. __Pyx_GOTREF(__pyx_t_2);
  8888. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8889. __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2);
  8890. index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L18_unpacking_failed;
  8891. __Pyx_GOTREF(__pyx_t_5);
  8892. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
  8893. __Pyx_GOTREF(__pyx_t_7);
  8894. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < 0) __PYX_ERR(0, 432, __pyx_L1_error)
  8895. __pyx_t_8 = NULL;
  8896. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8897. goto __pyx_L19_unpacking_done;
  8898. __pyx_L18_unpacking_failed:;
  8899. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8900. __pyx_t_8 = NULL;
  8901. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8902. __PYX_ERR(0, 432, __pyx_L1_error)
  8903. __pyx_L19_unpacking_done:;
  8904. }
  8905. /* "fontTools/varLib/iup.py":432
  8906. * # circular n-length problem in the solution for new linear case. I cannot prove that
  8907. * # this always produces the optimal solution...
  8908. * chain, costs = _iup_contour_optimize_dp( # <<<<<<<<<<<<<<
  8909. * deltas + deltas, coords + coords, forced, tolerance, n
  8910. * )
  8911. */
  8912. __pyx_v_chain = __pyx_t_5;
  8913. __pyx_t_5 = 0;
  8914. __pyx_v_costs = __pyx_t_7;
  8915. __pyx_t_7 = 0;
  8916. /* "fontTools/varLib/iup.py":435
  8917. * deltas + deltas, coords + coords, forced, tolerance, n
  8918. * )
  8919. * best_sol, best_cost = None, n + 1 # <<<<<<<<<<<<<<
  8920. *
  8921. * for start in range(n - 1, len(costs) - 1):
  8922. */
  8923. __pyx_t_3 = Py_None;
  8924. __Pyx_INCREF(__pyx_t_3);
  8925. __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L1_error)
  8926. __Pyx_GOTREF(__pyx_t_7);
  8927. __pyx_v_best_sol = ((PyObject*)__pyx_t_3);
  8928. __pyx_t_3 = 0;
  8929. __pyx_v_best_cost = __pyx_t_7;
  8930. __pyx_t_7 = 0;
  8931. /* "fontTools/varLib/iup.py":437
  8932. * best_sol, best_cost = None, n + 1
  8933. *
  8934. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  8935. * # Assemble solution.
  8936. * solution = set()
  8937. */
  8938. __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error)
  8939. __Pyx_GOTREF(__pyx_t_7);
  8940. __pyx_t_1 = PyObject_Length(__pyx_v_costs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 437, __pyx_L1_error)
  8941. __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_1 - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
  8942. __Pyx_GOTREF(__pyx_t_3);
  8943. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error)
  8944. __Pyx_GOTREF(__pyx_t_5);
  8945. __Pyx_GIVEREF(__pyx_t_7);
  8946. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error);
  8947. __Pyx_GIVEREF(__pyx_t_3);
  8948. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error);
  8949. __pyx_t_7 = 0;
  8950. __pyx_t_3 = 0;
  8951. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
  8952. __Pyx_GOTREF(__pyx_t_3);
  8953. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8954. if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
  8955. __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5);
  8956. __pyx_t_1 = 0;
  8957. __pyx_t_10 = NULL;
  8958. } else {
  8959. __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error)
  8960. __Pyx_GOTREF(__pyx_t_5);
  8961. __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L1_error)
  8962. }
  8963. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8964. for (;;) {
  8965. if (likely(!__pyx_t_10)) {
  8966. if (likely(PyList_CheckExact(__pyx_t_5))) {
  8967. {
  8968. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  8969. #if !CYTHON_ASSUME_SAFE_MACROS
  8970. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
  8971. #endif
  8972. if (__pyx_t_1 >= __pyx_temp) break;
  8973. }
  8974. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8975. __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
  8976. #else
  8977. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
  8978. __Pyx_GOTREF(__pyx_t_3);
  8979. #endif
  8980. } else {
  8981. {
  8982. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  8983. #if !CYTHON_ASSUME_SAFE_MACROS
  8984. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
  8985. #endif
  8986. if (__pyx_t_1 >= __pyx_temp) break;
  8987. }
  8988. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8989. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 437, __pyx_L1_error)
  8990. #else
  8991. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
  8992. __Pyx_GOTREF(__pyx_t_3);
  8993. #endif
  8994. }
  8995. } else {
  8996. __pyx_t_3 = __pyx_t_10(__pyx_t_5);
  8997. if (unlikely(!__pyx_t_3)) {
  8998. PyObject* exc_type = PyErr_Occurred();
  8999. if (exc_type) {
  9000. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9001. else __PYX_ERR(0, 437, __pyx_L1_error)
  9002. }
  9003. break;
  9004. }
  9005. __Pyx_GOTREF(__pyx_t_3);
  9006. }
  9007. __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_3);
  9008. __pyx_t_3 = 0;
  9009. /* "fontTools/varLib/iup.py":439
  9010. * for start in range(n - 1, len(costs) - 1):
  9011. * # Assemble solution.
  9012. * solution = set() # <<<<<<<<<<<<<<
  9013. * i = start
  9014. * while i > start - n:
  9015. */
  9016. __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error)
  9017. __Pyx_GOTREF(__pyx_t_3);
  9018. __Pyx_XDECREF_SET(__pyx_v_solution, ((PyObject*)__pyx_t_3));
  9019. __pyx_t_3 = 0;
  9020. /* "fontTools/varLib/iup.py":440
  9021. * # Assemble solution.
  9022. * solution = set()
  9023. * i = start # <<<<<<<<<<<<<<
  9024. * while i > start - n:
  9025. * solution.add(i % n)
  9026. */
  9027. __Pyx_INCREF(__pyx_v_start);
  9028. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_v_start);
  9029. /* "fontTools/varLib/iup.py":441
  9030. * solution = set()
  9031. * i = start
  9032. * while i > start - n: # <<<<<<<<<<<<<<
  9033. * solution.add(i % n)
  9034. * i = chain[i]
  9035. */
  9036. while (1) {
  9037. __pyx_t_3 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error)
  9038. __Pyx_GOTREF(__pyx_t_3);
  9039. __pyx_t_7 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
  9040. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9041. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 441, __pyx_L1_error)
  9042. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9043. if (!__pyx_t_4) break;
  9044. /* "fontTools/varLib/iup.py":442
  9045. * i = start
  9046. * while i > start - n:
  9047. * solution.add(i % n) # <<<<<<<<<<<<<<
  9048. * i = chain[i]
  9049. * if i == start - n:
  9050. */
  9051. __pyx_t_7 = PyNumber_Remainder(__pyx_v_i, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 442, __pyx_L1_error)
  9052. __Pyx_GOTREF(__pyx_t_7);
  9053. __pyx_t_9 = PySet_Add(__pyx_v_solution, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 442, __pyx_L1_error)
  9054. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9055. /* "fontTools/varLib/iup.py":443
  9056. * while i > start - n:
  9057. * solution.add(i % n)
  9058. * i = chain[i] # <<<<<<<<<<<<<<
  9059. * if i == start - n:
  9060. * cost = costs[start] - costs[start - n]
  9061. */
  9062. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_chain, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L1_error)
  9063. __Pyx_GOTREF(__pyx_t_7);
  9064. __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_7);
  9065. __pyx_t_7 = 0;
  9066. }
  9067. /* "fontTools/varLib/iup.py":444
  9068. * solution.add(i % n)
  9069. * i = chain[i]
  9070. * if i == start - n: # <<<<<<<<<<<<<<
  9071. * cost = costs[start] - costs[start - n]
  9072. * if cost <= best_cost:
  9073. */
  9074. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 444, __pyx_L1_error)
  9075. __Pyx_GOTREF(__pyx_t_7);
  9076. __pyx_t_3 = PyObject_RichCompare(__pyx_v_i, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error)
  9077. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9078. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 444, __pyx_L1_error)
  9079. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9080. if (__pyx_t_4) {
  9081. /* "fontTools/varLib/iup.py":445
  9082. * i = chain[i]
  9083. * if i == start - n:
  9084. * cost = costs[start] - costs[start - n] # <<<<<<<<<<<<<<
  9085. * if cost <= best_cost:
  9086. * best_sol, best_cost = solution, cost
  9087. */
  9088. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
  9089. __Pyx_GOTREF(__pyx_t_3);
  9090. __pyx_t_7 = PyNumber_Subtract(__pyx_v_start, __pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
  9091. __Pyx_GOTREF(__pyx_t_7);
  9092. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_costs, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  9093. __Pyx_GOTREF(__pyx_t_2);
  9094. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9095. __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
  9096. __Pyx_GOTREF(__pyx_t_7);
  9097. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9098. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9099. __Pyx_XDECREF_SET(__pyx_v_cost, __pyx_t_7);
  9100. __pyx_t_7 = 0;
  9101. /* "fontTools/varLib/iup.py":446
  9102. * if i == start - n:
  9103. * cost = costs[start] - costs[start - n]
  9104. * if cost <= best_cost: # <<<<<<<<<<<<<<
  9105. * best_sol, best_cost = solution, cost
  9106. *
  9107. */
  9108. __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, 446, __pyx_L1_error)
  9109. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 446, __pyx_L1_error)
  9110. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9111. if (__pyx_t_4) {
  9112. /* "fontTools/varLib/iup.py":447
  9113. * cost = costs[start] - costs[start - n]
  9114. * if cost <= best_cost:
  9115. * best_sol, best_cost = solution, cost # <<<<<<<<<<<<<<
  9116. *
  9117. * # if not forced <= best_sol:
  9118. */
  9119. __pyx_t_7 = __pyx_v_solution;
  9120. __Pyx_INCREF(__pyx_t_7);
  9121. __pyx_t_2 = __pyx_v_cost;
  9122. __Pyx_INCREF(__pyx_t_2);
  9123. __Pyx_DECREF_SET(__pyx_v_best_sol, ((PyObject*)__pyx_t_7));
  9124. __pyx_t_7 = 0;
  9125. __Pyx_DECREF_SET(__pyx_v_best_cost, __pyx_t_2);
  9126. __pyx_t_2 = 0;
  9127. /* "fontTools/varLib/iup.py":446
  9128. * if i == start - n:
  9129. * cost = costs[start] - costs[start - n]
  9130. * if cost <= best_cost: # <<<<<<<<<<<<<<
  9131. * best_sol, best_cost = solution, cost
  9132. *
  9133. */
  9134. }
  9135. /* "fontTools/varLib/iup.py":444
  9136. * solution.add(i % n)
  9137. * i = chain[i]
  9138. * if i == start - n: # <<<<<<<<<<<<<<
  9139. * cost = costs[start] - costs[start - n]
  9140. * if cost <= best_cost:
  9141. */
  9142. }
  9143. /* "fontTools/varLib/iup.py":437
  9144. * best_sol, best_cost = None, n + 1
  9145. *
  9146. * for start in range(n - 1, len(costs) - 1): # <<<<<<<<<<<<<<
  9147. * # Assemble solution.
  9148. * solution = set()
  9149. */
  9150. }
  9151. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9152. /* "fontTools/varLib/iup.py":453
  9153. * # print("deltas", deltas)
  9154. * # print("len", len(deltas))
  9155. * assert forced <= best_sol, (forced, best_sol) # <<<<<<<<<<<<<<
  9156. *
  9157. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  9158. */
  9159. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9160. if (unlikely(__pyx_assertions_enabled())) {
  9161. __pyx_t_5 = PyObject_RichCompare(__pyx_v_forced, __pyx_v_best_sol, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
  9162. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 453, __pyx_L1_error)
  9163. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9164. if (unlikely(!__pyx_t_4)) {
  9165. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
  9166. __Pyx_GOTREF(__pyx_t_5);
  9167. __Pyx_INCREF(__pyx_v_forced);
  9168. __Pyx_GIVEREF(__pyx_v_forced);
  9169. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_forced)) __PYX_ERR(0, 453, __pyx_L1_error);
  9170. __Pyx_INCREF(__pyx_v_best_sol);
  9171. __Pyx_GIVEREF(__pyx_v_best_sol);
  9172. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_best_sol)) __PYX_ERR(0, 453, __pyx_L1_error);
  9173. __pyx_t_2 = PyTuple_Pack(1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error)
  9174. __Pyx_GOTREF(__pyx_t_2);
  9175. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9176. __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_t_2, 0, 0);
  9177. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9178. __PYX_ERR(0, 453, __pyx_L1_error)
  9179. }
  9180. }
  9181. #else
  9182. if ((1)); else __PYX_ERR(0, 453, __pyx_L1_error)
  9183. #endif
  9184. /* "fontTools/varLib/iup.py":455
  9185. * assert forced <= best_sol, (forced, best_sol)
  9186. *
  9187. * deltas = [deltas[i] if i in best_sol else None for i in range(n)] # <<<<<<<<<<<<<<
  9188. *
  9189. * return deltas
  9190. */
  9191. { /* enter inner scope */
  9192. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L29_error)
  9193. __Pyx_GOTREF(__pyx_t_2);
  9194. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L29_error)
  9195. __Pyx_GOTREF(__pyx_t_5);
  9196. if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
  9197. __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7);
  9198. __pyx_t_1 = 0;
  9199. __pyx_t_10 = NULL;
  9200. } else {
  9201. __pyx_t_1 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L29_error)
  9202. __Pyx_GOTREF(__pyx_t_7);
  9203. __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 455, __pyx_L29_error)
  9204. }
  9205. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9206. for (;;) {
  9207. if (likely(!__pyx_t_10)) {
  9208. if (likely(PyList_CheckExact(__pyx_t_7))) {
  9209. {
  9210. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
  9211. #if !CYTHON_ASSUME_SAFE_MACROS
  9212. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 455, __pyx_L29_error)
  9213. #endif
  9214. if (__pyx_t_1 >= __pyx_temp) break;
  9215. }
  9216. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9217. __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 455, __pyx_L29_error)
  9218. #else
  9219. __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L29_error)
  9220. __Pyx_GOTREF(__pyx_t_5);
  9221. #endif
  9222. } else {
  9223. {
  9224. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
  9225. #if !CYTHON_ASSUME_SAFE_MACROS
  9226. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 455, __pyx_L29_error)
  9227. #endif
  9228. if (__pyx_t_1 >= __pyx_temp) break;
  9229. }
  9230. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9231. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 455, __pyx_L29_error)
  9232. #else
  9233. __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L29_error)
  9234. __Pyx_GOTREF(__pyx_t_5);
  9235. #endif
  9236. }
  9237. } else {
  9238. __pyx_t_5 = __pyx_t_10(__pyx_t_7);
  9239. if (unlikely(!__pyx_t_5)) {
  9240. PyObject* exc_type = PyErr_Occurred();
  9241. if (exc_type) {
  9242. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9243. else __PYX_ERR(0, 455, __pyx_L29_error)
  9244. }
  9245. break;
  9246. }
  9247. __Pyx_GOTREF(__pyx_t_5);
  9248. }
  9249. __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_i, __pyx_t_5);
  9250. __pyx_t_5 = 0;
  9251. if (unlikely(__pyx_v_best_sol == Py_None)) {
  9252. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  9253. __PYX_ERR(0, 455, __pyx_L29_error)
  9254. }
  9255. __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, 455, __pyx_L29_error)
  9256. if (__pyx_t_4) {
  9257. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_deltas, __pyx_8genexpr6__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L29_error)
  9258. __Pyx_GOTREF(__pyx_t_3);
  9259. __pyx_t_5 = __pyx_t_3;
  9260. __pyx_t_3 = 0;
  9261. } else {
  9262. __Pyx_INCREF(Py_None);
  9263. __pyx_t_5 = Py_None;
  9264. }
  9265. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 455, __pyx_L29_error)
  9266. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9267. }
  9268. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9269. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  9270. goto __pyx_L33_exit_scope;
  9271. __pyx_L29_error:;
  9272. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
  9273. goto __pyx_L1_error;
  9274. __pyx_L33_exit_scope:;
  9275. } /* exit inner scope */
  9276. __Pyx_DECREF_SET(__pyx_v_deltas, __pyx_t_2);
  9277. __pyx_t_2 = 0;
  9278. }
  9279. __pyx_L6:;
  9280. /* "fontTools/varLib/iup.py":457
  9281. * deltas = [deltas[i] if i in best_sol else None for i in range(n)]
  9282. *
  9283. * return deltas # <<<<<<<<<<<<<<
  9284. *
  9285. *
  9286. */
  9287. __Pyx_XDECREF(__pyx_r);
  9288. __Pyx_INCREF(__pyx_v_deltas);
  9289. __pyx_r = __pyx_v_deltas;
  9290. goto __pyx_L0;
  9291. /* "fontTools/varLib/iup.py":359
  9292. *
  9293. *
  9294. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  9295. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  9296. * ) -> _DeltaOrNoneSegment:
  9297. */
  9298. /* function exit code */
  9299. __pyx_L1_error:;
  9300. __Pyx_XDECREF(__pyx_t_2);
  9301. __Pyx_XDECREF(__pyx_t_3);
  9302. __Pyx_XDECREF(__pyx_t_5);
  9303. __Pyx_XDECREF(__pyx_t_7);
  9304. __Pyx_XDECREF(__pyx_t_11);
  9305. __Pyx_AddTraceback("fontTools.varLib.iup.iup_contour_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9306. __pyx_r = NULL;
  9307. __pyx_L0:;
  9308. __Pyx_XDECREF(__pyx_v_n);
  9309. __Pyx_XDECREF(__pyx_v_forced);
  9310. __Pyx_XDECREF(__pyx_v_k);
  9311. __Pyx_XDECREF(__pyx_v_chain);
  9312. __Pyx_XDECREF(__pyx_v_costs);
  9313. __Pyx_XDECREF(__pyx_v_solution);
  9314. __Pyx_XDECREF(__pyx_v_i);
  9315. __Pyx_XDECREF(__pyx_v_best_sol);
  9316. __Pyx_XDECREF(__pyx_v_best_cost);
  9317. __Pyx_XDECREF(__pyx_v_start);
  9318. __Pyx_XDECREF(__pyx_v_cost);
  9319. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_2generator1);
  9320. __Pyx_XDECREF(__pyx_gb_9fontTools_6varLib_3iup_20iup_contour_optimize_5generator2);
  9321. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_i);
  9322. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i);
  9323. __Pyx_XDECREF(__pyx_v_deltas);
  9324. __Pyx_XDECREF(__pyx_v_coords);
  9325. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  9326. __Pyx_XGIVEREF(__pyx_r);
  9327. __Pyx_RefNannyFinishContext();
  9328. return __pyx_r;
  9329. }
  9330. /* "fontTools/varLib/iup.py":460
  9331. *
  9332. *
  9333. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  9334. * deltas: _DeltaSegment,
  9335. * coords: _PointSegment,
  9336. */
  9337. /* Python wrapper */
  9338. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize(PyObject *__pyx_self,
  9339. #if CYTHON_METH_FASTCALL
  9340. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9341. #else
  9342. PyObject *__pyx_args, PyObject *__pyx_kwds
  9343. #endif
  9344. ); /*proto*/
  9345. PyDoc_STRVAR(__pyx_doc_9fontTools_6varLib_3iup_14iup_delta_optimize, "iup_delta_optimize(deltas: _DeltaSegment, coords: _PointSegment, ends: _Endpoints, tolerance: Real = 0.0) -> _DeltaOrNoneSegment\nFor the outline given in `coords`, with contour endpoints given\n in sorted increasing order in `ends`, optimize a set of delta\n values `deltas` within error `tolerance`.\n\n Returns delta vector that has most number of None items instead of\n the input delta.\n ");
  9346. static PyMethodDef __pyx_mdef_9fontTools_6varLib_3iup_15iup_delta_optimize = {"iup_delta_optimize", (PyCFunction)(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};
  9347. static PyObject *__pyx_pw_9fontTools_6varLib_3iup_15iup_delta_optimize(PyObject *__pyx_self,
  9348. #if CYTHON_METH_FASTCALL
  9349. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9350. #else
  9351. PyObject *__pyx_args, PyObject *__pyx_kwds
  9352. #endif
  9353. ) {
  9354. PyObject *__pyx_v_deltas = 0;
  9355. PyObject *__pyx_v_coords = 0;
  9356. PyObject *__pyx_v_ends = 0;
  9357. PyObject *__pyx_v_tolerance = 0;
  9358. #if !CYTHON_METH_FASTCALL
  9359. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9360. #endif
  9361. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9362. PyObject* values[4] = {0,0,0,0};
  9363. int __pyx_lineno = 0;
  9364. const char *__pyx_filename = NULL;
  9365. int __pyx_clineno = 0;
  9366. PyObject *__pyx_r = 0;
  9367. __Pyx_RefNannyDeclarations
  9368. __Pyx_RefNannySetupContext("iup_delta_optimize (wrapper)", 0);
  9369. #if !CYTHON_METH_FASTCALL
  9370. #if CYTHON_ASSUME_SAFE_MACROS
  9371. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9372. #else
  9373. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9374. #endif
  9375. #endif
  9376. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9377. {
  9378. PyObject **__pyx_pyargnames[] = {&__pyx_n_s_deltas,&__pyx_n_s_coords,&__pyx_n_s_ends,&__pyx_n_s_tolerance,0};
  9379. values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_0_0)));
  9380. if (__pyx_kwds) {
  9381. Py_ssize_t kw_args;
  9382. switch (__pyx_nargs) {
  9383. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  9384. CYTHON_FALLTHROUGH;
  9385. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  9386. CYTHON_FALLTHROUGH;
  9387. case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  9388. CYTHON_FALLTHROUGH;
  9389. case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  9390. CYTHON_FALLTHROUGH;
  9391. case 0: break;
  9392. default: goto __pyx_L5_argtuple_error;
  9393. }
  9394. kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
  9395. switch (__pyx_nargs) {
  9396. case 0:
  9397. if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltas)) != 0)) {
  9398. (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
  9399. kw_args--;
  9400. }
  9401. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
  9402. else goto __pyx_L5_argtuple_error;
  9403. CYTHON_FALLTHROUGH;
  9404. case 1:
  9405. if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coords)) != 0)) {
  9406. (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
  9407. kw_args--;
  9408. }
  9409. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
  9410. else {
  9411. __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, 1); __PYX_ERR(0, 460, __pyx_L3_error)
  9412. }
  9413. CYTHON_FALLTHROUGH;
  9414. case 2:
  9415. if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ends)) != 0)) {
  9416. (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
  9417. kw_args--;
  9418. }
  9419. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
  9420. else {
  9421. __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, 2); __PYX_ERR(0, 460, __pyx_L3_error)
  9422. }
  9423. CYTHON_FALLTHROUGH;
  9424. case 3:
  9425. if (kw_args > 0) {
  9426. PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tolerance);
  9427. if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
  9428. else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
  9429. }
  9430. }
  9431. if (unlikely(kw_args > 0)) {
  9432. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9433. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iup_delta_optimize") < 0)) __PYX_ERR(0, 460, __pyx_L3_error)
  9434. }
  9435. } else {
  9436. switch (__pyx_nargs) {
  9437. case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
  9438. CYTHON_FALLTHROUGH;
  9439. case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
  9440. values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
  9441. values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
  9442. break;
  9443. default: goto __pyx_L5_argtuple_error;
  9444. }
  9445. }
  9446. __pyx_v_deltas = values[0];
  9447. __pyx_v_coords = values[1];
  9448. __pyx_v_ends = values[2];
  9449. __pyx_v_tolerance = values[3];
  9450. }
  9451. goto __pyx_L6_skip;
  9452. __pyx_L5_argtuple_error:;
  9453. __Pyx_RaiseArgtupleInvalid("iup_delta_optimize", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 460, __pyx_L3_error)
  9454. __pyx_L6_skip:;
  9455. goto __pyx_L4_argument_unpacking_done;
  9456. __pyx_L3_error:;
  9457. {
  9458. Py_ssize_t __pyx_temp;
  9459. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9460. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  9461. }
  9462. }
  9463. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9464. __Pyx_RefNannyFinishContext();
  9465. return NULL;
  9466. __pyx_L4_argument_unpacking_done:;
  9467. __pyx_r = __pyx_pf_9fontTools_6varLib_3iup_14iup_delta_optimize(__pyx_self, __pyx_v_deltas, __pyx_v_coords, __pyx_v_ends, __pyx_v_tolerance);
  9468. /* function exit code */
  9469. {
  9470. Py_ssize_t __pyx_temp;
  9471. for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9472. __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
  9473. }
  9474. }
  9475. __Pyx_RefNannyFinishContext();
  9476. return __pyx_r;
  9477. }
  9478. 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) {
  9479. PyObject *__pyx_v_n = NULL;
  9480. PyObject *__pyx_v_out = NULL;
  9481. PyObject *__pyx_v_start = NULL;
  9482. PyObject *__pyx_v_end = NULL;
  9483. PyObject *__pyx_v_contour = NULL;
  9484. PyObject *__pyx_r = NULL;
  9485. __Pyx_RefNannyDeclarations
  9486. int __pyx_t_1;
  9487. PyObject *__pyx_t_2 = NULL;
  9488. PyObject *__pyx_t_3 = NULL;
  9489. int __pyx_t_4;
  9490. int __pyx_t_5;
  9491. Py_ssize_t __pyx_t_6;
  9492. PyObject *__pyx_t_7 = NULL;
  9493. PyObject *__pyx_t_8 = NULL;
  9494. PyObject *__pyx_t_9 = NULL;
  9495. PyObject *(*__pyx_t_10)(PyObject *);
  9496. PyObject *__pyx_t_11 = NULL;
  9497. int __pyx_t_12;
  9498. Py_ssize_t __pyx_t_13;
  9499. int __pyx_lineno = 0;
  9500. const char *__pyx_filename = NULL;
  9501. int __pyx_clineno = 0;
  9502. __Pyx_RefNannySetupContext("iup_delta_optimize", 0);
  9503. __Pyx_INCREF(__pyx_v_ends);
  9504. /* "fontTools/varLib/iup.py":473
  9505. * the input delta.
  9506. * """
  9507. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4 # <<<<<<<<<<<<<<
  9508. * n = len(coords)
  9509. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9510. */
  9511. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9512. if (unlikely(__pyx_assertions_enabled())) {
  9513. __pyx_t_3 = PySequence_List(__pyx_v_ends); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
  9514. __Pyx_GOTREF(__pyx_t_3);
  9515. __pyx_t_2 = ((PyObject*)__pyx_t_3);
  9516. __pyx_t_3 = 0;
  9517. __pyx_t_4 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 473, __pyx_L1_error)
  9518. __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, 473, __pyx_L1_error)
  9519. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9520. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 473, __pyx_L1_error)
  9521. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9522. if (__pyx_t_5) {
  9523. } else {
  9524. __pyx_t_1 = __pyx_t_5;
  9525. goto __pyx_L3_bool_binop_done;
  9526. }
  9527. __pyx_t_6 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 473, __pyx_L1_error)
  9528. __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
  9529. __Pyx_GOTREF(__pyx_t_3);
  9530. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ends); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 473, __pyx_L1_error)
  9531. if (__pyx_t_5) {
  9532. __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ends, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 473, __pyx_L1_error)
  9533. __Pyx_GOTREF(__pyx_t_7);
  9534. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error)
  9535. __Pyx_GOTREF(__pyx_t_8);
  9536. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9537. __pyx_t_2 = __pyx_t_8;
  9538. __pyx_t_8 = 0;
  9539. } else {
  9540. __Pyx_INCREF(__pyx_int_0);
  9541. __pyx_t_2 = __pyx_int_0;
  9542. }
  9543. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error)
  9544. __Pyx_GOTREF(__pyx_t_8);
  9545. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9546. __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error)
  9547. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9548. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9549. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 473, __pyx_L1_error)
  9550. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9551. __pyx_t_1 = __pyx_t_5;
  9552. __pyx_L3_bool_binop_done:;
  9553. if (unlikely(!__pyx_t_1)) {
  9554. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  9555. __PYX_ERR(0, 473, __pyx_L1_error)
  9556. }
  9557. }
  9558. #else
  9559. if ((1)); else __PYX_ERR(0, 473, __pyx_L1_error)
  9560. #endif
  9561. /* "fontTools/varLib/iup.py":474
  9562. * """
  9563. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9564. * n = len(coords) # <<<<<<<<<<<<<<
  9565. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9566. * out = []
  9567. */
  9568. __pyx_t_6 = PyObject_Length(__pyx_v_coords); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 474, __pyx_L1_error)
  9569. __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
  9570. __Pyx_GOTREF(__pyx_t_2);
  9571. __pyx_v_n = __pyx_t_2;
  9572. __pyx_t_2 = 0;
  9573. /* "fontTools/varLib/iup.py":475
  9574. * assert sorted(ends) == ends and len(coords) == (ends[-1] + 1 if ends else 0) + 4
  9575. * n = len(coords)
  9576. * ends = ends + [n - 4, n - 3, n - 2, n - 1] # <<<<<<<<<<<<<<
  9577. * out = []
  9578. * start = 0
  9579. */
  9580. __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
  9581. __Pyx_GOTREF(__pyx_t_2);
  9582. __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_3, 3, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L1_error)
  9583. __Pyx_GOTREF(__pyx_t_8);
  9584. __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
  9585. __Pyx_GOTREF(__pyx_t_3);
  9586. __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 475, __pyx_L1_error)
  9587. __Pyx_GOTREF(__pyx_t_7);
  9588. __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 475, __pyx_L1_error)
  9589. __Pyx_GOTREF(__pyx_t_9);
  9590. __Pyx_GIVEREF(__pyx_t_2);
  9591. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error);
  9592. __Pyx_GIVEREF(__pyx_t_8);
  9593. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 475, __pyx_L1_error);
  9594. __Pyx_GIVEREF(__pyx_t_3);
  9595. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error);
  9596. __Pyx_GIVEREF(__pyx_t_7);
  9597. if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_t_7)) __PYX_ERR(0, 475, __pyx_L1_error);
  9598. __pyx_t_2 = 0;
  9599. __pyx_t_8 = 0;
  9600. __pyx_t_3 = 0;
  9601. __pyx_t_7 = 0;
  9602. __pyx_t_7 = PyNumber_Add(__pyx_v_ends, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 475, __pyx_L1_error)
  9603. __Pyx_GOTREF(__pyx_t_7);
  9604. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9605. __Pyx_DECREF_SET(__pyx_v_ends, __pyx_t_7);
  9606. __pyx_t_7 = 0;
  9607. /* "fontTools/varLib/iup.py":476
  9608. * n = len(coords)
  9609. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9610. * out = [] # <<<<<<<<<<<<<<
  9611. * start = 0
  9612. * for end in ends:
  9613. */
  9614. __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 476, __pyx_L1_error)
  9615. __Pyx_GOTREF(__pyx_t_7);
  9616. __pyx_v_out = ((PyObject*)__pyx_t_7);
  9617. __pyx_t_7 = 0;
  9618. /* "fontTools/varLib/iup.py":477
  9619. * ends = ends + [n - 4, n - 3, n - 2, n - 1]
  9620. * out = []
  9621. * start = 0 # <<<<<<<<<<<<<<
  9622. * for end in ends:
  9623. * contour = iup_contour_optimize(
  9624. */
  9625. __Pyx_INCREF(__pyx_int_0);
  9626. __pyx_v_start = __pyx_int_0;
  9627. /* "fontTools/varLib/iup.py":478
  9628. * out = []
  9629. * start = 0
  9630. * for end in ends: # <<<<<<<<<<<<<<
  9631. * contour = iup_contour_optimize(
  9632. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9633. */
  9634. if (likely(PyList_CheckExact(__pyx_v_ends)) || PyTuple_CheckExact(__pyx_v_ends)) {
  9635. __pyx_t_7 = __pyx_v_ends; __Pyx_INCREF(__pyx_t_7);
  9636. __pyx_t_6 = 0;
  9637. __pyx_t_10 = NULL;
  9638. } else {
  9639. __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_ends); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 478, __pyx_L1_error)
  9640. __Pyx_GOTREF(__pyx_t_7);
  9641. __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 478, __pyx_L1_error)
  9642. }
  9643. for (;;) {
  9644. if (likely(!__pyx_t_10)) {
  9645. if (likely(PyList_CheckExact(__pyx_t_7))) {
  9646. {
  9647. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
  9648. #if !CYTHON_ASSUME_SAFE_MACROS
  9649. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 478, __pyx_L1_error)
  9650. #endif
  9651. if (__pyx_t_6 >= __pyx_temp) break;
  9652. }
  9653. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9654. __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 478, __pyx_L1_error)
  9655. #else
  9656. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error)
  9657. __Pyx_GOTREF(__pyx_t_9);
  9658. #endif
  9659. } else {
  9660. {
  9661. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
  9662. #if !CYTHON_ASSUME_SAFE_MACROS
  9663. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 478, __pyx_L1_error)
  9664. #endif
  9665. if (__pyx_t_6 >= __pyx_temp) break;
  9666. }
  9667. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9668. __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 478, __pyx_L1_error)
  9669. #else
  9670. __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 478, __pyx_L1_error)
  9671. __Pyx_GOTREF(__pyx_t_9);
  9672. #endif
  9673. }
  9674. } else {
  9675. __pyx_t_9 = __pyx_t_10(__pyx_t_7);
  9676. if (unlikely(!__pyx_t_9)) {
  9677. PyObject* exc_type = PyErr_Occurred();
  9678. if (exc_type) {
  9679. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9680. else __PYX_ERR(0, 478, __pyx_L1_error)
  9681. }
  9682. break;
  9683. }
  9684. __Pyx_GOTREF(__pyx_t_9);
  9685. }
  9686. __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_9);
  9687. __pyx_t_9 = 0;
  9688. /* "fontTools/varLib/iup.py":479
  9689. * start = 0
  9690. * for end in ends:
  9691. * contour = iup_contour_optimize( # <<<<<<<<<<<<<<
  9692. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9693. * )
  9694. */
  9695. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_iup_contour_optimize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
  9696. __Pyx_GOTREF(__pyx_t_3);
  9697. /* "fontTools/varLib/iup.py":480
  9698. * for end in ends:
  9699. * contour = iup_contour_optimize(
  9700. * deltas[start : end + 1], coords[start : end + 1], tolerance # <<<<<<<<<<<<<<
  9701. * )
  9702. * assert len(contour) == end - start + 1
  9703. */
  9704. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_end, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error)
  9705. __Pyx_GOTREF(__pyx_t_8);
  9706. __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_deltas, 0, 0, &__pyx_v_start, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
  9707. __Pyx_GOTREF(__pyx_t_2);
  9708. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9709. __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_end, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error)
  9710. __Pyx_GOTREF(__pyx_t_8);
  9711. __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_coords, 0, 0, &__pyx_v_start, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 480, __pyx_L1_error)
  9712. __Pyx_GOTREF(__pyx_t_11);
  9713. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9714. __pyx_t_8 = NULL;
  9715. __pyx_t_12 = 0;
  9716. #if CYTHON_UNPACK_METHODS
  9717. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  9718. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
  9719. if (likely(__pyx_t_8)) {
  9720. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9721. __Pyx_INCREF(__pyx_t_8);
  9722. __Pyx_INCREF(function);
  9723. __Pyx_DECREF_SET(__pyx_t_3, function);
  9724. __pyx_t_12 = 1;
  9725. }
  9726. }
  9727. #endif
  9728. {
  9729. PyObject *__pyx_callargs[4] = {__pyx_t_8, __pyx_t_2, __pyx_t_11, __pyx_v_tolerance};
  9730. __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_12, 3+__pyx_t_12);
  9731. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  9732. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9733. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9734. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 479, __pyx_L1_error)
  9735. __Pyx_GOTREF(__pyx_t_9);
  9736. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9737. }
  9738. __Pyx_XDECREF_SET(__pyx_v_contour, __pyx_t_9);
  9739. __pyx_t_9 = 0;
  9740. /* "fontTools/varLib/iup.py":482
  9741. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9742. * )
  9743. * assert len(contour) == end - start + 1 # <<<<<<<<<<<<<<
  9744. * out.extend(contour)
  9745. * start = end + 1
  9746. */
  9747. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9748. if (unlikely(__pyx_assertions_enabled())) {
  9749. __pyx_t_13 = PyObject_Length(__pyx_v_contour); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 482, __pyx_L1_error)
  9750. __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L1_error)
  9751. __Pyx_GOTREF(__pyx_t_9);
  9752. __pyx_t_3 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
  9753. __Pyx_GOTREF(__pyx_t_3);
  9754. __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 482, __pyx_L1_error)
  9755. __Pyx_GOTREF(__pyx_t_11);
  9756. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9757. __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
  9758. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9759. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9760. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 482, __pyx_L1_error)
  9761. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9762. if (unlikely(!__pyx_t_1)) {
  9763. __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
  9764. __PYX_ERR(0, 482, __pyx_L1_error)
  9765. }
  9766. }
  9767. #else
  9768. if ((1)); else __PYX_ERR(0, 482, __pyx_L1_error)
  9769. #endif
  9770. /* "fontTools/varLib/iup.py":483
  9771. * )
  9772. * assert len(contour) == end - start + 1
  9773. * out.extend(contour) # <<<<<<<<<<<<<<
  9774. * start = end + 1
  9775. *
  9776. */
  9777. __pyx_t_4 = __Pyx_PyList_Extend(__pyx_v_out, __pyx_v_contour); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 483, __pyx_L1_error)
  9778. /* "fontTools/varLib/iup.py":484
  9779. * assert len(contour) == end - start + 1
  9780. * out.extend(contour)
  9781. * start = end + 1 # <<<<<<<<<<<<<<
  9782. *
  9783. * return out
  9784. */
  9785. __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_end, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 484, __pyx_L1_error)
  9786. __Pyx_GOTREF(__pyx_t_3);
  9787. __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_3);
  9788. __pyx_t_3 = 0;
  9789. /* "fontTools/varLib/iup.py":478
  9790. * out = []
  9791. * start = 0
  9792. * for end in ends: # <<<<<<<<<<<<<<
  9793. * contour = iup_contour_optimize(
  9794. * deltas[start : end + 1], coords[start : end + 1], tolerance
  9795. */
  9796. }
  9797. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9798. /* "fontTools/varLib/iup.py":486
  9799. * start = end + 1
  9800. *
  9801. * return out # <<<<<<<<<<<<<<
  9802. */
  9803. __Pyx_XDECREF(__pyx_r);
  9804. __Pyx_INCREF(__pyx_v_out);
  9805. __pyx_r = __pyx_v_out;
  9806. goto __pyx_L0;
  9807. /* "fontTools/varLib/iup.py":460
  9808. *
  9809. *
  9810. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  9811. * deltas: _DeltaSegment,
  9812. * coords: _PointSegment,
  9813. */
  9814. /* function exit code */
  9815. __pyx_L1_error:;
  9816. __Pyx_XDECREF(__pyx_t_2);
  9817. __Pyx_XDECREF(__pyx_t_3);
  9818. __Pyx_XDECREF(__pyx_t_7);
  9819. __Pyx_XDECREF(__pyx_t_8);
  9820. __Pyx_XDECREF(__pyx_t_9);
  9821. __Pyx_XDECREF(__pyx_t_11);
  9822. __Pyx_AddTraceback("fontTools.varLib.iup.iup_delta_optimize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9823. __pyx_r = NULL;
  9824. __pyx_L0:;
  9825. __Pyx_XDECREF(__pyx_v_n);
  9826. __Pyx_XDECREF(__pyx_v_out);
  9827. __Pyx_XDECREF(__pyx_v_start);
  9828. __Pyx_XDECREF(__pyx_v_end);
  9829. __Pyx_XDECREF(__pyx_v_contour);
  9830. __Pyx_XDECREF(__pyx_v_ends);
  9831. __Pyx_XGIVEREF(__pyx_r);
  9832. __Pyx_RefNannyFinishContext();
  9833. return __pyx_r;
  9834. }
  9835. static 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];
  9836. static int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = 0;
  9837. 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) {
  9838. PyObject *o;
  9839. #if CYTHON_COMPILING_IN_LIMITED_API
  9840. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  9841. o = alloc_func(t, 0);
  9842. #else
  9843. #if CYTHON_COMPILING_IN_CPYTHON
  9844. if (likely((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between)))) {
  9845. o = (PyObject*)__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between[--__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between];
  9846. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between));
  9847. (void) PyObject_INIT(o, t);
  9848. PyObject_GC_Track(o);
  9849. } else
  9850. #endif
  9851. {
  9852. o = (*t->tp_alloc)(t, 0);
  9853. if (unlikely(!o)) return 0;
  9854. }
  9855. #endif
  9856. return o;
  9857. }
  9858. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9859. 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;
  9860. #if CYTHON_USE_TP_FINALIZE
  9861. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  9862. 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) {
  9863. if (PyObject_CallFinalizerFromDealloc(o)) return;
  9864. }
  9865. }
  9866. #endif
  9867. PyObject_GC_UnTrack(o);
  9868. Py_CLEAR(p->__pyx_v_tolerance);
  9869. #if CYTHON_COMPILING_IN_CPYTHON
  9870. if (((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between)))) {
  9871. __pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between[__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);
  9872. } else
  9873. #endif
  9874. {
  9875. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  9876. (*Py_TYPE(o)->tp_free)(o);
  9877. #else
  9878. {
  9879. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  9880. if (tp_free) tp_free(o);
  9881. }
  9882. #endif
  9883. }
  9884. }
  9885. 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) {
  9886. int e;
  9887. 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;
  9888. if (p->__pyx_v_tolerance) {
  9889. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  9890. }
  9891. return 0;
  9892. }
  9893. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between(PyObject *o) {
  9894. PyObject* tmp;
  9895. 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;
  9896. tmp = ((PyObject*)p->__pyx_v_tolerance);
  9897. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  9898. Py_XDECREF(tmp);
  9899. return 0;
  9900. }
  9901. #if CYTHON_USE_TYPE_SPECS
  9902. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots[] = {
  9903. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9904. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9905. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9906. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between},
  9907. {0, 0},
  9908. };
  9909. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_spec = {
  9910. "fontTools.varLib.iup.__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between",
  9911. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between),
  9912. 0,
  9913. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  9914. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between_slots,
  9915. };
  9916. #else
  9917. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between = {
  9918. PyVarObject_HEAD_INIT(0, 0)
  9919. "fontTools.varLib.iup.""__pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between", /*tp_name*/
  9920. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between), /*tp_basicsize*/
  9921. 0, /*tp_itemsize*/
  9922. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_dealloc*/
  9923. #if PY_VERSION_HEX < 0x030800b4
  9924. 0, /*tp_print*/
  9925. #endif
  9926. #if PY_VERSION_HEX >= 0x030800b4
  9927. 0, /*tp_vectorcall_offset*/
  9928. #endif
  9929. 0, /*tp_getattr*/
  9930. 0, /*tp_setattr*/
  9931. #if PY_MAJOR_VERSION < 3
  9932. 0, /*tp_compare*/
  9933. #endif
  9934. #if PY_MAJOR_VERSION >= 3
  9935. 0, /*tp_as_async*/
  9936. #endif
  9937. 0, /*tp_repr*/
  9938. 0, /*tp_as_number*/
  9939. 0, /*tp_as_sequence*/
  9940. 0, /*tp_as_mapping*/
  9941. 0, /*tp_hash*/
  9942. 0, /*tp_call*/
  9943. 0, /*tp_str*/
  9944. 0, /*tp_getattro*/
  9945. 0, /*tp_setattro*/
  9946. 0, /*tp_as_buffer*/
  9947. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  9948. 0, /*tp_doc*/
  9949. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_traverse*/
  9950. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_clear*/
  9951. 0, /*tp_richcompare*/
  9952. 0, /*tp_weaklistoffset*/
  9953. 0, /*tp_iter*/
  9954. 0, /*tp_iternext*/
  9955. 0, /*tp_methods*/
  9956. 0, /*tp_members*/
  9957. 0, /*tp_getset*/
  9958. 0, /*tp_base*/
  9959. 0, /*tp_dict*/
  9960. 0, /*tp_descr_get*/
  9961. 0, /*tp_descr_set*/
  9962. #if !CYTHON_USE_TYPE_SPECS
  9963. 0, /*tp_dictoffset*/
  9964. #endif
  9965. 0, /*tp_init*/
  9966. 0, /*tp_alloc*/
  9967. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between, /*tp_new*/
  9968. 0, /*tp_free*/
  9969. 0, /*tp_is_gc*/
  9970. 0, /*tp_bases*/
  9971. 0, /*tp_mro*/
  9972. 0, /*tp_cache*/
  9973. 0, /*tp_subclasses*/
  9974. 0, /*tp_weaklist*/
  9975. 0, /*tp_del*/
  9976. 0, /*tp_version_tag*/
  9977. #if PY_VERSION_HEX >= 0x030400a1
  9978. #if CYTHON_USE_TP_FINALIZE
  9979. 0, /*tp_finalize*/
  9980. #else
  9981. NULL, /*tp_finalize*/
  9982. #endif
  9983. #endif
  9984. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  9985. 0, /*tp_vectorcall*/
  9986. #endif
  9987. #if __PYX_NEED_TP_PRINT_SLOT == 1
  9988. 0, /*tp_print*/
  9989. #endif
  9990. #if PY_VERSION_HEX >= 0x030C0000
  9991. 0, /*tp_watched*/
  9992. #endif
  9993. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  9994. 0, /*tp_pypy_flags*/
  9995. #endif
  9996. };
  9997. #endif
  9998. static struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[8];
  9999. static int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = 0;
  10000. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  10001. PyObject *o;
  10002. #if CYTHON_COMPILING_IN_LIMITED_API
  10003. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  10004. o = alloc_func(t, 0);
  10005. #else
  10006. #if CYTHON_COMPILING_IN_CPYTHON
  10007. if (likely((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr)))) {
  10008. o = (PyObject*)__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[--__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr];
  10009. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr));
  10010. (void) PyObject_INIT(o, t);
  10011. PyObject_GC_Track(o);
  10012. } else
  10013. #endif
  10014. {
  10015. o = (*t->tp_alloc)(t, 0);
  10016. if (unlikely(!o)) return 0;
  10017. }
  10018. #endif
  10019. return o;
  10020. }
  10021. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o) {
  10022. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  10023. #if CYTHON_USE_TP_FINALIZE
  10024. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10025. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) {
  10026. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10027. }
  10028. }
  10029. #endif
  10030. PyObject_GC_UnTrack(o);
  10031. Py_CLEAR(p->__pyx_outer_scope);
  10032. Py_CLEAR(p->__pyx_genexpr_arg_0);
  10033. #if CYTHON_COMPILING_IN_CPYTHON
  10034. if (((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr)))) {
  10035. __pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr[__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o);
  10036. } else
  10037. #endif
  10038. {
  10039. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  10040. (*Py_TYPE(o)->tp_free)(o);
  10041. #else
  10042. {
  10043. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  10044. if (tp_free) tp_free(o);
  10045. }
  10046. #endif
  10047. }
  10048. }
  10049. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  10050. int e;
  10051. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr *)o;
  10052. if (p->__pyx_outer_scope) {
  10053. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  10054. }
  10055. if (p->__pyx_genexpr_arg_0) {
  10056. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  10057. }
  10058. return 0;
  10059. }
  10060. #if CYTHON_USE_TYPE_SPECS
  10061. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots[] = {
  10062. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  10063. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  10064. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr},
  10065. {0, 0},
  10066. };
  10067. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec = {
  10068. "fontTools.varLib.iup.__pyx_scope_struct_1_genexpr",
  10069. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr),
  10070. 0,
  10071. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  10072. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_slots,
  10073. };
  10074. #else
  10075. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = {
  10076. PyVarObject_HEAD_INIT(0, 0)
  10077. "fontTools.varLib.iup.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  10078. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  10079. 0, /*tp_itemsize*/
  10080. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  10081. #if PY_VERSION_HEX < 0x030800b4
  10082. 0, /*tp_print*/
  10083. #endif
  10084. #if PY_VERSION_HEX >= 0x030800b4
  10085. 0, /*tp_vectorcall_offset*/
  10086. #endif
  10087. 0, /*tp_getattr*/
  10088. 0, /*tp_setattr*/
  10089. #if PY_MAJOR_VERSION < 3
  10090. 0, /*tp_compare*/
  10091. #endif
  10092. #if PY_MAJOR_VERSION >= 3
  10093. 0, /*tp_as_async*/
  10094. #endif
  10095. 0, /*tp_repr*/
  10096. 0, /*tp_as_number*/
  10097. 0, /*tp_as_sequence*/
  10098. 0, /*tp_as_mapping*/
  10099. 0, /*tp_hash*/
  10100. 0, /*tp_call*/
  10101. 0, /*tp_str*/
  10102. 0, /*tp_getattro*/
  10103. 0, /*tp_setattro*/
  10104. 0, /*tp_as_buffer*/
  10105. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  10106. 0, /*tp_doc*/
  10107. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  10108. 0, /*tp_clear*/
  10109. 0, /*tp_richcompare*/
  10110. 0, /*tp_weaklistoffset*/
  10111. 0, /*tp_iter*/
  10112. 0, /*tp_iternext*/
  10113. 0, /*tp_methods*/
  10114. 0, /*tp_members*/
  10115. 0, /*tp_getset*/
  10116. 0, /*tp_base*/
  10117. 0, /*tp_dict*/
  10118. 0, /*tp_descr_get*/
  10119. 0, /*tp_descr_set*/
  10120. #if !CYTHON_USE_TYPE_SPECS
  10121. 0, /*tp_dictoffset*/
  10122. #endif
  10123. 0, /*tp_init*/
  10124. 0, /*tp_alloc*/
  10125. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr, /*tp_new*/
  10126. 0, /*tp_free*/
  10127. 0, /*tp_is_gc*/
  10128. 0, /*tp_bases*/
  10129. 0, /*tp_mro*/
  10130. 0, /*tp_cache*/
  10131. 0, /*tp_subclasses*/
  10132. 0, /*tp_weaklist*/
  10133. 0, /*tp_del*/
  10134. 0, /*tp_version_tag*/
  10135. #if PY_VERSION_HEX >= 0x030400a1
  10136. #if CYTHON_USE_TP_FINALIZE
  10137. 0, /*tp_finalize*/
  10138. #else
  10139. NULL, /*tp_finalize*/
  10140. #endif
  10141. #endif
  10142. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  10143. 0, /*tp_vectorcall*/
  10144. #endif
  10145. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10146. 0, /*tp_print*/
  10147. #endif
  10148. #if PY_VERSION_HEX >= 0x030C0000
  10149. 0, /*tp_watched*/
  10150. #endif
  10151. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10152. 0, /*tp_pypy_flags*/
  10153. #endif
  10154. };
  10155. #endif
  10156. static 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];
  10157. static int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = 0;
  10158. 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) {
  10159. PyObject *o;
  10160. #if CYTHON_COMPILING_IN_LIMITED_API
  10161. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  10162. o = alloc_func(t, 0);
  10163. #else
  10164. #if CYTHON_COMPILING_IN_CPYTHON
  10165. if (likely((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize)))) {
  10166. o = (PyObject*)__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize[--__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize];
  10167. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize));
  10168. (void) PyObject_INIT(o, t);
  10169. PyObject_GC_Track(o);
  10170. } else
  10171. #endif
  10172. {
  10173. o = (*t->tp_alloc)(t, 0);
  10174. if (unlikely(!o)) return 0;
  10175. }
  10176. #endif
  10177. return o;
  10178. }
  10179. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  10180. 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;
  10181. #if CYTHON_USE_TP_FINALIZE
  10182. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10183. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) {
  10184. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10185. }
  10186. }
  10187. #endif
  10188. PyObject_GC_UnTrack(o);
  10189. Py_CLEAR(p->__pyx_v_d0);
  10190. Py_CLEAR(p->__pyx_v_tolerance);
  10191. #if CYTHON_COMPILING_IN_CPYTHON
  10192. if (((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize)))) {
  10193. __pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize[__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);
  10194. } else
  10195. #endif
  10196. {
  10197. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  10198. (*Py_TYPE(o)->tp_free)(o);
  10199. #else
  10200. {
  10201. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  10202. if (tp_free) tp_free(o);
  10203. }
  10204. #endif
  10205. }
  10206. }
  10207. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o, visitproc v, void *a) {
  10208. int e;
  10209. 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;
  10210. if (p->__pyx_v_d0) {
  10211. e = (*v)(p->__pyx_v_d0, a); if (e) return e;
  10212. }
  10213. if (p->__pyx_v_tolerance) {
  10214. e = (*v)(p->__pyx_v_tolerance, a); if (e) return e;
  10215. }
  10216. return 0;
  10217. }
  10218. static int __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize(PyObject *o) {
  10219. PyObject* tmp;
  10220. 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;
  10221. tmp = ((PyObject*)p->__pyx_v_d0);
  10222. p->__pyx_v_d0 = Py_None; Py_INCREF(Py_None);
  10223. Py_XDECREF(tmp);
  10224. tmp = ((PyObject*)p->__pyx_v_tolerance);
  10225. p->__pyx_v_tolerance = Py_None; Py_INCREF(Py_None);
  10226. Py_XDECREF(tmp);
  10227. return 0;
  10228. }
  10229. #if CYTHON_USE_TYPE_SPECS
  10230. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots[] = {
  10231. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  10232. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  10233. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  10234. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize},
  10235. {0, 0},
  10236. };
  10237. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec = {
  10238. "fontTools.varLib.iup.__pyx_scope_struct_2_iup_contour_optimize",
  10239. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize),
  10240. 0,
  10241. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  10242. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_slots,
  10243. };
  10244. #else
  10245. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = {
  10246. PyVarObject_HEAD_INIT(0, 0)
  10247. "fontTools.varLib.iup.""__pyx_scope_struct_2_iup_contour_optimize", /*tp_name*/
  10248. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize), /*tp_basicsize*/
  10249. 0, /*tp_itemsize*/
  10250. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_dealloc*/
  10251. #if PY_VERSION_HEX < 0x030800b4
  10252. 0, /*tp_print*/
  10253. #endif
  10254. #if PY_VERSION_HEX >= 0x030800b4
  10255. 0, /*tp_vectorcall_offset*/
  10256. #endif
  10257. 0, /*tp_getattr*/
  10258. 0, /*tp_setattr*/
  10259. #if PY_MAJOR_VERSION < 3
  10260. 0, /*tp_compare*/
  10261. #endif
  10262. #if PY_MAJOR_VERSION >= 3
  10263. 0, /*tp_as_async*/
  10264. #endif
  10265. 0, /*tp_repr*/
  10266. 0, /*tp_as_number*/
  10267. 0, /*tp_as_sequence*/
  10268. 0, /*tp_as_mapping*/
  10269. 0, /*tp_hash*/
  10270. 0, /*tp_call*/
  10271. 0, /*tp_str*/
  10272. 0, /*tp_getattro*/
  10273. 0, /*tp_setattro*/
  10274. 0, /*tp_as_buffer*/
  10275. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  10276. 0, /*tp_doc*/
  10277. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_traverse*/
  10278. __pyx_tp_clear_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_clear*/
  10279. 0, /*tp_richcompare*/
  10280. 0, /*tp_weaklistoffset*/
  10281. 0, /*tp_iter*/
  10282. 0, /*tp_iternext*/
  10283. 0, /*tp_methods*/
  10284. 0, /*tp_members*/
  10285. 0, /*tp_getset*/
  10286. 0, /*tp_base*/
  10287. 0, /*tp_dict*/
  10288. 0, /*tp_descr_get*/
  10289. 0, /*tp_descr_set*/
  10290. #if !CYTHON_USE_TYPE_SPECS
  10291. 0, /*tp_dictoffset*/
  10292. #endif
  10293. 0, /*tp_init*/
  10294. 0, /*tp_alloc*/
  10295. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize, /*tp_new*/
  10296. 0, /*tp_free*/
  10297. 0, /*tp_is_gc*/
  10298. 0, /*tp_bases*/
  10299. 0, /*tp_mro*/
  10300. 0, /*tp_cache*/
  10301. 0, /*tp_subclasses*/
  10302. 0, /*tp_weaklist*/
  10303. 0, /*tp_del*/
  10304. 0, /*tp_version_tag*/
  10305. #if PY_VERSION_HEX >= 0x030400a1
  10306. #if CYTHON_USE_TP_FINALIZE
  10307. 0, /*tp_finalize*/
  10308. #else
  10309. NULL, /*tp_finalize*/
  10310. #endif
  10311. #endif
  10312. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  10313. 0, /*tp_vectorcall*/
  10314. #endif
  10315. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10316. 0, /*tp_print*/
  10317. #endif
  10318. #if PY_VERSION_HEX >= 0x030C0000
  10319. 0, /*tp_watched*/
  10320. #endif
  10321. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10322. 0, /*tp_pypy_flags*/
  10323. #endif
  10324. };
  10325. #endif
  10326. static struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[8];
  10327. static int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = 0;
  10328. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  10329. PyObject *o;
  10330. #if CYTHON_COMPILING_IN_LIMITED_API
  10331. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  10332. o = alloc_func(t, 0);
  10333. #else
  10334. #if CYTHON_COMPILING_IN_CPYTHON
  10335. if (likely((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr)))) {
  10336. o = (PyObject*)__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[--__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr];
  10337. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr));
  10338. (void) PyObject_INIT(o, t);
  10339. PyObject_GC_Track(o);
  10340. } else
  10341. #endif
  10342. {
  10343. o = (*t->tp_alloc)(t, 0);
  10344. if (unlikely(!o)) return 0;
  10345. }
  10346. #endif
  10347. return o;
  10348. }
  10349. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o) {
  10350. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  10351. #if CYTHON_USE_TP_FINALIZE
  10352. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10353. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) {
  10354. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10355. }
  10356. }
  10357. #endif
  10358. PyObject_GC_UnTrack(o);
  10359. Py_CLEAR(p->__pyx_outer_scope);
  10360. Py_CLEAR(p->__pyx_genexpr_arg_0);
  10361. Py_CLEAR(p->__pyx_v_p);
  10362. #if CYTHON_COMPILING_IN_CPYTHON
  10363. if (((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr)))) {
  10364. __pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr[__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o);
  10365. } else
  10366. #endif
  10367. {
  10368. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  10369. (*Py_TYPE(o)->tp_free)(o);
  10370. #else
  10371. {
  10372. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  10373. if (tp_free) tp_free(o);
  10374. }
  10375. #endif
  10376. }
  10377. }
  10378. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  10379. int e;
  10380. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr *)o;
  10381. if (p->__pyx_outer_scope) {
  10382. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  10383. }
  10384. if (p->__pyx_genexpr_arg_0) {
  10385. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  10386. }
  10387. if (p->__pyx_v_p) {
  10388. e = (*v)(p->__pyx_v_p, a); if (e) return e;
  10389. }
  10390. return 0;
  10391. }
  10392. #if CYTHON_USE_TYPE_SPECS
  10393. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots[] = {
  10394. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10395. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10396. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr},
  10397. {0, 0},
  10398. };
  10399. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec = {
  10400. "fontTools.varLib.iup.__pyx_scope_struct_3_genexpr",
  10401. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr),
  10402. 0,
  10403. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  10404. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_slots,
  10405. };
  10406. #else
  10407. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = {
  10408. PyVarObject_HEAD_INIT(0, 0)
  10409. "fontTools.varLib.iup.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  10410. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  10411. 0, /*tp_itemsize*/
  10412. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  10413. #if PY_VERSION_HEX < 0x030800b4
  10414. 0, /*tp_print*/
  10415. #endif
  10416. #if PY_VERSION_HEX >= 0x030800b4
  10417. 0, /*tp_vectorcall_offset*/
  10418. #endif
  10419. 0, /*tp_getattr*/
  10420. 0, /*tp_setattr*/
  10421. #if PY_MAJOR_VERSION < 3
  10422. 0, /*tp_compare*/
  10423. #endif
  10424. #if PY_MAJOR_VERSION >= 3
  10425. 0, /*tp_as_async*/
  10426. #endif
  10427. 0, /*tp_repr*/
  10428. 0, /*tp_as_number*/
  10429. 0, /*tp_as_sequence*/
  10430. 0, /*tp_as_mapping*/
  10431. 0, /*tp_hash*/
  10432. 0, /*tp_call*/
  10433. 0, /*tp_str*/
  10434. 0, /*tp_getattro*/
  10435. 0, /*tp_setattro*/
  10436. 0, /*tp_as_buffer*/
  10437. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  10438. 0, /*tp_doc*/
  10439. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  10440. 0, /*tp_clear*/
  10441. 0, /*tp_richcompare*/
  10442. 0, /*tp_weaklistoffset*/
  10443. 0, /*tp_iter*/
  10444. 0, /*tp_iternext*/
  10445. 0, /*tp_methods*/
  10446. 0, /*tp_members*/
  10447. 0, /*tp_getset*/
  10448. 0, /*tp_base*/
  10449. 0, /*tp_dict*/
  10450. 0, /*tp_descr_get*/
  10451. 0, /*tp_descr_set*/
  10452. #if !CYTHON_USE_TYPE_SPECS
  10453. 0, /*tp_dictoffset*/
  10454. #endif
  10455. 0, /*tp_init*/
  10456. 0, /*tp_alloc*/
  10457. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr, /*tp_new*/
  10458. 0, /*tp_free*/
  10459. 0, /*tp_is_gc*/
  10460. 0, /*tp_bases*/
  10461. 0, /*tp_mro*/
  10462. 0, /*tp_cache*/
  10463. 0, /*tp_subclasses*/
  10464. 0, /*tp_weaklist*/
  10465. 0, /*tp_del*/
  10466. 0, /*tp_version_tag*/
  10467. #if PY_VERSION_HEX >= 0x030400a1
  10468. #if CYTHON_USE_TP_FINALIZE
  10469. 0, /*tp_finalize*/
  10470. #else
  10471. NULL, /*tp_finalize*/
  10472. #endif
  10473. #endif
  10474. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  10475. 0, /*tp_vectorcall*/
  10476. #endif
  10477. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10478. 0, /*tp_print*/
  10479. #endif
  10480. #if PY_VERSION_HEX >= 0x030C0000
  10481. 0, /*tp_watched*/
  10482. #endif
  10483. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10484. 0, /*tp_pypy_flags*/
  10485. #endif
  10486. };
  10487. #endif
  10488. static struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[8];
  10489. static int __pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = 0;
  10490. static PyObject *__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  10491. PyObject *o;
  10492. #if CYTHON_COMPILING_IN_LIMITED_API
  10493. allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  10494. o = alloc_func(t, 0);
  10495. #else
  10496. #if CYTHON_COMPILING_IN_CPYTHON
  10497. if (likely((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr)))) {
  10498. o = (PyObject*)__pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[--__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr];
  10499. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr));
  10500. (void) PyObject_INIT(o, t);
  10501. PyObject_GC_Track(o);
  10502. } else
  10503. #endif
  10504. {
  10505. o = (*t->tp_alloc)(t, 0);
  10506. if (unlikely(!o)) return 0;
  10507. }
  10508. #endif
  10509. return o;
  10510. }
  10511. static void __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o) {
  10512. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10513. #if CYTHON_USE_TP_FINALIZE
  10514. if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  10515. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) {
  10516. if (PyObject_CallFinalizerFromDealloc(o)) return;
  10517. }
  10518. }
  10519. #endif
  10520. PyObject_GC_UnTrack(o);
  10521. Py_CLEAR(p->__pyx_outer_scope);
  10522. Py_CLEAR(p->__pyx_genexpr_arg_0);
  10523. Py_CLEAR(p->__pyx_v_d);
  10524. #if CYTHON_COMPILING_IN_CPYTHON
  10525. if (((int)(__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr)))) {
  10526. __pyx_freelist_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr[__pyx_freecount_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o);
  10527. } else
  10528. #endif
  10529. {
  10530. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  10531. (*Py_TYPE(o)->tp_free)(o);
  10532. #else
  10533. {
  10534. freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
  10535. if (tp_free) tp_free(o);
  10536. }
  10537. #endif
  10538. }
  10539. }
  10540. static int __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  10541. int e;
  10542. struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr *)o;
  10543. if (p->__pyx_outer_scope) {
  10544. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  10545. }
  10546. if (p->__pyx_genexpr_arg_0) {
  10547. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  10548. }
  10549. if (p->__pyx_v_d) {
  10550. e = (*v)(p->__pyx_v_d, a); if (e) return e;
  10551. }
  10552. return 0;
  10553. }
  10554. #if CYTHON_USE_TYPE_SPECS
  10555. static PyType_Slot __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots[] = {
  10556. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10557. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10558. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr},
  10559. {0, 0},
  10560. };
  10561. static PyType_Spec __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec = {
  10562. "fontTools.varLib.iup.__pyx_scope_struct_4_genexpr",
  10563. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr),
  10564. 0,
  10565. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  10566. __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_slots,
  10567. };
  10568. #else
  10569. static PyTypeObject __pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = {
  10570. PyVarObject_HEAD_INIT(0, 0)
  10571. "fontTools.varLib.iup.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  10572. sizeof(struct __pyx_obj_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  10573. 0, /*tp_itemsize*/
  10574. __pyx_tp_dealloc_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  10575. #if PY_VERSION_HEX < 0x030800b4
  10576. 0, /*tp_print*/
  10577. #endif
  10578. #if PY_VERSION_HEX >= 0x030800b4
  10579. 0, /*tp_vectorcall_offset*/
  10580. #endif
  10581. 0, /*tp_getattr*/
  10582. 0, /*tp_setattr*/
  10583. #if PY_MAJOR_VERSION < 3
  10584. 0, /*tp_compare*/
  10585. #endif
  10586. #if PY_MAJOR_VERSION >= 3
  10587. 0, /*tp_as_async*/
  10588. #endif
  10589. 0, /*tp_repr*/
  10590. 0, /*tp_as_number*/
  10591. 0, /*tp_as_sequence*/
  10592. 0, /*tp_as_mapping*/
  10593. 0, /*tp_hash*/
  10594. 0, /*tp_call*/
  10595. 0, /*tp_str*/
  10596. 0, /*tp_getattro*/
  10597. 0, /*tp_setattro*/
  10598. 0, /*tp_as_buffer*/
  10599. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  10600. 0, /*tp_doc*/
  10601. __pyx_tp_traverse_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  10602. 0, /*tp_clear*/
  10603. 0, /*tp_richcompare*/
  10604. 0, /*tp_weaklistoffset*/
  10605. 0, /*tp_iter*/
  10606. 0, /*tp_iternext*/
  10607. 0, /*tp_methods*/
  10608. 0, /*tp_members*/
  10609. 0, /*tp_getset*/
  10610. 0, /*tp_base*/
  10611. 0, /*tp_dict*/
  10612. 0, /*tp_descr_get*/
  10613. 0, /*tp_descr_set*/
  10614. #if !CYTHON_USE_TYPE_SPECS
  10615. 0, /*tp_dictoffset*/
  10616. #endif
  10617. 0, /*tp_init*/
  10618. 0, /*tp_alloc*/
  10619. __pyx_tp_new_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr, /*tp_new*/
  10620. 0, /*tp_free*/
  10621. 0, /*tp_is_gc*/
  10622. 0, /*tp_bases*/
  10623. 0, /*tp_mro*/
  10624. 0, /*tp_cache*/
  10625. 0, /*tp_subclasses*/
  10626. 0, /*tp_weaklist*/
  10627. 0, /*tp_del*/
  10628. 0, /*tp_version_tag*/
  10629. #if PY_VERSION_HEX >= 0x030400a1
  10630. #if CYTHON_USE_TP_FINALIZE
  10631. 0, /*tp_finalize*/
  10632. #else
  10633. NULL, /*tp_finalize*/
  10634. #endif
  10635. #endif
  10636. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  10637. 0, /*tp_vectorcall*/
  10638. #endif
  10639. #if __PYX_NEED_TP_PRINT_SLOT == 1
  10640. 0, /*tp_print*/
  10641. #endif
  10642. #if PY_VERSION_HEX >= 0x030C0000
  10643. 0, /*tp_watched*/
  10644. #endif
  10645. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  10646. 0, /*tp_pypy_flags*/
  10647. #endif
  10648. };
  10649. #endif
  10650. static PyMethodDef __pyx_methods[] = {
  10651. {0, 0, 0, 0}
  10652. };
  10653. #ifndef CYTHON_SMALL_CODE
  10654. #if defined(__clang__)
  10655. #define CYTHON_SMALL_CODE
  10656. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  10657. #define CYTHON_SMALL_CODE __attribute__((cold))
  10658. #else
  10659. #define CYTHON_SMALL_CODE
  10660. #endif
  10661. #endif
  10662. /* #### Code section: pystring_table ### */
  10663. static int __Pyx_CreateStringTabAndInitStrings(void) {
  10664. __Pyx_StringTabEntry __pyx_string_tab[] = {
  10665. {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  10666. {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  10667. {&__pyx_n_s_COMPILED, __pyx_k_COMPILED, sizeof(__pyx_k_COMPILED), 0, 0, 1, 1},
  10668. {&__pyx_n_s_Delta, __pyx_k_Delta, sizeof(__pyx_k_Delta), 0, 0, 1, 1},
  10669. {&__pyx_n_s_DeltaOrNone, __pyx_k_DeltaOrNone, sizeof(__pyx_k_DeltaOrNone), 0, 0, 1, 1},
  10670. {&__pyx_n_s_DeltaOrNoneSegment, __pyx_k_DeltaOrNoneSegment, sizeof(__pyx_k_DeltaOrNoneSegment), 0, 0, 1, 1},
  10671. {&__pyx_n_s_DeltaSegment, __pyx_k_DeltaSegment, sizeof(__pyx_k_DeltaSegment), 0, 0, 1, 1},
  10672. {&__pyx_n_s_Endpoints, __pyx_k_Endpoints, sizeof(__pyx_k_Endpoints), 0, 0, 1, 1},
  10673. {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  10674. {&__pyx_n_s_Integral, __pyx_k_Integral, sizeof(__pyx_k_Integral), 0, 0, 1, 1},
  10675. {&__pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_k_Lib_fontTools_varLib_iup_py, sizeof(__pyx_k_Lib_fontTools_varLib_iup_py), 0, 0, 1, 0},
  10676. {&__pyx_n_s_MAX_LOOKBACK, __pyx_k_MAX_LOOKBACK, sizeof(__pyx_k_MAX_LOOKBACK), 0, 0, 1, 1},
  10677. {&__pyx_n_s_Point, __pyx_k_Point, sizeof(__pyx_k_Point), 0, 0, 1, 1},
  10678. {&__pyx_n_s_PointSegment, __pyx_k_PointSegment, sizeof(__pyx_k_PointSegment), 0, 0, 1, 1},
  10679. {&__pyx_n_s_Real, __pyx_k_Real, sizeof(__pyx_k_Real), 0, 0, 1, 1},
  10680. {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1},
  10681. {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1},
  10682. {&__pyx_n_s_Union, __pyx_k_Union, sizeof(__pyx_k_Union), 0, 0, 1, 1},
  10683. {&__pyx_n_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 1},
  10684. {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  10685. {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  10686. {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
  10687. {&__pyx_n_s_best_cost, __pyx_k_best_cost, sizeof(__pyx_k_best_cost), 0, 0, 1, 1},
  10688. {&__pyx_n_s_best_j, __pyx_k_best_j, sizeof(__pyx_k_best_j), 0, 0, 1, 1},
  10689. {&__pyx_n_s_best_sol, __pyx_k_best_sol, sizeof(__pyx_k_best_sol), 0, 0, 1, 1},
  10690. {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  10691. {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1},
  10692. {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1},
  10693. {&__pyx_n_s_can_iup_in_between_locals_genexp, __pyx_k_can_iup_in_between_locals_genexp, sizeof(__pyx_k_can_iup_in_between_locals_genexp), 0, 0, 1, 1},
  10694. {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  10695. {&__pyx_n_s_cj, __pyx_k_cj, sizeof(__pyx_k_cj), 0, 0, 1, 1},
  10696. {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
  10697. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  10698. {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  10699. {&__pyx_n_s_contour, __pyx_k_contour, sizeof(__pyx_k_contour), 0, 0, 1, 1},
  10700. {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
  10701. {&__pyx_n_s_cost, __pyx_k_cost, sizeof(__pyx_k_cost), 0, 0, 1, 1},
  10702. {&__pyx_n_s_costs, __pyx_k_costs, sizeof(__pyx_k_costs), 0, 0, 1, 1},
  10703. {&__pyx_n_s_cython, __pyx_k_cython, sizeof(__pyx_k_cython), 0, 0, 1, 1},
  10704. {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  10705. {&__pyx_n_s_d0, __pyx_k_d0, sizeof(__pyx_k_d0), 0, 0, 1, 1},
  10706. {&__pyx_n_s_d1, __pyx_k_d1, sizeof(__pyx_k_d1), 0, 0, 1, 1},
  10707. {&__pyx_n_s_d2, __pyx_k_d2, sizeof(__pyx_k_d2), 0, 0, 1, 1},
  10708. {&__pyx_n_s_deltas, __pyx_k_deltas, sizeof(__pyx_k_deltas), 0, 0, 1, 1},
  10709. {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
  10710. {&__pyx_n_s_dj, __pyx_k_dj, sizeof(__pyx_k_dj), 0, 0, 1, 1},
  10711. {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
  10712. {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  10713. {&__pyx_n_s_ends, __pyx_k_ends, sizeof(__pyx_k_ends), 0, 0, 1, 1},
  10714. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  10715. {&__pyx_n_s_fontTools_misc, __pyx_k_fontTools_misc, sizeof(__pyx_k_fontTools_misc), 0, 0, 1, 1},
  10716. {&__pyx_n_s_fontTools_varLib_iup, __pyx_k_fontTools_varLib_iup, sizeof(__pyx_k_fontTools_varLib_iup), 0, 0, 1, 1},
  10717. {&__pyx_n_s_force, __pyx_k_force, sizeof(__pyx_k_force), 0, 0, 1, 1},
  10718. {&__pyx_n_s_forced, __pyx_k_forced, sizeof(__pyx_k_forced), 0, 0, 1, 1},
  10719. {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
  10720. {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  10721. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  10722. {&__pyx_n_s_i1, __pyx_k_i1, sizeof(__pyx_k_i1), 0, 0, 1, 1},
  10723. {&__pyx_n_s_i2, __pyx_k_i2, sizeof(__pyx_k_i2), 0, 0, 1, 1},
  10724. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  10725. {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  10726. {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
  10727. {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
  10728. {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
  10729. {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1},
  10730. {&__pyx_n_s_iup_contour, __pyx_k_iup_contour, sizeof(__pyx_k_iup_contour), 0, 0, 1, 1},
  10731. {&__pyx_n_s_iup_contour_bound_forced_set, __pyx_k_iup_contour_bound_forced_set, sizeof(__pyx_k_iup_contour_bound_forced_set), 0, 0, 1, 1},
  10732. {&__pyx_n_s_iup_contour_optimize, __pyx_k_iup_contour_optimize, sizeof(__pyx_k_iup_contour_optimize), 0, 0, 1, 1},
  10733. {&__pyx_n_s_iup_contour_optimize_dp, __pyx_k_iup_contour_optimize_dp, sizeof(__pyx_k_iup_contour_optimize_dp), 0, 0, 1, 1},
  10734. {&__pyx_n_s_iup_contour_optimize_locals_gene, __pyx_k_iup_contour_optimize_locals_gene, sizeof(__pyx_k_iup_contour_optimize_locals_gene), 0, 0, 1, 1},
  10735. {&__pyx_n_s_iup_delta, __pyx_k_iup_delta, sizeof(__pyx_k_iup_delta), 0, 0, 1, 1},
  10736. {&__pyx_n_s_iup_delta_optimize, __pyx_k_iup_delta_optimize, sizeof(__pyx_k_iup_delta_optimize), 0, 0, 1, 1},
  10737. {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  10738. {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  10739. {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  10740. {&__pyx_n_s_lc, __pyx_k_lc, sizeof(__pyx_k_lc), 0, 0, 1, 1},
  10741. {&__pyx_n_s_lcj, __pyx_k_lcj, sizeof(__pyx_k_lcj), 0, 0, 1, 1},
  10742. {&__pyx_n_s_ld, __pyx_k_ld, sizeof(__pyx_k_ld), 0, 0, 1, 1},
  10743. {&__pyx_n_s_ldj, __pyx_k_ldj, sizeof(__pyx_k_ldj), 0, 0, 1, 1},
  10744. {&__pyx_n_s_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 0, 1, 1},
  10745. {&__pyx_n_s_lookback, __pyx_k_lookback, sizeof(__pyx_k_lookback), 0, 0, 1, 1},
  10746. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  10747. {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  10748. {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  10749. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  10750. {&__pyx_n_s_nc, __pyx_k_nc, sizeof(__pyx_k_nc), 0, 0, 1, 1},
  10751. {&__pyx_n_s_ncj, __pyx_k_ncj, sizeof(__pyx_k_ncj), 0, 0, 1, 1},
  10752. {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
  10753. {&__pyx_n_s_ndj, __pyx_k_ndj, sizeof(__pyx_k_ndj), 0, 0, 1, 1},
  10754. {&__pyx_n_s_numbers, __pyx_k_numbers, sizeof(__pyx_k_numbers), 0, 0, 1, 1},
  10755. {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  10756. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  10757. {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  10758. {&__pyx_n_s_ri1, __pyx_k_ri1, sizeof(__pyx_k_ri1), 0, 0, 1, 1},
  10759. {&__pyx_n_s_ri2, __pyx_k_ri2, sizeof(__pyx_k_ri2), 0, 0, 1, 1},
  10760. {&__pyx_n_s_rot_list, __pyx_k_rot_list, sizeof(__pyx_k_rot_list), 0, 0, 1, 1},
  10761. {&__pyx_n_s_rot_set, __pyx_k_rot_set, sizeof(__pyx_k_rot_set), 0, 0, 1, 1},
  10762. {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  10763. {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  10764. {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 0, 0, 1, 1},
  10765. {&__pyx_n_s_solution, __pyx_k_solution, sizeof(__pyx_k_solution), 0, 0, 1, 1},
  10766. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  10767. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  10768. {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  10769. {&__pyx_n_s_tolerance, __pyx_k_tolerance, sizeof(__pyx_k_tolerance), 0, 0, 1, 1},
  10770. {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1},
  10771. {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  10772. {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  10773. {0, 0, 0, 0, 0, 0, 0}
  10774. };
  10775. return __Pyx_InitStrings(__pyx_string_tab);
  10776. }
  10777. /* #### Code section: cached_builtins ### */
  10778. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  10779. __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 5, __pyx_L1_error)
  10780. __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 5, __pyx_L1_error)
  10781. __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 84, __pyx_L1_error)
  10782. __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 93, __pyx_L1_error)
  10783. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 99, __pyx_L1_error)
  10784. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 223, __pyx_L1_error)
  10785. __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 400, __pyx_L1_error)
  10786. return 0;
  10787. __pyx_L1_error:;
  10788. return -1;
  10789. }
  10790. /* #### Code section: cached_constants ### */
  10791. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  10792. __Pyx_RefNannyDeclarations
  10793. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  10794. /* "fontTools/varLib/iup.py":53
  10795. * # rd1 = reference delta 1
  10796. * out_arrays = [None, None]
  10797. * for j in 0, 1: # <<<<<<<<<<<<<<
  10798. * out_arrays[j] = out = []
  10799. * x1, x2, d1, d2 = rc1[j], rc2[j], rd1[j], rd2[j]
  10800. */
  10801. __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 53, __pyx_L1_error)
  10802. __Pyx_GOTREF(__pyx_tuple_);
  10803. __Pyx_GIVEREF(__pyx_tuple_);
  10804. /* "fontTools/varLib/iup.py":102
  10805. * if not indices:
  10806. * # All deltas are None. Return 0,0 for all.
  10807. * return [(0, 0)] * n # <<<<<<<<<<<<<<
  10808. *
  10809. * out = []
  10810. */
  10811. __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 102, __pyx_L1_error)
  10812. __Pyx_GOTREF(__pyx_tuple__2);
  10813. __Pyx_GIVEREF(__pyx_tuple__2);
  10814. /* "fontTools/varLib/iup.py":87
  10815. *
  10816. *
  10817. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  10818. * """For the contour given in `coords`, interpolate any missing
  10819. * delta values in delta vector `deltas`.
  10820. */
  10821. __pyx_tuple__4 = PyTuple_Pack(14, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_n, __pyx_n_s_indices, __pyx_n_s_out, __pyx_n_s_it, __pyx_n_s_start, __pyx_n_s_i1, __pyx_n_s_i2, __pyx_n_s_ri1, __pyx_n_s_ri2, __pyx_n_s_end, __pyx_n_s_i, __pyx_n_s_v); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 87, __pyx_L1_error)
  10822. __Pyx_GOTREF(__pyx_tuple__4);
  10823. __Pyx_GIVEREF(__pyx_tuple__4);
  10824. __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_contour, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 87, __pyx_L1_error)
  10825. /* "fontTools/varLib/iup.py":139
  10826. *
  10827. *
  10828. * def iup_delta( # <<<<<<<<<<<<<<
  10829. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  10830. * ) -> _DeltaSegment:
  10831. */
  10832. __pyx_tuple__6 = PyTuple_Pack(8, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_ends, __pyx_n_s_n, __pyx_n_s_out, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_contour); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 139, __pyx_L1_error)
  10833. __Pyx_GOTREF(__pyx_tuple__6);
  10834. __Pyx_GIVEREF(__pyx_tuple__6);
  10835. __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_delta, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 139, __pyx_L1_error)
  10836. /* "fontTools/varLib/iup.py":198
  10837. *
  10838. *
  10839. * @cython.locals( # <<<<<<<<<<<<<<
  10840. * cj=cython.double,
  10841. * dj=cython.double,
  10842. */
  10843. __pyx_tuple__8 = PyTuple_Pack(24, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_tolerance, __pyx_n_s_cj, __pyx_n_s_dj, __pyx_n_s_lcj, __pyx_n_s_ldj, __pyx_n_s_ncj, __pyx_n_s_ndj, __pyx_n_s_force, __pyx_n_s_forced, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_ld, __pyx_n_s_lc, __pyx_n_s_d, __pyx_n_s_c, __pyx_n_s_nd, __pyx_n_s_nc, __pyx_n_s_j, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_d1, __pyx_n_s_d2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 198, __pyx_L1_error)
  10844. __Pyx_GOTREF(__pyx_tuple__8);
  10845. __Pyx_GIVEREF(__pyx_tuple__8);
  10846. __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_contour_bound_forced_set, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 198, __pyx_L1_error)
  10847. __pyx_tuple__10 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 198, __pyx_L1_error)
  10848. __Pyx_GOTREF(__pyx_tuple__10);
  10849. __Pyx_GIVEREF(__pyx_tuple__10);
  10850. /* "fontTools/varLib/iup.py":289
  10851. *
  10852. *
  10853. * @cython.locals( # <<<<<<<<<<<<<<
  10854. * i=cython.int,
  10855. * j=cython.int,
  10856. */
  10857. __pyx_tuple__11 = PyTuple_Pack(13, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_forced, __pyx_n_s_tolerance, __pyx_n_s_lookback, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_best_cost, __pyx_n_s_best_j, __pyx_n_s_cost, __pyx_n_s_n, __pyx_n_s_costs, __pyx_n_s_chain); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 289, __pyx_L1_error)
  10858. __Pyx_GOTREF(__pyx_tuple__11);
  10859. __Pyx_GIVEREF(__pyx_tuple__11);
  10860. __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_contour_optimize_dp, 289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 289, __pyx_L1_error)
  10861. /* "fontTools/varLib/iup.py":342
  10862. *
  10863. *
  10864. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  10865. * """Rotate list by k items forward. Ie. item at position 0 will be
  10866. * at position k in returned list. Negative k is allowed."""
  10867. */
  10868. __pyx_tuple__13 = PyTuple_Pack(3, __pyx_n_s_l, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 342, __pyx_L1_error)
  10869. __Pyx_GOTREF(__pyx_tuple__13);
  10870. __Pyx_GIVEREF(__pyx_tuple__13);
  10871. __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_rot_list, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 342, __pyx_L1_error)
  10872. /* "fontTools/varLib/iup.py":352
  10873. *
  10874. *
  10875. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  10876. * k %= n
  10877. * if not k:
  10878. */
  10879. __pyx_tuple__15 = PyTuple_Pack(4, __pyx_n_s_s, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_v); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 352, __pyx_L1_error)
  10880. __Pyx_GOTREF(__pyx_tuple__15);
  10881. __Pyx_GIVEREF(__pyx_tuple__15);
  10882. __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_rot_set, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 352, __pyx_L1_error)
  10883. /* "fontTools/varLib/iup.py":359
  10884. *
  10885. *
  10886. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  10887. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  10888. * ) -> _DeltaOrNoneSegment:
  10889. */
  10890. __pyx_tuple__17 = PyTuple_Pack(20, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_tolerance, __pyx_n_s_n, __pyx_n_s_d0, __pyx_n_s_forced, __pyx_n_s_k, __pyx_n_s_chain, __pyx_n_s_costs, __pyx_n_s_solution, __pyx_n_s_i, __pyx_n_s_best_sol, __pyx_n_s_best_cost, __pyx_n_s_start, __pyx_n_s_cost, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_i, __pyx_n_s_i); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 359, __pyx_L1_error)
  10891. __Pyx_GOTREF(__pyx_tuple__17);
  10892. __Pyx_GIVEREF(__pyx_tuple__17);
  10893. __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_contour_optimize, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 359, __pyx_L1_error)
  10894. __pyx_tuple__19 = PyTuple_Pack(1, ((PyObject*)__pyx_float_0_0)); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 359, __pyx_L1_error)
  10895. __Pyx_GOTREF(__pyx_tuple__19);
  10896. __Pyx_GIVEREF(__pyx_tuple__19);
  10897. /* "fontTools/varLib/iup.py":460
  10898. *
  10899. *
  10900. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  10901. * deltas: _DeltaSegment,
  10902. * coords: _PointSegment,
  10903. */
  10904. __pyx_tuple__20 = PyTuple_Pack(9, __pyx_n_s_deltas, __pyx_n_s_coords, __pyx_n_s_ends, __pyx_n_s_tolerance, __pyx_n_s_n, __pyx_n_s_out, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_contour); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 460, __pyx_L1_error)
  10905. __Pyx_GOTREF(__pyx_tuple__20);
  10906. __Pyx_GIVEREF(__pyx_tuple__20);
  10907. __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Lib_fontTools_varLib_iup_py, __pyx_n_s_iup_delta_optimize, 460, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 460, __pyx_L1_error)
  10908. __Pyx_RefNannyFinishContext();
  10909. return 0;
  10910. __pyx_L1_error:;
  10911. __Pyx_RefNannyFinishContext();
  10912. return -1;
  10913. }
  10914. /* #### Code section: init_constants ### */
  10915. static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
  10916. if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  10917. __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10918. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  10919. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  10920. __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  10921. __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  10922. __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  10923. __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  10924. __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  10925. return 0;
  10926. __pyx_L1_error:;
  10927. return -1;
  10928. }
  10929. /* #### Code section: init_globals ### */
  10930. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  10931. /* AssertionsEnabled.init */
  10932. if (likely(__Pyx_init_assertions_enabled() == 0)); else
  10933. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  10934. return 0;
  10935. __pyx_L1_error:;
  10936. return -1;
  10937. }
  10938. /* #### Code section: init_module ### */
  10939. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  10940. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  10941. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  10942. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  10943. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  10944. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  10945. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  10946. static int __Pyx_modinit_global_init_code(void) {
  10947. __Pyx_RefNannyDeclarations
  10948. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  10949. /*--- Global init code ---*/
  10950. __Pyx_RefNannyFinishContext();
  10951. return 0;
  10952. }
  10953. static int __Pyx_modinit_variable_export_code(void) {
  10954. __Pyx_RefNannyDeclarations
  10955. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  10956. /*--- Variable export code ---*/
  10957. __Pyx_RefNannyFinishContext();
  10958. return 0;
  10959. }
  10960. static int __Pyx_modinit_function_export_code(void) {
  10961. __Pyx_RefNannyDeclarations
  10962. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  10963. /*--- Function export code ---*/
  10964. __Pyx_RefNannyFinishContext();
  10965. return 0;
  10966. }
  10967. static int __Pyx_modinit_type_init_code(void) {
  10968. __Pyx_RefNannyDeclarations
  10969. int __pyx_lineno = 0;
  10970. const char *__pyx_filename = NULL;
  10971. int __pyx_clineno = 0;
  10972. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  10973. /*--- Type init code ---*/
  10974. #if CYTHON_USE_TYPE_SPECS
  10975. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between)) __PYX_ERR(0, 165, __pyx_L1_error)
  10976. 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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
  10977. #else
  10978. __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;
  10979. #endif
  10980. #if !CYTHON_COMPILING_IN_LIMITED_API
  10981. #endif
  10982. #if !CYTHON_USE_TYPE_SPECS
  10983. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
  10984. #endif
  10985. #if PY_MAJOR_VERSION < 3
  10986. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_print = 0;
  10987. #endif
  10988. #if !CYTHON_COMPILING_IN_LIMITED_API
  10989. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_dictoffset && __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_getattro == PyObject_GenericGetAttr)) {
  10990. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct____pyx_f_9fontTools_6varLib_3iup_can_iup_in_between->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  10991. }
  10992. #endif
  10993. #if CYTHON_USE_TYPE_SPECS
  10994. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 193, __pyx_L1_error)
  10995. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr_spec, __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
  10996. #else
  10997. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr;
  10998. #endif
  10999. #if !CYTHON_COMPILING_IN_LIMITED_API
  11000. #endif
  11001. #if !CYTHON_USE_TYPE_SPECS
  11002. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
  11003. #endif
  11004. #if PY_MAJOR_VERSION < 3
  11005. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_print = 0;
  11006. #endif
  11007. #if !CYTHON_COMPILING_IN_LIMITED_API
  11008. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  11009. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_1_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  11010. }
  11011. #endif
  11012. #if CYTHON_USE_TYPE_SPECS
  11013. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize)) __PYX_ERR(0, 359, __pyx_L1_error)
  11014. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize_spec, __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11015. #else
  11016. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize;
  11017. #endif
  11018. #if !CYTHON_COMPILING_IN_LIMITED_API
  11019. #endif
  11020. #if !CYTHON_USE_TYPE_SPECS
  11021. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11022. #endif
  11023. #if PY_MAJOR_VERSION < 3
  11024. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_print = 0;
  11025. #endif
  11026. #if !CYTHON_COMPILING_IN_LIMITED_API
  11027. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_dictoffset && __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_getattro == PyObject_GenericGetAttr)) {
  11028. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_2_iup_contour_optimize->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  11029. }
  11030. #endif
  11031. #if CYTHON_USE_TYPE_SPECS
  11032. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 374, __pyx_L1_error)
  11033. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr_spec, __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
  11034. #else
  11035. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr;
  11036. #endif
  11037. #if !CYTHON_COMPILING_IN_LIMITED_API
  11038. #endif
  11039. #if !CYTHON_USE_TYPE_SPECS
  11040. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
  11041. #endif
  11042. #if PY_MAJOR_VERSION < 3
  11043. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_print = 0;
  11044. #endif
  11045. #if !CYTHON_COMPILING_IN_LIMITED_API
  11046. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  11047. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_3_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  11048. }
  11049. #endif
  11050. #if CYTHON_USE_TYPE_SPECS
  11051. __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_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 383, __pyx_L1_error)
  11052. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr_spec, __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
  11053. #else
  11054. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr = &__pyx_type_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr;
  11055. #endif
  11056. #if !CYTHON_COMPILING_IN_LIMITED_API
  11057. #endif
  11058. #if !CYTHON_USE_TYPE_SPECS
  11059. if (__Pyx_PyType_Ready(__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
  11060. #endif
  11061. #if PY_MAJOR_VERSION < 3
  11062. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_print = 0;
  11063. #endif
  11064. #if !CYTHON_COMPILING_IN_LIMITED_API
  11065. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  11066. __pyx_ptype_9fontTools_6varLib_3iup___pyx_scope_struct_4_genexpr->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  11067. }
  11068. #endif
  11069. __Pyx_RefNannyFinishContext();
  11070. return 0;
  11071. __pyx_L1_error:;
  11072. __Pyx_RefNannyFinishContext();
  11073. return -1;
  11074. }
  11075. static int __Pyx_modinit_type_import_code(void) {
  11076. __Pyx_RefNannyDeclarations
  11077. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  11078. /*--- Type import code ---*/
  11079. __Pyx_RefNannyFinishContext();
  11080. return 0;
  11081. }
  11082. static int __Pyx_modinit_variable_import_code(void) {
  11083. __Pyx_RefNannyDeclarations
  11084. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  11085. /*--- Variable import code ---*/
  11086. __Pyx_RefNannyFinishContext();
  11087. return 0;
  11088. }
  11089. static int __Pyx_modinit_function_import_code(void) {
  11090. __Pyx_RefNannyDeclarations
  11091. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  11092. /*--- Function import code ---*/
  11093. __Pyx_RefNannyFinishContext();
  11094. return 0;
  11095. }
  11096. #if PY_MAJOR_VERSION >= 3
  11097. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11098. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  11099. static int __pyx_pymod_exec_iup(PyObject* module); /*proto*/
  11100. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  11101. {Py_mod_create, (void*)__pyx_pymod_create},
  11102. {Py_mod_exec, (void*)__pyx_pymod_exec_iup},
  11103. {0, NULL}
  11104. };
  11105. #endif
  11106. #ifdef __cplusplus
  11107. namespace {
  11108. struct PyModuleDef __pyx_moduledef =
  11109. #else
  11110. static struct PyModuleDef __pyx_moduledef =
  11111. #endif
  11112. {
  11113. PyModuleDef_HEAD_INIT,
  11114. "iup",
  11115. 0, /* m_doc */
  11116. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11117. 0, /* m_size */
  11118. #elif CYTHON_USE_MODULE_STATE
  11119. sizeof(__pyx_mstate), /* m_size */
  11120. #else
  11121. -1, /* m_size */
  11122. #endif
  11123. __pyx_methods /* m_methods */,
  11124. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11125. __pyx_moduledef_slots, /* m_slots */
  11126. #else
  11127. NULL, /* m_reload */
  11128. #endif
  11129. #if CYTHON_USE_MODULE_STATE
  11130. __pyx_m_traverse, /* m_traverse */
  11131. __pyx_m_clear, /* m_clear */
  11132. NULL /* m_free */
  11133. #else
  11134. NULL, /* m_traverse */
  11135. NULL, /* m_clear */
  11136. NULL /* m_free */
  11137. #endif
  11138. };
  11139. #ifdef __cplusplus
  11140. } /* anonymous namespace */
  11141. #endif
  11142. #endif
  11143. #ifndef CYTHON_NO_PYINIT_EXPORT
  11144. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  11145. #elif PY_MAJOR_VERSION < 3
  11146. #ifdef __cplusplus
  11147. #define __Pyx_PyMODINIT_FUNC extern "C" void
  11148. #else
  11149. #define __Pyx_PyMODINIT_FUNC void
  11150. #endif
  11151. #else
  11152. #ifdef __cplusplus
  11153. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  11154. #else
  11155. #define __Pyx_PyMODINIT_FUNC PyObject *
  11156. #endif
  11157. #endif
  11158. #if PY_MAJOR_VERSION < 3
  11159. __Pyx_PyMODINIT_FUNC initiup(void) CYTHON_SMALL_CODE; /*proto*/
  11160. __Pyx_PyMODINIT_FUNC initiup(void)
  11161. #else
  11162. __Pyx_PyMODINIT_FUNC PyInit_iup(void) CYTHON_SMALL_CODE; /*proto*/
  11163. __Pyx_PyMODINIT_FUNC PyInit_iup(void)
  11164. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11165. {
  11166. return PyModuleDef_Init(&__pyx_moduledef);
  11167. }
  11168. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  11169. #if PY_VERSION_HEX >= 0x030700A1
  11170. static PY_INT64_T main_interpreter_id = -1;
  11171. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  11172. if (main_interpreter_id == -1) {
  11173. main_interpreter_id = current_id;
  11174. return (unlikely(current_id == -1)) ? -1 : 0;
  11175. } else if (unlikely(main_interpreter_id != current_id))
  11176. #else
  11177. static PyInterpreterState *main_interpreter = NULL;
  11178. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  11179. if (!main_interpreter) {
  11180. main_interpreter = current_interpreter;
  11181. } else if (unlikely(main_interpreter != current_interpreter))
  11182. #endif
  11183. {
  11184. PyErr_SetString(
  11185. PyExc_ImportError,
  11186. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  11187. return -1;
  11188. }
  11189. return 0;
  11190. }
  11191. #if CYTHON_COMPILING_IN_LIMITED_API
  11192. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
  11193. #else
  11194. 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)
  11195. #endif
  11196. {
  11197. PyObject *value = PyObject_GetAttrString(spec, from_name);
  11198. int result = 0;
  11199. if (likely(value)) {
  11200. if (allow_none || value != Py_None) {
  11201. #if CYTHON_COMPILING_IN_LIMITED_API
  11202. result = PyModule_AddObject(module, to_name, value);
  11203. #else
  11204. result = PyDict_SetItemString(moddict, to_name, value);
  11205. #endif
  11206. }
  11207. Py_DECREF(value);
  11208. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  11209. PyErr_Clear();
  11210. } else {
  11211. result = -1;
  11212. }
  11213. return result;
  11214. }
  11215. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  11216. PyObject *module = NULL, *moddict, *modname;
  11217. CYTHON_UNUSED_VAR(def);
  11218. if (__Pyx_check_single_interpreter())
  11219. return NULL;
  11220. if (__pyx_m)
  11221. return __Pyx_NewRef(__pyx_m);
  11222. modname = PyObject_GetAttrString(spec, "name");
  11223. if (unlikely(!modname)) goto bad;
  11224. module = PyModule_NewObject(modname);
  11225. Py_DECREF(modname);
  11226. if (unlikely(!module)) goto bad;
  11227. #if CYTHON_COMPILING_IN_LIMITED_API
  11228. moddict = module;
  11229. #else
  11230. moddict = PyModule_GetDict(module);
  11231. if (unlikely(!moddict)) goto bad;
  11232. #endif
  11233. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  11234. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  11235. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  11236. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  11237. return module;
  11238. bad:
  11239. Py_XDECREF(module);
  11240. return NULL;
  11241. }
  11242. static CYTHON_SMALL_CODE int __pyx_pymod_exec_iup(PyObject *__pyx_pyinit_module)
  11243. #endif
  11244. #endif
  11245. {
  11246. int stringtab_initialized = 0;
  11247. #if CYTHON_USE_MODULE_STATE
  11248. int pystate_addmodule_run = 0;
  11249. #endif
  11250. PyObject *__pyx_t_1 = NULL;
  11251. PyObject *__pyx_t_2 = NULL;
  11252. PyObject *__pyx_t_3 = NULL;
  11253. int __pyx_t_4;
  11254. PyObject *__pyx_t_5 = NULL;
  11255. PyObject *__pyx_t_6 = NULL;
  11256. PyObject *__pyx_t_7 = NULL;
  11257. PyObject *__pyx_t_8 = NULL;
  11258. PyObject *__pyx_t_9 = NULL;
  11259. int __pyx_lineno = 0;
  11260. const char *__pyx_filename = NULL;
  11261. int __pyx_clineno = 0;
  11262. __Pyx_RefNannyDeclarations
  11263. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11264. if (__pyx_m) {
  11265. if (__pyx_m == __pyx_pyinit_module) return 0;
  11266. PyErr_SetString(PyExc_RuntimeError, "Module 'iup' has already been imported. Re-initialisation is not supported.");
  11267. return -1;
  11268. }
  11269. #elif PY_MAJOR_VERSION >= 3
  11270. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  11271. #endif
  11272. /*--- Module creation code ---*/
  11273. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11274. __pyx_m = __pyx_pyinit_module;
  11275. Py_INCREF(__pyx_m);
  11276. #else
  11277. #if PY_MAJOR_VERSION < 3
  11278. __pyx_m = Py_InitModule4("iup", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  11279. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  11280. #elif CYTHON_USE_MODULE_STATE
  11281. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  11282. {
  11283. int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
  11284. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to iup pseudovariable */
  11285. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  11286. pystate_addmodule_run = 1;
  11287. }
  11288. #else
  11289. __pyx_m = PyModule_Create(&__pyx_moduledef);
  11290. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  11291. #endif
  11292. #endif
  11293. CYTHON_UNUSED_VAR(__pyx_t_1);
  11294. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  11295. Py_INCREF(__pyx_d);
  11296. __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  11297. __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  11298. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11299. #if CYTHON_REFNANNY
  11300. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  11301. if (!__Pyx_RefNanny) {
  11302. PyErr_Clear();
  11303. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  11304. if (!__Pyx_RefNanny)
  11305. Py_FatalError("failed to import 'refnanny' module");
  11306. }
  11307. #endif
  11308. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_iup(void)", 0);
  11309. 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)
  11310. #ifdef __Pxy_PyFrame_Initialize_Offsets
  11311. __Pxy_PyFrame_Initialize_Offsets();
  11312. #endif
  11313. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  11314. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  11315. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  11316. #ifdef __Pyx_CyFunction_USED
  11317. if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11318. #endif
  11319. #ifdef __Pyx_FusedFunction_USED
  11320. if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11321. #endif
  11322. #ifdef __Pyx_Coroutine_USED
  11323. if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11324. #endif
  11325. #ifdef __Pyx_Generator_USED
  11326. if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11327. #endif
  11328. #ifdef __Pyx_AsyncGen_USED
  11329. if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11330. #endif
  11331. #ifdef __Pyx_StopAsyncIteration_USED
  11332. if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11333. #endif
  11334. /*--- Library function declarations ---*/
  11335. /*--- Threads initialization code ---*/
  11336. #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  11337. PyEval_InitThreads();
  11338. #endif
  11339. /*--- Initialize various global constants etc. ---*/
  11340. if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11341. stringtab_initialized = 1;
  11342. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11343. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  11344. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11345. #endif
  11346. if (__pyx_module_is_main_fontTools__varLib__iup) {
  11347. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11348. }
  11349. #if PY_MAJOR_VERSION >= 3
  11350. {
  11351. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  11352. if (!PyDict_GetItemString(modules, "fontTools.varLib.iup")) {
  11353. if (unlikely((PyDict_SetItemString(modules, "fontTools.varLib.iup", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  11354. }
  11355. }
  11356. #endif
  11357. /*--- Builtin init code ---*/
  11358. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11359. /*--- Constants init code ---*/
  11360. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11361. /*--- Global type/function init code ---*/
  11362. (void)__Pyx_modinit_global_init_code();
  11363. (void)__Pyx_modinit_variable_export_code();
  11364. (void)__Pyx_modinit_function_export_code();
  11365. if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  11366. (void)__Pyx_modinit_type_import_code();
  11367. (void)__Pyx_modinit_variable_import_code();
  11368. (void)__Pyx_modinit_function_import_code();
  11369. /*--- Execution code ---*/
  11370. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  11371. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11372. #endif
  11373. /* "fontTools/varLib/iup.py":1
  11374. * try: # <<<<<<<<<<<<<<
  11375. * import cython
  11376. *
  11377. */
  11378. {
  11379. __Pyx_PyThreadState_declare
  11380. __Pyx_PyThreadState_assign
  11381. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  11382. __Pyx_XGOTREF(__pyx_t_1);
  11383. __Pyx_XGOTREF(__pyx_t_2);
  11384. __Pyx_XGOTREF(__pyx_t_3);
  11385. /*try:*/ {
  11386. /* "fontTools/varLib/iup.py":4
  11387. * import cython
  11388. *
  11389. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  11390. * except (AttributeError, ImportError):
  11391. * # if cython not installed, use mock module with no-op decorators and types
  11392. */
  11393. if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED, Py_True) < 0) __PYX_ERR(0, 4, __pyx_L2_error)
  11394. /* "fontTools/varLib/iup.py":1
  11395. * try: # <<<<<<<<<<<<<<
  11396. * import cython
  11397. *
  11398. */
  11399. }
  11400. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  11401. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11402. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11403. goto __pyx_L7_try_end;
  11404. __pyx_L2_error:;
  11405. /* "fontTools/varLib/iup.py":5
  11406. *
  11407. * COMPILED = cython.compiled
  11408. * except (AttributeError, ImportError): # <<<<<<<<<<<<<<
  11409. * # if cython not installed, use mock module with no-op decorators and types
  11410. * from fontTools.misc import cython
  11411. */
  11412. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_AttributeError, __pyx_builtin_ImportError);
  11413. if (__pyx_t_4) {
  11414. __Pyx_AddTraceback("fontTools.varLib.iup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11415. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 5, __pyx_L4_except_error)
  11416. __Pyx_XGOTREF(__pyx_t_5);
  11417. __Pyx_XGOTREF(__pyx_t_6);
  11418. __Pyx_XGOTREF(__pyx_t_7);
  11419. /* "fontTools/varLib/iup.py":7
  11420. * except (AttributeError, ImportError):
  11421. * # if cython not installed, use mock module with no-op decorators and types
  11422. * from fontTools.misc import cython # <<<<<<<<<<<<<<
  11423. *
  11424. * COMPILED = False
  11425. */
  11426. __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 7, __pyx_L4_except_error)
  11427. __Pyx_GOTREF(__pyx_t_8);
  11428. __Pyx_INCREF(__pyx_n_s_cython);
  11429. __Pyx_GIVEREF(__pyx_n_s_cython);
  11430. if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_cython)) __PYX_ERR(0, 7, __pyx_L4_except_error);
  11431. __pyx_t_9 = __Pyx_Import(__pyx_n_s_fontTools_misc, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 7, __pyx_L4_except_error)
  11432. __Pyx_GOTREF(__pyx_t_9);
  11433. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  11434. __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_cython); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 7, __pyx_L4_except_error)
  11435. __Pyx_GOTREF(__pyx_t_8);
  11436. if (PyDict_SetItem(__pyx_d, __pyx_n_s_cython, __pyx_t_8) < 0) __PYX_ERR(0, 7, __pyx_L4_except_error)
  11437. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  11438. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11439. /* "fontTools/varLib/iup.py":9
  11440. * from fontTools.misc import cython
  11441. *
  11442. * COMPILED = False # <<<<<<<<<<<<<<
  11443. *
  11444. * from typing import (
  11445. */
  11446. if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED, Py_False) < 0) __PYX_ERR(0, 9, __pyx_L4_except_error)
  11447. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  11448. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  11449. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  11450. goto __pyx_L3_exception_handled;
  11451. }
  11452. goto __pyx_L4_except_error;
  11453. /* "fontTools/varLib/iup.py":1
  11454. * try: # <<<<<<<<<<<<<<
  11455. * import cython
  11456. *
  11457. */
  11458. __pyx_L4_except_error:;
  11459. __Pyx_XGIVEREF(__pyx_t_1);
  11460. __Pyx_XGIVEREF(__pyx_t_2);
  11461. __Pyx_XGIVEREF(__pyx_t_3);
  11462. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  11463. goto __pyx_L1_error;
  11464. __pyx_L3_exception_handled:;
  11465. __Pyx_XGIVEREF(__pyx_t_1);
  11466. __Pyx_XGIVEREF(__pyx_t_2);
  11467. __Pyx_XGIVEREF(__pyx_t_3);
  11468. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  11469. __pyx_L7_try_end:;
  11470. }
  11471. /* "fontTools/varLib/iup.py":12
  11472. *
  11473. * from typing import (
  11474. * Sequence, # <<<<<<<<<<<<<<
  11475. * Tuple,
  11476. * Union,
  11477. */
  11478. __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 12, __pyx_L1_error)
  11479. __Pyx_GOTREF(__pyx_t_7);
  11480. __Pyx_INCREF(__pyx_n_s_Sequence);
  11481. __Pyx_GIVEREF(__pyx_n_s_Sequence);
  11482. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_Sequence)) __PYX_ERR(0, 12, __pyx_L1_error);
  11483. __Pyx_INCREF(__pyx_n_s_Tuple);
  11484. __Pyx_GIVEREF(__pyx_n_s_Tuple);
  11485. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_Tuple)) __PYX_ERR(0, 12, __pyx_L1_error);
  11486. __Pyx_INCREF(__pyx_n_s_Union);
  11487. __Pyx_GIVEREF(__pyx_n_s_Union);
  11488. if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_Union)) __PYX_ERR(0, 12, __pyx_L1_error);
  11489. /* "fontTools/varLib/iup.py":11
  11490. * COMPILED = False
  11491. *
  11492. * from typing import ( # <<<<<<<<<<<<<<
  11493. * Sequence,
  11494. * Tuple,
  11495. */
  11496. __pyx_t_6 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_7, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 11, __pyx_L1_error)
  11497. __Pyx_GOTREF(__pyx_t_6);
  11498. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11499. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 11, __pyx_L1_error)
  11500. __Pyx_GOTREF(__pyx_t_7);
  11501. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sequence, __pyx_t_7) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  11502. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11503. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 11, __pyx_L1_error)
  11504. __Pyx_GOTREF(__pyx_t_7);
  11505. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_7) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  11506. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11507. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_6, __pyx_n_s_Union); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 11, __pyx_L1_error)
  11508. __Pyx_GOTREF(__pyx_t_7);
  11509. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_7) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  11510. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11511. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11512. /* "fontTools/varLib/iup.py":16
  11513. * Union,
  11514. * )
  11515. * from numbers import Integral, Real # <<<<<<<<<<<<<<
  11516. *
  11517. *
  11518. */
  11519. __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error)
  11520. __Pyx_GOTREF(__pyx_t_6);
  11521. __Pyx_INCREF(__pyx_n_s_Integral);
  11522. __Pyx_GIVEREF(__pyx_n_s_Integral);
  11523. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Integral)) __PYX_ERR(0, 16, __pyx_L1_error);
  11524. __Pyx_INCREF(__pyx_n_s_Real);
  11525. __Pyx_GIVEREF(__pyx_n_s_Real);
  11526. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_Real)) __PYX_ERR(0, 16, __pyx_L1_error);
  11527. __pyx_t_7 = __Pyx_Import(__pyx_n_s_numbers, __pyx_t_6, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error)
  11528. __Pyx_GOTREF(__pyx_t_7);
  11529. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11530. __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_Integral); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error)
  11531. __Pyx_GOTREF(__pyx_t_6);
  11532. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integral, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  11533. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11534. __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error)
  11535. __Pyx_GOTREF(__pyx_t_6);
  11536. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Real, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  11537. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11538. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11539. /* "fontTools/varLib/iup.py":19
  11540. *
  11541. *
  11542. * _Point = Tuple[Real, Real] # <<<<<<<<<<<<<<
  11543. * _Delta = Tuple[Real, Real]
  11544. * _PointSegment = Sequence[_Point]
  11545. */
  11546. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L1_error)
  11547. __Pyx_GOTREF(__pyx_t_7);
  11548. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error)
  11549. __Pyx_GOTREF(__pyx_t_6);
  11550. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error)
  11551. __Pyx_GOTREF(__pyx_t_5);
  11552. __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 19, __pyx_L1_error)
  11553. __Pyx_GOTREF(__pyx_t_9);
  11554. __Pyx_GIVEREF(__pyx_t_6);
  11555. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error);
  11556. __Pyx_GIVEREF(__pyx_t_5);
  11557. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error);
  11558. __pyx_t_6 = 0;
  11559. __pyx_t_5 = 0;
  11560. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error)
  11561. __Pyx_GOTREF(__pyx_t_5);
  11562. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11563. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11564. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Point, __pyx_t_5) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
  11565. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11566. /* "fontTools/varLib/iup.py":20
  11567. *
  11568. * _Point = Tuple[Real, Real]
  11569. * _Delta = Tuple[Real, Real] # <<<<<<<<<<<<<<
  11570. * _PointSegment = Sequence[_Point]
  11571. * _DeltaSegment = Sequence[_Delta]
  11572. */
  11573. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error)
  11574. __Pyx_GOTREF(__pyx_t_5);
  11575. __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Real); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error)
  11576. __Pyx_GOTREF(__pyx_t_9);
  11577. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Real); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error)
  11578. __Pyx_GOTREF(__pyx_t_7);
  11579. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
  11580. __Pyx_GOTREF(__pyx_t_6);
  11581. __Pyx_GIVEREF(__pyx_t_9);
  11582. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error);
  11583. __Pyx_GIVEREF(__pyx_t_7);
  11584. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error);
  11585. __pyx_t_9 = 0;
  11586. __pyx_t_7 = 0;
  11587. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error)
  11588. __Pyx_GOTREF(__pyx_t_7);
  11589. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11590. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11591. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Delta, __pyx_t_7) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
  11592. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11593. /* "fontTools/varLib/iup.py":21
  11594. * _Point = Tuple[Real, Real]
  11595. * _Delta = Tuple[Real, Real]
  11596. * _PointSegment = Sequence[_Point] # <<<<<<<<<<<<<<
  11597. * _DeltaSegment = Sequence[_Delta]
  11598. * _DeltaOrNone = Union[_Delta, None]
  11599. */
  11600. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
  11601. __Pyx_GOTREF(__pyx_t_7);
  11602. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Point); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error)
  11603. __Pyx_GOTREF(__pyx_t_6);
  11604. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error)
  11605. __Pyx_GOTREF(__pyx_t_5);
  11606. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11607. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11608. if (PyDict_SetItem(__pyx_d, __pyx_n_s_PointSegment, __pyx_t_5) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  11609. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11610. /* "fontTools/varLib/iup.py":22
  11611. * _Delta = Tuple[Real, Real]
  11612. * _PointSegment = Sequence[_Point]
  11613. * _DeltaSegment = Sequence[_Delta] # <<<<<<<<<<<<<<
  11614. * _DeltaOrNone = Union[_Delta, None]
  11615. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  11616. */
  11617. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
  11618. __Pyx_GOTREF(__pyx_t_5);
  11619. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
  11620. __Pyx_GOTREF(__pyx_t_6);
  11621. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error)
  11622. __Pyx_GOTREF(__pyx_t_7);
  11623. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11624. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11625. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DeltaSegment, __pyx_t_7) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  11626. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11627. /* "fontTools/varLib/iup.py":23
  11628. * _PointSegment = Sequence[_Point]
  11629. * _DeltaSegment = Sequence[_Delta]
  11630. * _DeltaOrNone = Union[_Delta, None] # <<<<<<<<<<<<<<
  11631. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  11632. * _Endpoints = Sequence[Integral]
  11633. */
  11634. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Union); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 23, __pyx_L1_error)
  11635. __Pyx_GOTREF(__pyx_t_7);
  11636. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Delta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
  11637. __Pyx_GOTREF(__pyx_t_6);
  11638. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
  11639. __Pyx_GOTREF(__pyx_t_5);
  11640. __Pyx_GIVEREF(__pyx_t_6);
  11641. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error);
  11642. __Pyx_INCREF(Py_None);
  11643. __Pyx_GIVEREF(Py_None);
  11644. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, Py_None)) __PYX_ERR(0, 23, __pyx_L1_error);
  11645. __pyx_t_6 = 0;
  11646. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
  11647. __Pyx_GOTREF(__pyx_t_6);
  11648. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11649. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11650. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DeltaOrNone, __pyx_t_6) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  11651. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11652. /* "fontTools/varLib/iup.py":24
  11653. * _DeltaSegment = Sequence[_Delta]
  11654. * _DeltaOrNone = Union[_Delta, None]
  11655. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone] # <<<<<<<<<<<<<<
  11656. * _Endpoints = Sequence[Integral]
  11657. *
  11658. */
  11659. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error)
  11660. __Pyx_GOTREF(__pyx_t_6);
  11661. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_DeltaOrNone); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
  11662. __Pyx_GOTREF(__pyx_t_5);
  11663. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 24, __pyx_L1_error)
  11664. __Pyx_GOTREF(__pyx_t_7);
  11665. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11666. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11667. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DeltaOrNoneSegment, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  11668. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11669. /* "fontTools/varLib/iup.py":25
  11670. * _DeltaOrNone = Union[_Delta, None]
  11671. * _DeltaOrNoneSegment = Sequence[_DeltaOrNone]
  11672. * _Endpoints = Sequence[Integral] # <<<<<<<<<<<<<<
  11673. *
  11674. *
  11675. */
  11676. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error)
  11677. __Pyx_GOTREF(__pyx_t_7);
  11678. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integral); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error)
  11679. __Pyx_GOTREF(__pyx_t_5);
  11680. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error)
  11681. __Pyx_GOTREF(__pyx_t_6);
  11682. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  11683. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11684. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Endpoints, __pyx_t_6) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  11685. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11686. /* "fontTools/varLib/iup.py":28
  11687. *
  11688. *
  11689. * MAX_LOOKBACK = 8 # <<<<<<<<<<<<<<
  11690. *
  11691. *
  11692. */
  11693. if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_LOOKBACK, __pyx_int_8) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  11694. /* "fontTools/varLib/iup.py":87
  11695. *
  11696. *
  11697. * def iup_contour(deltas: _DeltaOrNoneSegment, coords: _PointSegment) -> _DeltaSegment: # <<<<<<<<<<<<<<
  11698. * """For the contour given in `coords`, interpolate any missing
  11699. * delta values in delta vector `deltas`.
  11700. */
  11701. __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
  11702. __Pyx_GOTREF(__pyx_t_6);
  11703. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_deltas, __pyx_n_s_DeltaOrNoneSegment) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  11704. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  11705. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  11706. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_1iup_contour, 0, __pyx_n_s_iup_contour, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
  11707. __Pyx_GOTREF(__pyx_t_5);
  11708. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6);
  11709. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11710. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_contour, __pyx_t_5) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
  11711. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11712. /* "fontTools/varLib/iup.py":139
  11713. *
  11714. *
  11715. * def iup_delta( # <<<<<<<<<<<<<<
  11716. * deltas: _DeltaOrNoneSegment, coords: _PointSegment, ends: _Endpoints
  11717. * ) -> _DeltaSegment:
  11718. */
  11719. __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
  11720. __Pyx_GOTREF(__pyx_t_5);
  11721. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_deltas, __pyx_n_s_DeltaOrNoneSegment) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  11722. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  11723. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_ends, __pyx_n_s_Endpoints) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  11724. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  11725. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_3iup_delta, 0, __pyx_n_s_iup_delta, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 139, __pyx_L1_error)
  11726. __Pyx_GOTREF(__pyx_t_6);
  11727. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5);
  11728. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11729. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_delta, __pyx_t_6) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  11730. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11731. /* "fontTools/varLib/iup.py":198
  11732. *
  11733. *
  11734. * @cython.locals( # <<<<<<<<<<<<<<
  11735. * cj=cython.double,
  11736. * dj=cython.double,
  11737. */
  11738. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
  11739. __Pyx_GOTREF(__pyx_t_6);
  11740. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_deltas, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  11741. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  11742. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tolerance, __pyx_n_s_Real) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  11743. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_n_s_set) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  11744. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_5_iup_contour_bound_forced_set, 0, __pyx_n_s_iup_contour_bound_forced_set, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  11745. __Pyx_GOTREF(__pyx_t_5);
  11746. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__10);
  11747. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6);
  11748. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11749. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_contour_bound_forced_set, __pyx_t_5) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  11750. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11751. /* "fontTools/varLib/iup.py":289
  11752. *
  11753. *
  11754. * @cython.locals( # <<<<<<<<<<<<<<
  11755. * i=cython.int,
  11756. * j=cython.int,
  11757. */
  11758. __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
  11759. __Pyx_GOTREF(__pyx_t_5);
  11760. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_deltas, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  11761. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  11762. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_tolerance, __pyx_n_s_Real) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  11763. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_lookback, __pyx_n_s_Integral) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  11764. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_7_iup_contour_optimize_dp, 0, __pyx_n_s_iup_contour_optimize_dp, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error)
  11765. __Pyx_GOTREF(__pyx_t_6);
  11766. if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 289, __pyx_L1_error)
  11767. __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error)
  11768. __Pyx_GOTREF(__pyx_t_7);
  11769. __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_6)->__pyx_arg_forced = ((PyObject*)__pyx_t_7);
  11770. __Pyx_GIVEREF(__pyx_t_7);
  11771. __pyx_t_7 = 0;
  11772. __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_9fontTools_6varLib_3iup_16__defaults__);
  11773. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5);
  11774. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11775. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_contour_optimize_dp, __pyx_t_6) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  11776. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11777. /* "fontTools/varLib/iup.py":342
  11778. *
  11779. *
  11780. * def _rot_list(l: list, k: int): # <<<<<<<<<<<<<<
  11781. * """Rotate list by k items forward. Ie. item at position 0 will be
  11782. * at position k in returned list. Negative k is allowed."""
  11783. */
  11784. __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error)
  11785. __Pyx_GOTREF(__pyx_t_6);
  11786. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_l, __pyx_n_s_list) < 0) __PYX_ERR(0, 342, __pyx_L1_error)
  11787. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_k, __pyx_n_s_int) < 0) __PYX_ERR(0, 342, __pyx_L1_error)
  11788. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_9_rot_list, 0, __pyx_n_s_rot_list, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
  11789. __Pyx_GOTREF(__pyx_t_5);
  11790. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6);
  11791. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11792. if (PyDict_SetItem(__pyx_d, __pyx_n_s_rot_list, __pyx_t_5) < 0) __PYX_ERR(0, 342, __pyx_L1_error)
  11793. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11794. /* "fontTools/varLib/iup.py":352
  11795. *
  11796. *
  11797. * def _rot_set(s: set, k: int, n: int): # <<<<<<<<<<<<<<
  11798. * k %= n
  11799. * if not k:
  11800. */
  11801. __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error)
  11802. __Pyx_GOTREF(__pyx_t_5);
  11803. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_s, __pyx_n_s_set) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
  11804. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_k, __pyx_n_s_int) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
  11805. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_n, __pyx_n_s_int) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
  11806. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_11_rot_set, 0, __pyx_n_s_rot_set, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error)
  11807. __Pyx_GOTREF(__pyx_t_6);
  11808. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5);
  11809. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11810. if (PyDict_SetItem(__pyx_d, __pyx_n_s_rot_set, __pyx_t_6) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
  11811. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11812. /* "fontTools/varLib/iup.py":359
  11813. *
  11814. *
  11815. * def iup_contour_optimize( # <<<<<<<<<<<<<<
  11816. * deltas: _DeltaSegment, coords: _PointSegment, tolerance: Real = 0.0
  11817. * ) -> _DeltaOrNoneSegment:
  11818. */
  11819. __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L1_error)
  11820. __Pyx_GOTREF(__pyx_t_6);
  11821. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_deltas, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11822. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11823. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tolerance, __pyx_n_s_Real) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11824. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_n_s_DeltaOrNoneSegment) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11825. __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_13iup_contour_optimize, 0, __pyx_n_s_iup_contour_optimize, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error)
  11826. __Pyx_GOTREF(__pyx_t_5);
  11827. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__19);
  11828. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6);
  11829. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11830. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_contour_optimize, __pyx_t_5) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  11831. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11832. /* "fontTools/varLib/iup.py":460
  11833. *
  11834. *
  11835. * def iup_delta_optimize( # <<<<<<<<<<<<<<
  11836. * deltas: _DeltaSegment,
  11837. * coords: _PointSegment,
  11838. */
  11839. __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error)
  11840. __Pyx_GOTREF(__pyx_t_5);
  11841. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_deltas, __pyx_n_s_DeltaSegment) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11842. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_coords, __pyx_n_s_PointSegment) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11843. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_ends, __pyx_n_s_Endpoints) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11844. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_tolerance, __pyx_n_s_Real) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11845. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_s_DeltaOrNoneSegment) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11846. __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_6varLib_3iup_15iup_delta_optimize, 0, __pyx_n_s_iup_delta_optimize, NULL, __pyx_n_s_fontTools_varLib_iup, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 460, __pyx_L1_error)
  11847. __Pyx_GOTREF(__pyx_t_6);
  11848. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__19);
  11849. __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5);
  11850. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  11851. if (PyDict_SetItem(__pyx_d, __pyx_n_s_iup_delta_optimize, __pyx_t_6) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  11852. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11853. /* "fontTools/varLib/iup.py":1
  11854. * try: # <<<<<<<<<<<<<<
  11855. * import cython
  11856. *
  11857. */
  11858. __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  11859. __Pyx_GOTREF(__pyx_t_6);
  11860. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_6) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  11861. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11862. /*--- Wrapped vars code ---*/
  11863. goto __pyx_L0;
  11864. __pyx_L1_error:;
  11865. __Pyx_XDECREF(__pyx_t_5);
  11866. __Pyx_XDECREF(__pyx_t_6);
  11867. __Pyx_XDECREF(__pyx_t_7);
  11868. __Pyx_XDECREF(__pyx_t_8);
  11869. __Pyx_XDECREF(__pyx_t_9);
  11870. if (__pyx_m) {
  11871. if (__pyx_d && stringtab_initialized) {
  11872. __Pyx_AddTraceback("init fontTools.varLib.iup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11873. }
  11874. #if !CYTHON_USE_MODULE_STATE
  11875. Py_CLEAR(__pyx_m);
  11876. #else
  11877. Py_DECREF(__pyx_m);
  11878. if (pystate_addmodule_run) {
  11879. PyObject *tp, *value, *tb;
  11880. PyErr_Fetch(&tp, &value, &tb);
  11881. PyState_RemoveModule(&__pyx_moduledef);
  11882. PyErr_Restore(tp, value, tb);
  11883. }
  11884. #endif
  11885. } else if (!PyErr_Occurred()) {
  11886. PyErr_SetString(PyExc_ImportError, "init fontTools.varLib.iup");
  11887. }
  11888. __pyx_L0:;
  11889. __Pyx_RefNannyFinishContext();
  11890. #if CYTHON_PEP489_MULTI_PHASE_INIT
  11891. return (__pyx_m != NULL) ? 0 : -1;
  11892. #elif PY_MAJOR_VERSION >= 3
  11893. return __pyx_m;
  11894. #else
  11895. return;
  11896. #endif
  11897. }
  11898. /* #### Code section: cleanup_globals ### */
  11899. /* #### Code section: cleanup_module ### */
  11900. /* #### Code section: main_method ### */
  11901. /* #### Code section: utility_code_pragmas ### */
  11902. #ifdef _MSC_VER
  11903. #pragma warning( push )
  11904. /* Warning 4127: conditional expression is constant
  11905. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  11906. * compile-time, so this warning is not useful
  11907. */
  11908. #pragma warning( disable : 4127 )
  11909. #endif
  11910. /* #### Code section: utility_code_def ### */
  11911. /* --- Runtime support code --- */
  11912. /* Refnanny */
  11913. #if CYTHON_REFNANNY
  11914. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  11915. PyObject *m = NULL, *p = NULL;
  11916. void *r = NULL;
  11917. m = PyImport_ImportModule(modname);
  11918. if (!m) goto end;
  11919. p = PyObject_GetAttrString(m, "RefNannyAPI");
  11920. if (!p) goto end;
  11921. r = PyLong_AsVoidPtr(p);
  11922. end:
  11923. Py_XDECREF(p);
  11924. Py_XDECREF(m);
  11925. return (__Pyx_RefNannyAPIStruct *)r;
  11926. }
  11927. #endif
  11928. /* PyErrExceptionMatches */
  11929. #if CYTHON_FAST_THREAD_STATE
  11930. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  11931. Py_ssize_t i, n;
  11932. n = PyTuple_GET_SIZE(tuple);
  11933. #if PY_MAJOR_VERSION >= 3
  11934. for (i=0; i<n; i++) {
  11935. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  11936. }
  11937. #endif
  11938. for (i=0; i<n; i++) {
  11939. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  11940. }
  11941. return 0;
  11942. }
  11943. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  11944. int result;
  11945. PyObject *exc_type;
  11946. #if PY_VERSION_HEX >= 0x030C00A6
  11947. PyObject *current_exception = tstate->current_exception;
  11948. if (unlikely(!current_exception)) return 0;
  11949. exc_type = (PyObject*) Py_TYPE(current_exception);
  11950. if (exc_type == err) return 1;
  11951. #else
  11952. exc_type = tstate->curexc_type;
  11953. if (exc_type == err) return 1;
  11954. if (unlikely(!exc_type)) return 0;
  11955. #endif
  11956. #if CYTHON_AVOID_BORROWED_REFS
  11957. Py_INCREF(exc_type);
  11958. #endif
  11959. if (unlikely(PyTuple_Check(err))) {
  11960. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  11961. } else {
  11962. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  11963. }
  11964. #if CYTHON_AVOID_BORROWED_REFS
  11965. Py_DECREF(exc_type);
  11966. #endif
  11967. return result;
  11968. }
  11969. #endif
  11970. /* PyErrFetchRestore */
  11971. #if CYTHON_FAST_THREAD_STATE
  11972. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  11973. #if PY_VERSION_HEX >= 0x030C00A6
  11974. PyObject *tmp_value;
  11975. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  11976. if (value) {
  11977. #if CYTHON_COMPILING_IN_CPYTHON
  11978. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  11979. #endif
  11980. PyException_SetTraceback(value, tb);
  11981. }
  11982. tmp_value = tstate->current_exception;
  11983. tstate->current_exception = value;
  11984. Py_XDECREF(tmp_value);
  11985. Py_XDECREF(type);
  11986. Py_XDECREF(tb);
  11987. #else
  11988. PyObject *tmp_type, *tmp_value, *tmp_tb;
  11989. tmp_type = tstate->curexc_type;
  11990. tmp_value = tstate->curexc_value;
  11991. tmp_tb = tstate->curexc_traceback;
  11992. tstate->curexc_type = type;
  11993. tstate->curexc_value = value;
  11994. tstate->curexc_traceback = tb;
  11995. Py_XDECREF(tmp_type);
  11996. Py_XDECREF(tmp_value);
  11997. Py_XDECREF(tmp_tb);
  11998. #endif
  11999. }
  12000. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  12001. #if PY_VERSION_HEX >= 0x030C00A6
  12002. PyObject* exc_value;
  12003. exc_value = tstate->current_exception;
  12004. tstate->current_exception = 0;
  12005. *value = exc_value;
  12006. *type = NULL;
  12007. *tb = NULL;
  12008. if (exc_value) {
  12009. *type = (PyObject*) Py_TYPE(exc_value);
  12010. Py_INCREF(*type);
  12011. #if CYTHON_COMPILING_IN_CPYTHON
  12012. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  12013. Py_XINCREF(*tb);
  12014. #else
  12015. *tb = PyException_GetTraceback(exc_value);
  12016. #endif
  12017. }
  12018. #else
  12019. *type = tstate->curexc_type;
  12020. *value = tstate->curexc_value;
  12021. *tb = tstate->curexc_traceback;
  12022. tstate->curexc_type = 0;
  12023. tstate->curexc_value = 0;
  12024. tstate->curexc_traceback = 0;
  12025. #endif
  12026. }
  12027. #endif
  12028. /* PyObjectGetAttrStr */
  12029. #if CYTHON_USE_TYPE_SLOTS
  12030. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  12031. PyTypeObject* tp = Py_TYPE(obj);
  12032. if (likely(tp->tp_getattro))
  12033. return tp->tp_getattro(obj, attr_name);
  12034. #if PY_MAJOR_VERSION < 3
  12035. if (likely(tp->tp_getattr))
  12036. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  12037. #endif
  12038. return PyObject_GetAttr(obj, attr_name);
  12039. }
  12040. #endif
  12041. /* PyObjectGetAttrStrNoError */
  12042. #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
  12043. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  12044. __Pyx_PyThreadState_declare
  12045. __Pyx_PyThreadState_assign
  12046. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  12047. __Pyx_PyErr_Clear();
  12048. }
  12049. #endif
  12050. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  12051. PyObject *result;
  12052. #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
  12053. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  12054. return result;
  12055. #else
  12056. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
  12057. PyTypeObject* tp = Py_TYPE(obj);
  12058. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  12059. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  12060. }
  12061. #endif
  12062. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  12063. if (unlikely(!result)) {
  12064. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  12065. }
  12066. return result;
  12067. #endif
  12068. }
  12069. /* GetBuiltinName */
  12070. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  12071. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
  12072. if (unlikely(!result) && !PyErr_Occurred()) {
  12073. PyErr_Format(PyExc_NameError,
  12074. #if PY_MAJOR_VERSION >= 3
  12075. "name '%U' is not defined", name);
  12076. #else
  12077. "name '%.200s' is not defined", PyString_AS_STRING(name));
  12078. #endif
  12079. }
  12080. return result;
  12081. }
  12082. /* SetItemInt */
  12083. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  12084. int r;
  12085. if (unlikely(!j)) return -1;
  12086. r = PyObject_SetItem(o, j, v);
  12087. Py_DECREF(j);
  12088. return r;
  12089. }
  12090. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  12091. CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
  12092. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  12093. if (is_list || PyList_CheckExact(o)) {
  12094. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  12095. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  12096. PyObject* old = PyList_GET_ITEM(o, n);
  12097. Py_INCREF(v);
  12098. PyList_SET_ITEM(o, n, v);
  12099. Py_DECREF(old);
  12100. return 1;
  12101. }
  12102. } else {
  12103. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  12104. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  12105. if (mm && mm->mp_ass_subscript) {
  12106. int r;
  12107. PyObject *key = PyInt_FromSsize_t(i);
  12108. if (unlikely(!key)) return -1;
  12109. r = mm->mp_ass_subscript(o, key, v);
  12110. Py_DECREF(key);
  12111. return r;
  12112. }
  12113. if (likely(sm && sm->sq_ass_item)) {
  12114. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  12115. Py_ssize_t l = sm->sq_length(o);
  12116. if (likely(l >= 0)) {
  12117. i += l;
  12118. } else {
  12119. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  12120. return -1;
  12121. PyErr_Clear();
  12122. }
  12123. }
  12124. return sm->sq_ass_item(o, i, v);
  12125. }
  12126. }
  12127. #else
  12128. if (is_list || !PyMapping_Check(o))
  12129. {
  12130. return PySequence_SetItem(o, i, v);
  12131. }
  12132. #endif
  12133. return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
  12134. }
  12135. /* GetItemInt */
  12136. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  12137. PyObject *r;
  12138. if (unlikely(!j)) return NULL;
  12139. r = PyObject_GetItem(o, j);
  12140. Py_DECREF(j);
  12141. return r;
  12142. }
  12143. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  12144. CYTHON_NCP_UNUSED int wraparound,
  12145. CYTHON_NCP_UNUSED int boundscheck) {
  12146. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12147. Py_ssize_t wrapped_i = i;
  12148. if (wraparound & unlikely(i < 0)) {
  12149. wrapped_i += PyList_GET_SIZE(o);
  12150. }
  12151. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  12152. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  12153. Py_INCREF(r);
  12154. return r;
  12155. }
  12156. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  12157. #else
  12158. return PySequence_GetItem(o, i);
  12159. #endif
  12160. }
  12161. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  12162. CYTHON_NCP_UNUSED int wraparound,
  12163. CYTHON_NCP_UNUSED int boundscheck) {
  12164. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12165. Py_ssize_t wrapped_i = i;
  12166. if (wraparound & unlikely(i < 0)) {
  12167. wrapped_i += PyTuple_GET_SIZE(o);
  12168. }
  12169. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  12170. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  12171. Py_INCREF(r);
  12172. return r;
  12173. }
  12174. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  12175. #else
  12176. return PySequence_GetItem(o, i);
  12177. #endif
  12178. }
  12179. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  12180. CYTHON_NCP_UNUSED int wraparound,
  12181. CYTHON_NCP_UNUSED int boundscheck) {
  12182. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  12183. if (is_list || PyList_CheckExact(o)) {
  12184. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  12185. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  12186. PyObject *r = PyList_GET_ITEM(o, n);
  12187. Py_INCREF(r);
  12188. return r;
  12189. }
  12190. }
  12191. else if (PyTuple_CheckExact(o)) {
  12192. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  12193. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  12194. PyObject *r = PyTuple_GET_ITEM(o, n);
  12195. Py_INCREF(r);
  12196. return r;
  12197. }
  12198. } else {
  12199. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  12200. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  12201. if (mm && mm->mp_subscript) {
  12202. PyObject *r, *key = PyInt_FromSsize_t(i);
  12203. if (unlikely(!key)) return NULL;
  12204. r = mm->mp_subscript(o, key);
  12205. Py_DECREF(key);
  12206. return r;
  12207. }
  12208. if (likely(sm && sm->sq_item)) {
  12209. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  12210. Py_ssize_t l = sm->sq_length(o);
  12211. if (likely(l >= 0)) {
  12212. i += l;
  12213. } else {
  12214. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  12215. return NULL;
  12216. PyErr_Clear();
  12217. }
  12218. }
  12219. return sm->sq_item(o, i);
  12220. }
  12221. }
  12222. #else
  12223. if (is_list || !PyMapping_Check(o)) {
  12224. return PySequence_GetItem(o, i);
  12225. }
  12226. #endif
  12227. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  12228. }
  12229. /* PyObjectCall */
  12230. #if CYTHON_COMPILING_IN_CPYTHON
  12231. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  12232. PyObject *result;
  12233. ternaryfunc call = Py_TYPE(func)->tp_call;
  12234. if (unlikely(!call))
  12235. return PyObject_Call(func, arg, kw);
  12236. #if PY_MAJOR_VERSION < 3
  12237. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  12238. return NULL;
  12239. #else
  12240. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  12241. return NULL;
  12242. #endif
  12243. result = (*call)(func, arg, kw);
  12244. Py_LeaveRecursiveCall();
  12245. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  12246. PyErr_SetString(
  12247. PyExc_SystemError,
  12248. "NULL result without error in PyObject_Call");
  12249. }
  12250. return result;
  12251. }
  12252. #endif
  12253. /* TupleAndListFromArray */
  12254. #if CYTHON_COMPILING_IN_CPYTHON
  12255. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  12256. PyObject *v;
  12257. Py_ssize_t i;
  12258. for (i = 0; i < length; i++) {
  12259. v = dest[i] = src[i];
  12260. Py_INCREF(v);
  12261. }
  12262. }
  12263. static CYTHON_INLINE PyObject *
  12264. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  12265. {
  12266. PyObject *res;
  12267. if (n <= 0) {
  12268. Py_INCREF(__pyx_empty_tuple);
  12269. return __pyx_empty_tuple;
  12270. }
  12271. res = PyTuple_New(n);
  12272. if (unlikely(res == NULL)) return NULL;
  12273. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  12274. return res;
  12275. }
  12276. static CYTHON_INLINE PyObject *
  12277. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  12278. {
  12279. PyObject *res;
  12280. if (n <= 0) {
  12281. return PyList_New(0);
  12282. }
  12283. res = PyList_New(n);
  12284. if (unlikely(res == NULL)) return NULL;
  12285. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  12286. return res;
  12287. }
  12288. #endif
  12289. /* BytesEquals */
  12290. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  12291. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  12292. return PyObject_RichCompareBool(s1, s2, equals);
  12293. #else
  12294. if (s1 == s2) {
  12295. return (equals == Py_EQ);
  12296. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  12297. const char *ps1, *ps2;
  12298. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  12299. if (length != PyBytes_GET_SIZE(s2))
  12300. return (equals == Py_NE);
  12301. ps1 = PyBytes_AS_STRING(s1);
  12302. ps2 = PyBytes_AS_STRING(s2);
  12303. if (ps1[0] != ps2[0]) {
  12304. return (equals == Py_NE);
  12305. } else if (length == 1) {
  12306. return (equals == Py_EQ);
  12307. } else {
  12308. int result;
  12309. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  12310. Py_hash_t hash1, hash2;
  12311. hash1 = ((PyBytesObject*)s1)->ob_shash;
  12312. hash2 = ((PyBytesObject*)s2)->ob_shash;
  12313. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  12314. return (equals == Py_NE);
  12315. }
  12316. #endif
  12317. result = memcmp(ps1, ps2, (size_t)length);
  12318. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  12319. }
  12320. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  12321. return (equals == Py_NE);
  12322. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  12323. return (equals == Py_NE);
  12324. } else {
  12325. int result;
  12326. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  12327. if (!py_result)
  12328. return -1;
  12329. result = __Pyx_PyObject_IsTrue(py_result);
  12330. Py_DECREF(py_result);
  12331. return result;
  12332. }
  12333. #endif
  12334. }
  12335. /* UnicodeEquals */
  12336. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  12337. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  12338. return PyObject_RichCompareBool(s1, s2, equals);
  12339. #else
  12340. #if PY_MAJOR_VERSION < 3
  12341. PyObject* owned_ref = NULL;
  12342. #endif
  12343. int s1_is_unicode, s2_is_unicode;
  12344. if (s1 == s2) {
  12345. goto return_eq;
  12346. }
  12347. s1_is_unicode = PyUnicode_CheckExact(s1);
  12348. s2_is_unicode = PyUnicode_CheckExact(s2);
  12349. #if PY_MAJOR_VERSION < 3
  12350. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  12351. owned_ref = PyUnicode_FromObject(s2);
  12352. if (unlikely(!owned_ref))
  12353. return -1;
  12354. s2 = owned_ref;
  12355. s2_is_unicode = 1;
  12356. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  12357. owned_ref = PyUnicode_FromObject(s1);
  12358. if (unlikely(!owned_ref))
  12359. return -1;
  12360. s1 = owned_ref;
  12361. s1_is_unicode = 1;
  12362. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  12363. return __Pyx_PyBytes_Equals(s1, s2, equals);
  12364. }
  12365. #endif
  12366. if (s1_is_unicode & s2_is_unicode) {
  12367. Py_ssize_t length;
  12368. int kind;
  12369. void *data1, *data2;
  12370. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  12371. return -1;
  12372. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  12373. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  12374. goto return_ne;
  12375. }
  12376. #if CYTHON_USE_UNICODE_INTERNALS
  12377. {
  12378. Py_hash_t hash1, hash2;
  12379. #if CYTHON_PEP393_ENABLED
  12380. hash1 = ((PyASCIIObject*)s1)->hash;
  12381. hash2 = ((PyASCIIObject*)s2)->hash;
  12382. #else
  12383. hash1 = ((PyUnicodeObject*)s1)->hash;
  12384. hash2 = ((PyUnicodeObject*)s2)->hash;
  12385. #endif
  12386. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  12387. goto return_ne;
  12388. }
  12389. }
  12390. #endif
  12391. kind = __Pyx_PyUnicode_KIND(s1);
  12392. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  12393. goto return_ne;
  12394. }
  12395. data1 = __Pyx_PyUnicode_DATA(s1);
  12396. data2 = __Pyx_PyUnicode_DATA(s2);
  12397. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  12398. goto return_ne;
  12399. } else if (length == 1) {
  12400. goto return_eq;
  12401. } else {
  12402. int result = memcmp(data1, data2, (size_t)(length * kind));
  12403. #if PY_MAJOR_VERSION < 3
  12404. Py_XDECREF(owned_ref);
  12405. #endif
  12406. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  12407. }
  12408. } else if ((s1 == Py_None) & s2_is_unicode) {
  12409. goto return_ne;
  12410. } else if ((s2 == Py_None) & s1_is_unicode) {
  12411. goto return_ne;
  12412. } else {
  12413. int result;
  12414. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  12415. #if PY_MAJOR_VERSION < 3
  12416. Py_XDECREF(owned_ref);
  12417. #endif
  12418. if (!py_result)
  12419. return -1;
  12420. result = __Pyx_PyObject_IsTrue(py_result);
  12421. Py_DECREF(py_result);
  12422. return result;
  12423. }
  12424. return_eq:
  12425. #if PY_MAJOR_VERSION < 3
  12426. Py_XDECREF(owned_ref);
  12427. #endif
  12428. return (equals == Py_EQ);
  12429. return_ne:
  12430. #if PY_MAJOR_VERSION < 3
  12431. Py_XDECREF(owned_ref);
  12432. #endif
  12433. return (equals == Py_NE);
  12434. #endif
  12435. }
  12436. /* fastcall */
  12437. #if CYTHON_METH_FASTCALL
  12438. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  12439. {
  12440. Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
  12441. for (i = 0; i < n; i++)
  12442. {
  12443. if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
  12444. }
  12445. for (i = 0; i < n; i++)
  12446. {
  12447. int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
  12448. if (unlikely(eq != 0)) {
  12449. if (unlikely(eq < 0)) return NULL; // error
  12450. return kwvalues[i];
  12451. }
  12452. }
  12453. return NULL; // not found (no exception set)
  12454. }
  12455. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  12456. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  12457. Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
  12458. PyObject *dict;
  12459. dict = PyDict_New();
  12460. if (unlikely(!dict))
  12461. return NULL;
  12462. for (i=0; i<nkwargs; i++) {
  12463. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  12464. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  12465. goto bad;
  12466. }
  12467. return dict;
  12468. bad:
  12469. Py_DECREF(dict);
  12470. return NULL;
  12471. }
  12472. #endif
  12473. #endif
  12474. /* RaiseArgTupleInvalid */
  12475. static void __Pyx_RaiseArgtupleInvalid(
  12476. const char* func_name,
  12477. int exact,
  12478. Py_ssize_t num_min,
  12479. Py_ssize_t num_max,
  12480. Py_ssize_t num_found)
  12481. {
  12482. Py_ssize_t num_expected;
  12483. const char *more_or_less;
  12484. if (num_found < num_min) {
  12485. num_expected = num_min;
  12486. more_or_less = "at least";
  12487. } else {
  12488. num_expected = num_max;
  12489. more_or_less = "at most";
  12490. }
  12491. if (exact) {
  12492. more_or_less = "exactly";
  12493. }
  12494. PyErr_Format(PyExc_TypeError,
  12495. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  12496. func_name, more_or_less, num_expected,
  12497. (num_expected == 1) ? "" : "s", num_found);
  12498. }
  12499. /* RaiseDoubleKeywords */
  12500. static void __Pyx_RaiseDoubleKeywordsError(
  12501. const char* func_name,
  12502. PyObject* kw_name)
  12503. {
  12504. PyErr_Format(PyExc_TypeError,
  12505. #if PY_MAJOR_VERSION >= 3
  12506. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  12507. #else
  12508. "%s() got multiple values for keyword argument '%s'", func_name,
  12509. PyString_AsString(kw_name));
  12510. #endif
  12511. }
  12512. /* ParseKeywords */
  12513. static int __Pyx_ParseOptionalKeywords(
  12514. PyObject *kwds,
  12515. PyObject *const *kwvalues,
  12516. PyObject **argnames[],
  12517. PyObject *kwds2,
  12518. PyObject *values[],
  12519. Py_ssize_t num_pos_args,
  12520. const char* function_name)
  12521. {
  12522. PyObject *key = 0, *value = 0;
  12523. Py_ssize_t pos = 0;
  12524. PyObject*** name;
  12525. PyObject*** first_kw_arg = argnames + num_pos_args;
  12526. int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
  12527. while (1) {
  12528. Py_XDECREF(key); key = NULL;
  12529. Py_XDECREF(value); value = NULL;
  12530. if (kwds_is_tuple) {
  12531. Py_ssize_t size;
  12532. #if CYTHON_ASSUME_SAFE_MACROS
  12533. size = PyTuple_GET_SIZE(kwds);
  12534. #else
  12535. size = PyTuple_Size(kwds);
  12536. if (size < 0) goto bad;
  12537. #endif
  12538. if (pos >= size) break;
  12539. #if CYTHON_AVOID_BORROWED_REFS
  12540. key = __Pyx_PySequence_ITEM(kwds, pos);
  12541. if (!key) goto bad;
  12542. #elif CYTHON_ASSUME_SAFE_MACROS
  12543. key = PyTuple_GET_ITEM(kwds, pos);
  12544. #else
  12545. key = PyTuple_GetItem(kwds, pos);
  12546. if (!key) goto bad;
  12547. #endif
  12548. value = kwvalues[pos];
  12549. pos++;
  12550. }
  12551. else
  12552. {
  12553. if (!PyDict_Next(kwds, &pos, &key, &value)) break;
  12554. #if CYTHON_AVOID_BORROWED_REFS
  12555. Py_INCREF(key);
  12556. #endif
  12557. }
  12558. name = first_kw_arg;
  12559. while (*name && (**name != key)) name++;
  12560. if (*name) {
  12561. values[name-argnames] = value;
  12562. #if CYTHON_AVOID_BORROWED_REFS
  12563. Py_INCREF(value); // transfer ownership of value to values
  12564. Py_DECREF(key);
  12565. #endif
  12566. key = NULL;
  12567. value = NULL;
  12568. continue;
  12569. }
  12570. #if !CYTHON_AVOID_BORROWED_REFS
  12571. Py_INCREF(key);
  12572. #endif
  12573. Py_INCREF(value);
  12574. name = first_kw_arg;
  12575. #if PY_MAJOR_VERSION < 3
  12576. if (likely(PyString_Check(key))) {
  12577. while (*name) {
  12578. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  12579. && _PyString_Eq(**name, key)) {
  12580. values[name-argnames] = value;
  12581. #if CYTHON_AVOID_BORROWED_REFS
  12582. value = NULL; // ownership transferred to values
  12583. #endif
  12584. break;
  12585. }
  12586. name++;
  12587. }
  12588. if (*name) continue;
  12589. else {
  12590. PyObject*** argname = argnames;
  12591. while (argname != first_kw_arg) {
  12592. if ((**argname == key) || (
  12593. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  12594. && _PyString_Eq(**argname, key))) {
  12595. goto arg_passed_twice;
  12596. }
  12597. argname++;
  12598. }
  12599. }
  12600. } else
  12601. #endif
  12602. if (likely(PyUnicode_Check(key))) {
  12603. while (*name) {
  12604. int cmp = (
  12605. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  12606. (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  12607. #endif
  12608. PyUnicode_Compare(**name, key)
  12609. );
  12610. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12611. if (cmp == 0) {
  12612. values[name-argnames] = value;
  12613. #if CYTHON_AVOID_BORROWED_REFS
  12614. value = NULL; // ownership transferred to values
  12615. #endif
  12616. break;
  12617. }
  12618. name++;
  12619. }
  12620. if (*name) continue;
  12621. else {
  12622. PyObject*** argname = argnames;
  12623. while (argname != first_kw_arg) {
  12624. int cmp = (**argname == key) ? 0 :
  12625. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  12626. (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  12627. #endif
  12628. PyUnicode_Compare(**argname, key);
  12629. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  12630. if (cmp == 0) goto arg_passed_twice;
  12631. argname++;
  12632. }
  12633. }
  12634. } else
  12635. goto invalid_keyword_type;
  12636. if (kwds2) {
  12637. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  12638. } else {
  12639. goto invalid_keyword;
  12640. }
  12641. }
  12642. Py_XDECREF(key);
  12643. Py_XDECREF(value);
  12644. return 0;
  12645. arg_passed_twice:
  12646. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  12647. goto bad;
  12648. invalid_keyword_type:
  12649. PyErr_Format(PyExc_TypeError,
  12650. "%.200s() keywords must be strings", function_name);
  12651. goto bad;
  12652. invalid_keyword:
  12653. #if PY_MAJOR_VERSION < 3
  12654. PyErr_Format(PyExc_TypeError,
  12655. "%.200s() got an unexpected keyword argument '%.200s'",
  12656. function_name, PyString_AsString(key));
  12657. #else
  12658. PyErr_Format(PyExc_TypeError,
  12659. "%s() got an unexpected keyword argument '%U'",
  12660. function_name, key);
  12661. #endif
  12662. bad:
  12663. Py_XDECREF(key);
  12664. Py_XDECREF(value);
  12665. return -1;
  12666. }
  12667. /* RaiseException */
  12668. #if PY_MAJOR_VERSION < 3
  12669. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  12670. __Pyx_PyThreadState_declare
  12671. CYTHON_UNUSED_VAR(cause);
  12672. Py_XINCREF(type);
  12673. if (!value || value == Py_None)
  12674. value = NULL;
  12675. else
  12676. Py_INCREF(value);
  12677. if (!tb || tb == Py_None)
  12678. tb = NULL;
  12679. else {
  12680. Py_INCREF(tb);
  12681. if (!PyTraceBack_Check(tb)) {
  12682. PyErr_SetString(PyExc_TypeError,
  12683. "raise: arg 3 must be a traceback or None");
  12684. goto raise_error;
  12685. }
  12686. }
  12687. if (PyType_Check(type)) {
  12688. #if CYTHON_COMPILING_IN_PYPY
  12689. if (!value) {
  12690. Py_INCREF(Py_None);
  12691. value = Py_None;
  12692. }
  12693. #endif
  12694. PyErr_NormalizeException(&type, &value, &tb);
  12695. } else {
  12696. if (value) {
  12697. PyErr_SetString(PyExc_TypeError,
  12698. "instance exception may not have a separate value");
  12699. goto raise_error;
  12700. }
  12701. value = type;
  12702. type = (PyObject*) Py_TYPE(type);
  12703. Py_INCREF(type);
  12704. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  12705. PyErr_SetString(PyExc_TypeError,
  12706. "raise: exception class must be a subclass of BaseException");
  12707. goto raise_error;
  12708. }
  12709. }
  12710. __Pyx_PyThreadState_assign
  12711. __Pyx_ErrRestore(type, value, tb);
  12712. return;
  12713. raise_error:
  12714. Py_XDECREF(value);
  12715. Py_XDECREF(type);
  12716. Py_XDECREF(tb);
  12717. return;
  12718. }
  12719. #else
  12720. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  12721. PyObject* owned_instance = NULL;
  12722. if (tb == Py_None) {
  12723. tb = 0;
  12724. } else if (tb && !PyTraceBack_Check(tb)) {
  12725. PyErr_SetString(PyExc_TypeError,
  12726. "raise: arg 3 must be a traceback or None");
  12727. goto bad;
  12728. }
  12729. if (value == Py_None)
  12730. value = 0;
  12731. if (PyExceptionInstance_Check(type)) {
  12732. if (value) {
  12733. PyErr_SetString(PyExc_TypeError,
  12734. "instance exception may not have a separate value");
  12735. goto bad;
  12736. }
  12737. value = type;
  12738. type = (PyObject*) Py_TYPE(value);
  12739. } else if (PyExceptionClass_Check(type)) {
  12740. PyObject *instance_class = NULL;
  12741. if (value && PyExceptionInstance_Check(value)) {
  12742. instance_class = (PyObject*) Py_TYPE(value);
  12743. if (instance_class != type) {
  12744. int is_subclass = PyObject_IsSubclass(instance_class, type);
  12745. if (!is_subclass) {
  12746. instance_class = NULL;
  12747. } else if (unlikely(is_subclass == -1)) {
  12748. goto bad;
  12749. } else {
  12750. type = instance_class;
  12751. }
  12752. }
  12753. }
  12754. if (!instance_class) {
  12755. PyObject *args;
  12756. if (!value)
  12757. args = PyTuple_New(0);
  12758. else if (PyTuple_Check(value)) {
  12759. Py_INCREF(value);
  12760. args = value;
  12761. } else
  12762. args = PyTuple_Pack(1, value);
  12763. if (!args)
  12764. goto bad;
  12765. owned_instance = PyObject_Call(type, args, NULL);
  12766. Py_DECREF(args);
  12767. if (!owned_instance)
  12768. goto bad;
  12769. value = owned_instance;
  12770. if (!PyExceptionInstance_Check(value)) {
  12771. PyErr_Format(PyExc_TypeError,
  12772. "calling %R should have returned an instance of "
  12773. "BaseException, not %R",
  12774. type, Py_TYPE(value));
  12775. goto bad;
  12776. }
  12777. }
  12778. } else {
  12779. PyErr_SetString(PyExc_TypeError,
  12780. "raise: exception class must be a subclass of BaseException");
  12781. goto bad;
  12782. }
  12783. if (cause) {
  12784. PyObject *fixed_cause;
  12785. if (cause == Py_None) {
  12786. fixed_cause = NULL;
  12787. } else if (PyExceptionClass_Check(cause)) {
  12788. fixed_cause = PyObject_CallObject(cause, NULL);
  12789. if (fixed_cause == NULL)
  12790. goto bad;
  12791. } else if (PyExceptionInstance_Check(cause)) {
  12792. fixed_cause = cause;
  12793. Py_INCREF(fixed_cause);
  12794. } else {
  12795. PyErr_SetString(PyExc_TypeError,
  12796. "exception causes must derive from "
  12797. "BaseException");
  12798. goto bad;
  12799. }
  12800. PyException_SetCause(value, fixed_cause);
  12801. }
  12802. PyErr_SetObject(type, value);
  12803. if (tb) {
  12804. #if PY_VERSION_HEX >= 0x030C00A6
  12805. PyException_SetTraceback(value, tb);
  12806. #elif CYTHON_FAST_THREAD_STATE
  12807. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  12808. PyObject* tmp_tb = tstate->curexc_traceback;
  12809. if (tb != tmp_tb) {
  12810. Py_INCREF(tb);
  12811. tstate->curexc_traceback = tb;
  12812. Py_XDECREF(tmp_tb);
  12813. }
  12814. #else
  12815. PyObject *tmp_type, *tmp_value, *tmp_tb;
  12816. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  12817. Py_INCREF(tb);
  12818. PyErr_Restore(tmp_type, tmp_value, tb);
  12819. Py_XDECREF(tmp_tb);
  12820. #endif
  12821. }
  12822. bad:
  12823. Py_XDECREF(owned_instance);
  12824. return;
  12825. }
  12826. #endif
  12827. /* PyIntBinop */
  12828. #if !CYTHON_COMPILING_IN_PYPY
  12829. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  12830. CYTHON_MAYBE_UNUSED_VAR(intval);
  12831. CYTHON_MAYBE_UNUSED_VAR(inplace);
  12832. CYTHON_UNUSED_VAR(zerodivision_check);
  12833. #if PY_MAJOR_VERSION < 3
  12834. if (likely(PyInt_CheckExact(op1))) {
  12835. const long b = intval;
  12836. long x;
  12837. long a = PyInt_AS_LONG(op1);
  12838. x = (long)((unsigned long)a + (unsigned long)b);
  12839. if (likely((x^a) >= 0 || (x^b) >= 0))
  12840. return PyInt_FromLong(x);
  12841. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  12842. }
  12843. #endif
  12844. #if CYTHON_USE_PYLONG_INTERNALS
  12845. if (likely(PyLong_CheckExact(op1))) {
  12846. const long b = intval;
  12847. long a, x;
  12848. #ifdef HAVE_LONG_LONG
  12849. const PY_LONG_LONG llb = intval;
  12850. PY_LONG_LONG lla, llx;
  12851. #endif
  12852. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  12853. return __Pyx_NewRef(op2);
  12854. }
  12855. if (likely(__Pyx_PyLong_IsCompact(op1))) {
  12856. a = __Pyx_PyLong_CompactValue(op1);
  12857. } else {
  12858. const digit* digits = __Pyx_PyLong_Digits(op1);
  12859. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  12860. switch (size) {
  12861. case -2:
  12862. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  12863. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12864. break;
  12865. #ifdef HAVE_LONG_LONG
  12866. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  12867. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  12868. goto long_long;
  12869. #endif
  12870. }
  12871. CYTHON_FALLTHROUGH;
  12872. case 2:
  12873. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  12874. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12875. break;
  12876. #ifdef HAVE_LONG_LONG
  12877. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  12878. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  12879. goto long_long;
  12880. #endif
  12881. }
  12882. CYTHON_FALLTHROUGH;
  12883. case -3:
  12884. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  12885. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12886. break;
  12887. #ifdef HAVE_LONG_LONG
  12888. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  12889. 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]));
  12890. goto long_long;
  12891. #endif
  12892. }
  12893. CYTHON_FALLTHROUGH;
  12894. case 3:
  12895. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  12896. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12897. break;
  12898. #ifdef HAVE_LONG_LONG
  12899. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  12900. 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]));
  12901. goto long_long;
  12902. #endif
  12903. }
  12904. CYTHON_FALLTHROUGH;
  12905. case -4:
  12906. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  12907. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12908. break;
  12909. #ifdef HAVE_LONG_LONG
  12910. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  12911. 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]));
  12912. goto long_long;
  12913. #endif
  12914. }
  12915. CYTHON_FALLTHROUGH;
  12916. case 4:
  12917. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  12918. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  12919. break;
  12920. #ifdef HAVE_LONG_LONG
  12921. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  12922. 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]));
  12923. goto long_long;
  12924. #endif
  12925. }
  12926. CYTHON_FALLTHROUGH;
  12927. default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  12928. }
  12929. }
  12930. x = a + b;
  12931. return PyLong_FromLong(x);
  12932. #ifdef HAVE_LONG_LONG
  12933. long_long:
  12934. llx = lla + llb;
  12935. return PyLong_FromLongLong(llx);
  12936. #endif
  12937. }
  12938. #endif
  12939. if (PyFloat_CheckExact(op1)) {
  12940. const long b = intval;
  12941. #if CYTHON_COMPILING_IN_LIMITED_API
  12942. double a = __pyx_PyFloat_AsDouble(op1);
  12943. #else
  12944. double a = PyFloat_AS_DOUBLE(op1);
  12945. #endif
  12946. double result;
  12947. PyFPE_START_PROTECT("add", return NULL)
  12948. result = ((double)a) + (double)b;
  12949. PyFPE_END_PROTECT(result)
  12950. return PyFloat_FromDouble(result);
  12951. }
  12952. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  12953. }
  12954. #endif
  12955. /* IterNext */
  12956. static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
  12957. PyObject* exc_type;
  12958. __Pyx_PyThreadState_declare
  12959. __Pyx_PyThreadState_assign
  12960. exc_type = __Pyx_PyErr_CurrentExceptionType();
  12961. if (unlikely(exc_type)) {
  12962. if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  12963. return NULL;
  12964. __Pyx_PyErr_Clear();
  12965. Py_INCREF(defval);
  12966. return defval;
  12967. }
  12968. if (defval) {
  12969. Py_INCREF(defval);
  12970. return defval;
  12971. }
  12972. __Pyx_PyErr_SetNone(PyExc_StopIteration);
  12973. return NULL;
  12974. }
  12975. static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
  12976. __Pyx_TypeName iterator_type_name = __Pyx_PyType_GetName(Py_TYPE(iterator));
  12977. PyErr_Format(PyExc_TypeError,
  12978. __Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name);
  12979. __Pyx_DECREF_TypeName(iterator_type_name);
  12980. }
  12981. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
  12982. PyObject* next;
  12983. iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
  12984. if (likely(iternext)) {
  12985. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  12986. next = iternext(iterator);
  12987. if (likely(next))
  12988. return next;
  12989. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  12990. if (unlikely(iternext == &_PyObject_NextNotImplemented))
  12991. return NULL;
  12992. #endif
  12993. #else
  12994. next = PyIter_Next(iterator);
  12995. if (likely(next))
  12996. return next;
  12997. #endif
  12998. } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
  12999. __Pyx_PyIter_Next_ErrorNoIterator(iterator);
  13000. return NULL;
  13001. }
  13002. #if !CYTHON_USE_TYPE_SLOTS
  13003. else {
  13004. next = PyIter_Next(iterator);
  13005. if (likely(next))
  13006. return next;
  13007. }
  13008. #endif
  13009. return __Pyx_PyIter_Next2Default(defval);
  13010. }
  13011. /* PyIntCompare */
  13012. static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  13013. CYTHON_MAYBE_UNUSED_VAR(intval);
  13014. CYTHON_UNUSED_VAR(inplace);
  13015. if (op1 == op2) {
  13016. return 0;
  13017. }
  13018. #if PY_MAJOR_VERSION < 3
  13019. if (likely(PyInt_CheckExact(op1))) {
  13020. const long b = intval;
  13021. long a = PyInt_AS_LONG(op1);
  13022. return (a != b);
  13023. }
  13024. #endif
  13025. #if CYTHON_USE_PYLONG_INTERNALS
  13026. if (likely(PyLong_CheckExact(op1))) {
  13027. int unequal;
  13028. unsigned long uintval;
  13029. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  13030. const digit* digits = __Pyx_PyLong_Digits(op1);
  13031. if (intval == 0) {
  13032. return (__Pyx_PyLong_IsZero(op1) != 1);
  13033. } else if (intval < 0) {
  13034. if (__Pyx_PyLong_IsNonNeg(op1))
  13035. return 1;
  13036. intval = -intval;
  13037. } else {
  13038. if (__Pyx_PyLong_IsNeg(op1))
  13039. return 1;
  13040. }
  13041. uintval = (unsigned long) intval;
  13042. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  13043. if (uintval >> (PyLong_SHIFT * 4)) {
  13044. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13045. | (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));
  13046. } else
  13047. #endif
  13048. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  13049. if (uintval >> (PyLong_SHIFT * 3)) {
  13050. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13051. | (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));
  13052. } else
  13053. #endif
  13054. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  13055. if (uintval >> (PyLong_SHIFT * 2)) {
  13056. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13057. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13058. } else
  13059. #endif
  13060. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  13061. if (uintval >> (PyLong_SHIFT * 1)) {
  13062. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  13063. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  13064. } else
  13065. #endif
  13066. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  13067. return (unequal != 0);
  13068. }
  13069. #endif
  13070. if (PyFloat_CheckExact(op1)) {
  13071. const long b = intval;
  13072. #if CYTHON_COMPILING_IN_LIMITED_API
  13073. double a = __pyx_PyFloat_AsDouble(op1);
  13074. #else
  13075. double a = PyFloat_AS_DOUBLE(op1);
  13076. #endif
  13077. return ((double)a != (double)b);
  13078. }
  13079. return __Pyx_PyObject_IsTrueAndDecref(
  13080. PyObject_RichCompare(op1, op2, Py_NE));
  13081. }
  13082. /* SliceObject */
  13083. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  13084. Py_ssize_t cstart, Py_ssize_t cstop,
  13085. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  13086. int has_cstart, int has_cstop, int wraparound) {
  13087. __Pyx_TypeName obj_type_name;
  13088. #if CYTHON_USE_TYPE_SLOTS
  13089. PyMappingMethods* mp;
  13090. #if PY_MAJOR_VERSION < 3
  13091. PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
  13092. if (likely(ms && ms->sq_slice)) {
  13093. if (!has_cstart) {
  13094. if (_py_start && (*_py_start != Py_None)) {
  13095. cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
  13096. if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  13097. } else
  13098. cstart = 0;
  13099. }
  13100. if (!has_cstop) {
  13101. if (_py_stop && (*_py_stop != Py_None)) {
  13102. cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
  13103. if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  13104. } else
  13105. cstop = PY_SSIZE_T_MAX;
  13106. }
  13107. if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
  13108. Py_ssize_t l = ms->sq_length(obj);
  13109. if (likely(l >= 0)) {
  13110. if (cstop < 0) {
  13111. cstop += l;
  13112. if (cstop < 0) cstop = 0;
  13113. }
  13114. if (cstart < 0) {
  13115. cstart += l;
  13116. if (cstart < 0) cstart = 0;
  13117. }
  13118. } else {
  13119. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  13120. goto bad;
  13121. PyErr_Clear();
  13122. }
  13123. }
  13124. return ms->sq_slice(obj, cstart, cstop);
  13125. }
  13126. #else
  13127. CYTHON_UNUSED_VAR(wraparound);
  13128. #endif
  13129. mp = Py_TYPE(obj)->tp_as_mapping;
  13130. if (likely(mp && mp->mp_subscript))
  13131. #else
  13132. CYTHON_UNUSED_VAR(wraparound);
  13133. #endif
  13134. {
  13135. PyObject* result;
  13136. PyObject *py_slice, *py_start, *py_stop;
  13137. if (_py_slice) {
  13138. py_slice = *_py_slice;
  13139. } else {
  13140. PyObject* owned_start = NULL;
  13141. PyObject* owned_stop = NULL;
  13142. if (_py_start) {
  13143. py_start = *_py_start;
  13144. } else {
  13145. if (has_cstart) {
  13146. owned_start = py_start = PyInt_FromSsize_t(cstart);
  13147. if (unlikely(!py_start)) goto bad;
  13148. } else
  13149. py_start = Py_None;
  13150. }
  13151. if (_py_stop) {
  13152. py_stop = *_py_stop;
  13153. } else {
  13154. if (has_cstop) {
  13155. owned_stop = py_stop = PyInt_FromSsize_t(cstop);
  13156. if (unlikely(!py_stop)) {
  13157. Py_XDECREF(owned_start);
  13158. goto bad;
  13159. }
  13160. } else
  13161. py_stop = Py_None;
  13162. }
  13163. py_slice = PySlice_New(py_start, py_stop, Py_None);
  13164. Py_XDECREF(owned_start);
  13165. Py_XDECREF(owned_stop);
  13166. if (unlikely(!py_slice)) goto bad;
  13167. }
  13168. #if CYTHON_USE_TYPE_SLOTS
  13169. result = mp->mp_subscript(obj, py_slice);
  13170. #else
  13171. result = PyObject_GetItem(obj, py_slice);
  13172. #endif
  13173. if (!_py_slice) {
  13174. Py_DECREF(py_slice);
  13175. }
  13176. return result;
  13177. }
  13178. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  13179. PyErr_Format(PyExc_TypeError,
  13180. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  13181. __Pyx_DECREF_TypeName(obj_type_name);
  13182. bad:
  13183. return NULL;
  13184. }
  13185. /* PyFunctionFastCall */
  13186. #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
  13187. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  13188. PyObject *globals) {
  13189. PyFrameObject *f;
  13190. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  13191. PyObject **fastlocals;
  13192. Py_ssize_t i;
  13193. PyObject *result;
  13194. assert(globals != NULL);
  13195. /* XXX Perhaps we should create a specialized
  13196. PyFrame_New() that doesn't take locals, but does
  13197. take builtins without sanity checking them.
  13198. */
  13199. assert(tstate != NULL);
  13200. f = PyFrame_New(tstate, co, globals, NULL);
  13201. if (f == NULL) {
  13202. return NULL;
  13203. }
  13204. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  13205. for (i = 0; i < na; i++) {
  13206. Py_INCREF(*args);
  13207. fastlocals[i] = *args++;
  13208. }
  13209. result = PyEval_EvalFrameEx(f,0);
  13210. ++tstate->recursion_depth;
  13211. Py_DECREF(f);
  13212. --tstate->recursion_depth;
  13213. return result;
  13214. }
  13215. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
  13216. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  13217. PyObject *globals = PyFunction_GET_GLOBALS(func);
  13218. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  13219. PyObject *closure;
  13220. #if PY_MAJOR_VERSION >= 3
  13221. PyObject *kwdefs;
  13222. #endif
  13223. PyObject *kwtuple, **k;
  13224. PyObject **d;
  13225. Py_ssize_t nd;
  13226. Py_ssize_t nk;
  13227. PyObject *result;
  13228. assert(kwargs == NULL || PyDict_Check(kwargs));
  13229. nk = kwargs ? PyDict_Size(kwargs) : 0;
  13230. #if PY_MAJOR_VERSION < 3
  13231. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
  13232. return NULL;
  13233. }
  13234. #else
  13235. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
  13236. return NULL;
  13237. }
  13238. #endif
  13239. if (
  13240. #if PY_MAJOR_VERSION >= 3
  13241. co->co_kwonlyargcount == 0 &&
  13242. #endif
  13243. likely(kwargs == NULL || nk == 0) &&
  13244. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  13245. if (argdefs == NULL && co->co_argcount == nargs) {
  13246. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  13247. goto done;
  13248. }
  13249. else if (nargs == 0 && argdefs != NULL
  13250. && co->co_argcount == Py_SIZE(argdefs)) {
  13251. /* function called with no arguments, but all parameters have
  13252. a default value: use default values as arguments .*/
  13253. args = &PyTuple_GET_ITEM(argdefs, 0);
  13254. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  13255. goto done;
  13256. }
  13257. }
  13258. if (kwargs != NULL) {
  13259. Py_ssize_t pos, i;
  13260. kwtuple = PyTuple_New(2 * nk);
  13261. if (kwtuple == NULL) {
  13262. result = NULL;
  13263. goto done;
  13264. }
  13265. k = &PyTuple_GET_ITEM(kwtuple, 0);
  13266. pos = i = 0;
  13267. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  13268. Py_INCREF(k[i]);
  13269. Py_INCREF(k[i+1]);
  13270. i += 2;
  13271. }
  13272. nk = i / 2;
  13273. }
  13274. else {
  13275. kwtuple = NULL;
  13276. k = NULL;
  13277. }
  13278. closure = PyFunction_GET_CLOSURE(func);
  13279. #if PY_MAJOR_VERSION >= 3
  13280. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  13281. #endif
  13282. if (argdefs != NULL) {
  13283. d = &PyTuple_GET_ITEM(argdefs, 0);
  13284. nd = Py_SIZE(argdefs);
  13285. }
  13286. else {
  13287. d = NULL;
  13288. nd = 0;
  13289. }
  13290. #if PY_MAJOR_VERSION >= 3
  13291. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  13292. args, (int)nargs,
  13293. k, (int)nk,
  13294. d, (int)nd, kwdefs, closure);
  13295. #else
  13296. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  13297. args, (int)nargs,
  13298. k, (int)nk,
  13299. d, (int)nd, closure);
  13300. #endif
  13301. Py_XDECREF(kwtuple);
  13302. done:
  13303. Py_LeaveRecursiveCall();
  13304. return result;
  13305. }
  13306. #endif
  13307. /* PyObjectCallMethO */
  13308. #if CYTHON_COMPILING_IN_CPYTHON
  13309. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  13310. PyObject *self, *result;
  13311. PyCFunction cfunc;
  13312. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  13313. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  13314. #if PY_MAJOR_VERSION < 3
  13315. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  13316. return NULL;
  13317. #else
  13318. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  13319. return NULL;
  13320. #endif
  13321. result = cfunc(self, arg);
  13322. Py_LeaveRecursiveCall();
  13323. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  13324. PyErr_SetString(
  13325. PyExc_SystemError,
  13326. "NULL result without error in PyObject_Call");
  13327. }
  13328. return result;
  13329. }
  13330. #endif
  13331. /* PyObjectFastCall */
  13332. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  13333. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
  13334. PyObject *argstuple;
  13335. PyObject *result = 0;
  13336. size_t i;
  13337. argstuple = PyTuple_New((Py_ssize_t)nargs);
  13338. if (unlikely(!argstuple)) return NULL;
  13339. for (i = 0; i < nargs; i++) {
  13340. Py_INCREF(args[i]);
  13341. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
  13342. }
  13343. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  13344. bad:
  13345. Py_DECREF(argstuple);
  13346. return result;
  13347. }
  13348. #endif
  13349. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
  13350. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  13351. #if CYTHON_COMPILING_IN_CPYTHON
  13352. if (nargs == 0 && kwargs == NULL) {
  13353. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  13354. return __Pyx_PyObject_CallMethO(func, NULL);
  13355. }
  13356. else if (nargs == 1 && kwargs == NULL) {
  13357. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  13358. return __Pyx_PyObject_CallMethO(func, args[0]);
  13359. }
  13360. #endif
  13361. #if PY_VERSION_HEX < 0x030800B1
  13362. #if CYTHON_FAST_PYCCALL
  13363. if (PyCFunction_Check(func)) {
  13364. if (kwargs) {
  13365. return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
  13366. } else {
  13367. return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
  13368. }
  13369. }
  13370. #if PY_VERSION_HEX >= 0x030700A1
  13371. if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
  13372. return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
  13373. }
  13374. #endif
  13375. #endif
  13376. #if CYTHON_FAST_PYCALL
  13377. if (PyFunction_Check(func)) {
  13378. return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
  13379. }
  13380. #endif
  13381. #endif
  13382. if (kwargs == NULL) {
  13383. #if CYTHON_VECTORCALL
  13384. #if PY_VERSION_HEX < 0x03090000
  13385. vectorcallfunc f = _PyVectorcall_Function(func);
  13386. #else
  13387. vectorcallfunc f = PyVectorcall_Function(func);
  13388. #endif
  13389. if (f) {
  13390. return f(func, args, (size_t)nargs, NULL);
  13391. }
  13392. #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
  13393. if (__Pyx_CyFunction_CheckExact(func)) {
  13394. __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
  13395. if (f) return f(func, args, (size_t)nargs, NULL);
  13396. }
  13397. #endif
  13398. }
  13399. if (nargs == 0) {
  13400. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
  13401. }
  13402. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  13403. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  13404. #else
  13405. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  13406. #endif
  13407. }
  13408. /* PyObjectCallOneArg */
  13409. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  13410. PyObject *args[2] = {NULL, arg};
  13411. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  13412. }
  13413. /* ObjectGetItem */
  13414. #if CYTHON_USE_TYPE_SLOTS
  13415. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  13416. PyObject *runerr = NULL;
  13417. Py_ssize_t key_value;
  13418. key_value = __Pyx_PyIndex_AsSsize_t(index);
  13419. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  13420. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  13421. }
  13422. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  13423. __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
  13424. PyErr_Clear();
  13425. PyErr_Format(PyExc_IndexError,
  13426. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  13427. __Pyx_DECREF_TypeName(index_type_name);
  13428. }
  13429. return NULL;
  13430. }
  13431. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  13432. __Pyx_TypeName obj_type_name;
  13433. if (likely(PyType_Check(obj))) {
  13434. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
  13435. if (!meth) {
  13436. PyErr_Clear();
  13437. } else {
  13438. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  13439. Py_DECREF(meth);
  13440. return result;
  13441. }
  13442. }
  13443. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  13444. PyErr_Format(PyExc_TypeError,
  13445. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  13446. __Pyx_DECREF_TypeName(obj_type_name);
  13447. return NULL;
  13448. }
  13449. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  13450. PyTypeObject *tp = Py_TYPE(obj);
  13451. PyMappingMethods *mm = tp->tp_as_mapping;
  13452. PySequenceMethods *sm = tp->tp_as_sequence;
  13453. if (likely(mm && mm->mp_subscript)) {
  13454. return mm->mp_subscript(obj, key);
  13455. }
  13456. if (likely(sm && sm->sq_item)) {
  13457. return __Pyx_PyObject_GetIndex(obj, key);
  13458. }
  13459. return __Pyx_PyObject_GetItem_Slow(obj, key);
  13460. }
  13461. #endif
  13462. /* PyIntBinop */
  13463. #if !CYTHON_COMPILING_IN_PYPY
  13464. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  13465. CYTHON_MAYBE_UNUSED_VAR(intval);
  13466. CYTHON_MAYBE_UNUSED_VAR(inplace);
  13467. CYTHON_UNUSED_VAR(zerodivision_check);
  13468. #if PY_MAJOR_VERSION < 3
  13469. if (likely(PyInt_CheckExact(op1))) {
  13470. const long b = intval;
  13471. long x;
  13472. long a = PyInt_AS_LONG(op1);
  13473. x = (long)((unsigned long)a - (unsigned long)b);
  13474. if (likely((x^a) >= 0 || (x^~b) >= 0))
  13475. return PyInt_FromLong(x);
  13476. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  13477. }
  13478. #endif
  13479. #if CYTHON_USE_PYLONG_INTERNALS
  13480. if (likely(PyLong_CheckExact(op1))) {
  13481. const long b = intval;
  13482. long a, x;
  13483. #ifdef HAVE_LONG_LONG
  13484. const PY_LONG_LONG llb = intval;
  13485. PY_LONG_LONG lla, llx;
  13486. #endif
  13487. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  13488. return PyLong_FromLong(-intval);
  13489. }
  13490. if (likely(__Pyx_PyLong_IsCompact(op1))) {
  13491. a = __Pyx_PyLong_CompactValue(op1);
  13492. } else {
  13493. const digit* digits = __Pyx_PyLong_Digits(op1);
  13494. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  13495. switch (size) {
  13496. case -2:
  13497. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  13498. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13499. break;
  13500. #ifdef HAVE_LONG_LONG
  13501. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  13502. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  13503. goto long_long;
  13504. #endif
  13505. }
  13506. CYTHON_FALLTHROUGH;
  13507. case 2:
  13508. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  13509. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13510. break;
  13511. #ifdef HAVE_LONG_LONG
  13512. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  13513. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  13514. goto long_long;
  13515. #endif
  13516. }
  13517. CYTHON_FALLTHROUGH;
  13518. case -3:
  13519. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  13520. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13521. break;
  13522. #ifdef HAVE_LONG_LONG
  13523. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  13524. 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]));
  13525. goto long_long;
  13526. #endif
  13527. }
  13528. CYTHON_FALLTHROUGH;
  13529. case 3:
  13530. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  13531. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13532. break;
  13533. #ifdef HAVE_LONG_LONG
  13534. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  13535. 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]));
  13536. goto long_long;
  13537. #endif
  13538. }
  13539. CYTHON_FALLTHROUGH;
  13540. case -4:
  13541. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  13542. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13543. break;
  13544. #ifdef HAVE_LONG_LONG
  13545. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  13546. 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]));
  13547. goto long_long;
  13548. #endif
  13549. }
  13550. CYTHON_FALLTHROUGH;
  13551. case 4:
  13552. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  13553. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  13554. break;
  13555. #ifdef HAVE_LONG_LONG
  13556. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  13557. 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]));
  13558. goto long_long;
  13559. #endif
  13560. }
  13561. CYTHON_FALLTHROUGH;
  13562. default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  13563. }
  13564. }
  13565. x = a - b;
  13566. return PyLong_FromLong(x);
  13567. #ifdef HAVE_LONG_LONG
  13568. long_long:
  13569. llx = lla - llb;
  13570. return PyLong_FromLongLong(llx);
  13571. #endif
  13572. }
  13573. #endif
  13574. if (PyFloat_CheckExact(op1)) {
  13575. const long b = intval;
  13576. #if CYTHON_COMPILING_IN_LIMITED_API
  13577. double a = __pyx_PyFloat_AsDouble(op1);
  13578. #else
  13579. double a = PyFloat_AS_DOUBLE(op1);
  13580. #endif
  13581. double result;
  13582. PyFPE_START_PROTECT("subtract", return NULL)
  13583. result = ((double)a) - (double)b;
  13584. PyFPE_END_PROTECT(result)
  13585. return PyFloat_FromDouble(result);
  13586. }
  13587. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  13588. }
  13589. #endif
  13590. /* PyDictVersioning */
  13591. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  13592. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  13593. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13594. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  13595. }
  13596. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  13597. PyObject **dictptr = NULL;
  13598. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  13599. if (offset) {
  13600. #if CYTHON_COMPILING_IN_CPYTHON
  13601. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  13602. #else
  13603. dictptr = _PyObject_GetDictPtr(obj);
  13604. #endif
  13605. }
  13606. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  13607. }
  13608. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  13609. PyObject *dict = Py_TYPE(obj)->tp_dict;
  13610. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  13611. return 0;
  13612. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  13613. }
  13614. #endif
  13615. /* GetModuleGlobalName */
  13616. #if CYTHON_USE_DICT_VERSIONS
  13617. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  13618. #else
  13619. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  13620. #endif
  13621. {
  13622. PyObject *result;
  13623. #if !CYTHON_AVOID_BORROWED_REFS
  13624. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
  13625. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  13626. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  13627. if (likely(result)) {
  13628. return __Pyx_NewRef(result);
  13629. } else if (unlikely(PyErr_Occurred())) {
  13630. return NULL;
  13631. }
  13632. #elif CYTHON_COMPILING_IN_LIMITED_API
  13633. if (unlikely(!__pyx_m)) {
  13634. return NULL;
  13635. }
  13636. result = PyObject_GetAttr(__pyx_m, name);
  13637. if (likely(result)) {
  13638. return result;
  13639. }
  13640. #else
  13641. result = PyDict_GetItem(__pyx_d, name);
  13642. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  13643. if (likely(result)) {
  13644. return __Pyx_NewRef(result);
  13645. }
  13646. #endif
  13647. #else
  13648. result = PyObject_GetItem(__pyx_d, name);
  13649. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  13650. if (likely(result)) {
  13651. return __Pyx_NewRef(result);
  13652. }
  13653. PyErr_Clear();
  13654. #endif
  13655. return __Pyx_GetBuiltinName(name);
  13656. }
  13657. /* RaiseUnboundLocalError */
  13658. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  13659. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  13660. }
  13661. /* RaiseTooManyValuesToUnpack */
  13662. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  13663. PyErr_Format(PyExc_ValueError,
  13664. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  13665. }
  13666. /* RaiseNeedMoreValuesToUnpack */
  13667. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  13668. PyErr_Format(PyExc_ValueError,
  13669. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  13670. index, (index == 1) ? "" : "s");
  13671. }
  13672. /* IterFinish */
  13673. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  13674. __Pyx_PyThreadState_declare
  13675. __Pyx_PyThreadState_assign
  13676. PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
  13677. if (unlikely(exc_type)) {
  13678. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  13679. return -1;
  13680. __Pyx_PyErr_Clear();
  13681. return 0;
  13682. }
  13683. return 0;
  13684. }
  13685. /* UnpackItemEndCheck */
  13686. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  13687. if (unlikely(retval)) {
  13688. Py_DECREF(retval);
  13689. __Pyx_RaiseTooManyValuesError(expected);
  13690. return -1;
  13691. }
  13692. return __Pyx_IterFinish();
  13693. }
  13694. /* py_abs */
  13695. #if CYTHON_USE_PYLONG_INTERNALS
  13696. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  13697. #if PY_VERSION_HEX >= 0x030C00A7
  13698. if (likely(__Pyx_PyLong_IsCompact(n))) {
  13699. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  13700. }
  13701. #else
  13702. if (likely(Py_SIZE(n) == -1)) {
  13703. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  13704. }
  13705. #endif
  13706. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13707. {
  13708. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  13709. if (likely(copy)) {
  13710. #if PY_VERSION_HEX >= 0x030C00A7
  13711. ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
  13712. #else
  13713. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  13714. #endif
  13715. }
  13716. return copy;
  13717. }
  13718. #else
  13719. return PyNumber_Negative(n);
  13720. #endif
  13721. }
  13722. #endif
  13723. /* RaiseClosureNameError */
  13724. static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
  13725. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  13726. }
  13727. /* GetException */
  13728. #if CYTHON_FAST_THREAD_STATE
  13729. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  13730. #else
  13731. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  13732. #endif
  13733. {
  13734. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  13735. #if CYTHON_FAST_THREAD_STATE
  13736. PyObject *tmp_type, *tmp_value, *tmp_tb;
  13737. #if PY_VERSION_HEX >= 0x030C00A6
  13738. local_value = tstate->current_exception;
  13739. tstate->current_exception = 0;
  13740. if (likely(local_value)) {
  13741. local_type = (PyObject*) Py_TYPE(local_value);
  13742. Py_INCREF(local_type);
  13743. local_tb = PyException_GetTraceback(local_value);
  13744. }
  13745. #else
  13746. local_type = tstate->curexc_type;
  13747. local_value = tstate->curexc_value;
  13748. local_tb = tstate->curexc_traceback;
  13749. tstate->curexc_type = 0;
  13750. tstate->curexc_value = 0;
  13751. tstate->curexc_traceback = 0;
  13752. #endif
  13753. #else
  13754. PyErr_Fetch(&local_type, &local_value, &local_tb);
  13755. #endif
  13756. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  13757. #if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
  13758. if (unlikely(tstate->current_exception))
  13759. #elif CYTHON_FAST_THREAD_STATE
  13760. if (unlikely(tstate->curexc_type))
  13761. #else
  13762. if (unlikely(PyErr_Occurred()))
  13763. #endif
  13764. goto bad;
  13765. #if PY_MAJOR_VERSION >= 3
  13766. if (local_tb) {
  13767. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  13768. goto bad;
  13769. }
  13770. #endif
  13771. Py_XINCREF(local_tb);
  13772. Py_XINCREF(local_type);
  13773. Py_XINCREF(local_value);
  13774. *type = local_type;
  13775. *value = local_value;
  13776. *tb = local_tb;
  13777. #if CYTHON_FAST_THREAD_STATE
  13778. #if CYTHON_USE_EXC_INFO_STACK
  13779. {
  13780. _PyErr_StackItem *exc_info = tstate->exc_info;
  13781. #if PY_VERSION_HEX >= 0x030B00a4
  13782. tmp_value = exc_info->exc_value;
  13783. exc_info->exc_value = local_value;
  13784. tmp_type = NULL;
  13785. tmp_tb = NULL;
  13786. Py_XDECREF(local_type);
  13787. Py_XDECREF(local_tb);
  13788. #else
  13789. tmp_type = exc_info->exc_type;
  13790. tmp_value = exc_info->exc_value;
  13791. tmp_tb = exc_info->exc_traceback;
  13792. exc_info->exc_type = local_type;
  13793. exc_info->exc_value = local_value;
  13794. exc_info->exc_traceback = local_tb;
  13795. #endif
  13796. }
  13797. #else
  13798. tmp_type = tstate->exc_type;
  13799. tmp_value = tstate->exc_value;
  13800. tmp_tb = tstate->exc_traceback;
  13801. tstate->exc_type = local_type;
  13802. tstate->exc_value = local_value;
  13803. tstate->exc_traceback = local_tb;
  13804. #endif
  13805. Py_XDECREF(tmp_type);
  13806. Py_XDECREF(tmp_value);
  13807. Py_XDECREF(tmp_tb);
  13808. #else
  13809. PyErr_SetExcInfo(local_type, local_value, local_tb);
  13810. #endif
  13811. return 0;
  13812. bad:
  13813. *type = 0;
  13814. *value = 0;
  13815. *tb = 0;
  13816. Py_XDECREF(local_type);
  13817. Py_XDECREF(local_value);
  13818. Py_XDECREF(local_tb);
  13819. return -1;
  13820. }
  13821. /* pep479 */
  13822. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  13823. PyObject *exc, *val, *tb, *cur_exc;
  13824. __Pyx_PyThreadState_declare
  13825. #ifdef __Pyx_StopAsyncIteration_USED
  13826. int is_async_stopiteration = 0;
  13827. #endif
  13828. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  13829. cur_exc = PyErr_Occurred();
  13830. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  13831. #ifdef __Pyx_StopAsyncIteration_USED
  13832. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) {
  13833. is_async_stopiteration = 1;
  13834. } else
  13835. #endif
  13836. return;
  13837. }
  13838. __Pyx_PyThreadState_assign
  13839. __Pyx_GetException(&exc, &val, &tb);
  13840. Py_XDECREF(exc);
  13841. Py_XDECREF(val);
  13842. Py_XDECREF(tb);
  13843. PyErr_SetString(PyExc_RuntimeError,
  13844. #ifdef __Pyx_StopAsyncIteration_USED
  13845. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  13846. in_async_gen ? "async generator raised StopIteration" :
  13847. #endif
  13848. "generator raised StopIteration");
  13849. }
  13850. /* ArgTypeTest */
  13851. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  13852. {
  13853. __Pyx_TypeName type_name;
  13854. __Pyx_TypeName obj_type_name;
  13855. if (unlikely(!type)) {
  13856. PyErr_SetString(PyExc_SystemError, "Missing type object");
  13857. return 0;
  13858. }
  13859. else if (exact) {
  13860. #if PY_MAJOR_VERSION == 2
  13861. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  13862. #endif
  13863. }
  13864. else {
  13865. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  13866. }
  13867. type_name = __Pyx_PyType_GetName(type);
  13868. obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  13869. PyErr_Format(PyExc_TypeError,
  13870. "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
  13871. ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
  13872. __Pyx_DECREF_TypeName(type_name);
  13873. __Pyx_DECREF_TypeName(obj_type_name);
  13874. return 0;
  13875. }
  13876. /* DictGetItem */
  13877. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  13878. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  13879. PyObject *value;
  13880. value = PyDict_GetItemWithError(d, key);
  13881. if (unlikely(!value)) {
  13882. if (!PyErr_Occurred()) {
  13883. if (unlikely(PyTuple_Check(key))) {
  13884. PyObject* args = PyTuple_Pack(1, key);
  13885. if (likely(args)) {
  13886. PyErr_SetObject(PyExc_KeyError, args);
  13887. Py_DECREF(args);
  13888. }
  13889. } else {
  13890. PyErr_SetObject(PyExc_KeyError, key);
  13891. }
  13892. }
  13893. return NULL;
  13894. }
  13895. Py_INCREF(value);
  13896. return value;
  13897. }
  13898. #endif
  13899. /* pyfrozenset_new */
  13900. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  13901. if (it) {
  13902. PyObject* result;
  13903. #if CYTHON_COMPILING_IN_PYPY
  13904. PyObject* args;
  13905. args = PyTuple_Pack(1, it);
  13906. if (unlikely(!args))
  13907. return NULL;
  13908. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  13909. Py_DECREF(args);
  13910. return result;
  13911. #else
  13912. if (PyFrozenSet_CheckExact(it)) {
  13913. Py_INCREF(it);
  13914. return it;
  13915. }
  13916. result = PyFrozenSet_New(it);
  13917. if (unlikely(!result))
  13918. return NULL;
  13919. if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result)))
  13920. return result;
  13921. Py_DECREF(result);
  13922. #endif
  13923. }
  13924. #if CYTHON_USE_TYPE_SLOTS
  13925. return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  13926. #else
  13927. return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  13928. #endif
  13929. }
  13930. /* PySetContains */
  13931. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  13932. int result = -1;
  13933. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  13934. PyObject *tmpkey;
  13935. PyErr_Clear();
  13936. tmpkey = __Pyx_PyFrozenSet_New(key);
  13937. if (tmpkey != NULL) {
  13938. result = PySet_Contains(set, tmpkey);
  13939. Py_DECREF(tmpkey);
  13940. }
  13941. }
  13942. return result;
  13943. }
  13944. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  13945. int result = PySet_Contains(set, key);
  13946. if (unlikely(result < 0)) {
  13947. result = __Pyx_PySet_ContainsUnhashable(set, key);
  13948. }
  13949. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  13950. }
  13951. /* RaiseUnexpectedTypeError */
  13952. static int
  13953. __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
  13954. {
  13955. __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
  13956. PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
  13957. expected, obj_type_name);
  13958. __Pyx_DECREF_TypeName(obj_type_name);
  13959. return 0;
  13960. }
  13961. /* SliceTupleAndList */
  13962. #if CYTHON_COMPILING_IN_CPYTHON
  13963. static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
  13964. Py_ssize_t start = *_start, stop = *_stop, length = *_length;
  13965. if (start < 0) {
  13966. start += length;
  13967. if (start < 0)
  13968. start = 0;
  13969. }
  13970. if (stop < 0)
  13971. stop += length;
  13972. else if (stop > length)
  13973. stop = length;
  13974. *_length = stop - start;
  13975. *_start = start;
  13976. *_stop = stop;
  13977. }
  13978. static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
  13979. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13980. Py_ssize_t length = PyList_GET_SIZE(src);
  13981. __Pyx_crop_slice(&start, &stop, &length);
  13982. if (length <= 0) {
  13983. return PyList_New(0);
  13984. }
  13985. return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length);
  13986. }
  13987. static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
  13988. PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
  13989. Py_ssize_t length = PyTuple_GET_SIZE(src);
  13990. __Pyx_crop_slice(&start, &stop, &length);
  13991. return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length);
  13992. }
  13993. #endif
  13994. /* set_iter */
  13995. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  13996. Py_ssize_t* p_orig_length, int* p_source_is_set) {
  13997. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  13998. is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
  13999. *p_source_is_set = is_set;
  14000. if (likely(is_set)) {
  14001. *p_orig_length = PySet_Size(iterable);
  14002. Py_INCREF(iterable);
  14003. return iterable;
  14004. }
  14005. #else
  14006. CYTHON_UNUSED_VAR(is_set);
  14007. *p_source_is_set = 0;
  14008. #endif
  14009. *p_orig_length = 0;
  14010. return PyObject_GetIter(iterable);
  14011. }
  14012. static CYTHON_INLINE int __Pyx_set_iter_next(
  14013. PyObject* iter_obj, Py_ssize_t orig_length,
  14014. Py_ssize_t* ppos, PyObject **value,
  14015. int source_is_set) {
  14016. if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
  14017. *value = PyIter_Next(iter_obj);
  14018. if (unlikely(!*value)) {
  14019. return __Pyx_IterFinish();
  14020. }
  14021. CYTHON_UNUSED_VAR(orig_length);
  14022. CYTHON_UNUSED_VAR(ppos);
  14023. return 1;
  14024. }
  14025. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  14026. if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
  14027. PyErr_SetString(
  14028. PyExc_RuntimeError,
  14029. "set changed size during iteration");
  14030. return -1;
  14031. }
  14032. {
  14033. Py_hash_t hash;
  14034. int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
  14035. assert (ret != -1);
  14036. if (likely(ret)) {
  14037. Py_INCREF(*value);
  14038. return 1;
  14039. }
  14040. }
  14041. #endif
  14042. return 0;
  14043. }
  14044. /* PyIntCompare */
  14045. static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  14046. CYTHON_MAYBE_UNUSED_VAR(intval);
  14047. CYTHON_UNUSED_VAR(inplace);
  14048. if (op1 == op2) {
  14049. return 1;
  14050. }
  14051. #if PY_MAJOR_VERSION < 3
  14052. if (likely(PyInt_CheckExact(op1))) {
  14053. const long b = intval;
  14054. long a = PyInt_AS_LONG(op1);
  14055. return (a == b);
  14056. }
  14057. #endif
  14058. #if CYTHON_USE_PYLONG_INTERNALS
  14059. if (likely(PyLong_CheckExact(op1))) {
  14060. int unequal;
  14061. unsigned long uintval;
  14062. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  14063. const digit* digits = __Pyx_PyLong_Digits(op1);
  14064. if (intval == 0) {
  14065. return (__Pyx_PyLong_IsZero(op1) == 1);
  14066. } else if (intval < 0) {
  14067. if (__Pyx_PyLong_IsNonNeg(op1))
  14068. return 0;
  14069. intval = -intval;
  14070. } else {
  14071. if (__Pyx_PyLong_IsNeg(op1))
  14072. return 0;
  14073. }
  14074. uintval = (unsigned long) intval;
  14075. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  14076. if (uintval >> (PyLong_SHIFT * 4)) {
  14077. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  14078. | (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));
  14079. } else
  14080. #endif
  14081. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  14082. if (uintval >> (PyLong_SHIFT * 3)) {
  14083. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  14084. | (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));
  14085. } else
  14086. #endif
  14087. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  14088. if (uintval >> (PyLong_SHIFT * 2)) {
  14089. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  14090. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  14091. } else
  14092. #endif
  14093. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  14094. if (uintval >> (PyLong_SHIFT * 1)) {
  14095. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  14096. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  14097. } else
  14098. #endif
  14099. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  14100. return (unequal == 0);
  14101. }
  14102. #endif
  14103. if (PyFloat_CheckExact(op1)) {
  14104. const long b = intval;
  14105. #if CYTHON_COMPILING_IN_LIMITED_API
  14106. double a = __pyx_PyFloat_AsDouble(op1);
  14107. #else
  14108. double a = PyFloat_AS_DOUBLE(op1);
  14109. #endif
  14110. return ((double)a == (double)b);
  14111. }
  14112. return __Pyx_PyObject_IsTrueAndDecref(
  14113. PyObject_RichCompare(op1, op2, Py_EQ));
  14114. }
  14115. /* py_set_discard_unhashable */
  14116. static int __Pyx_PySet_DiscardUnhashable(PyObject *set, PyObject *key) {
  14117. PyObject *tmpkey;
  14118. int rv;
  14119. if (likely(!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)))
  14120. return -1;
  14121. PyErr_Clear();
  14122. tmpkey = __Pyx_PyFrozenSet_New(key);
  14123. if (tmpkey == NULL)
  14124. return -1;
  14125. rv = PySet_Discard(set, tmpkey);
  14126. Py_DECREF(tmpkey);
  14127. return rv;
  14128. }
  14129. /* py_set_remove */
  14130. static int __Pyx_PySet_RemoveNotFound(PyObject *set, PyObject *key, int found) {
  14131. if (unlikely(found < 0)) {
  14132. found = __Pyx_PySet_DiscardUnhashable(set, key);
  14133. }
  14134. if (likely(found == 0)) {
  14135. PyObject *tup;
  14136. tup = PyTuple_Pack(1, key);
  14137. if (!tup)
  14138. return -1;
  14139. PyErr_SetObject(PyExc_KeyError, tup);
  14140. Py_DECREF(tup);
  14141. return -1;
  14142. }
  14143. return found;
  14144. }
  14145. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key) {
  14146. int found = PySet_Discard(set, key);
  14147. if (unlikely(found != 1)) {
  14148. return __Pyx_PySet_RemoveNotFound(set, key, found);
  14149. }
  14150. return 0;
  14151. }
  14152. /* FixUpExtensionType */
  14153. #if CYTHON_USE_TYPE_SPECS
  14154. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  14155. #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  14156. CYTHON_UNUSED_VAR(spec);
  14157. CYTHON_UNUSED_VAR(type);
  14158. #else
  14159. const PyType_Slot *slot = spec->slots;
  14160. while (slot && slot->slot && slot->slot != Py_tp_members)
  14161. slot++;
  14162. if (slot && slot->slot == Py_tp_members) {
  14163. int changed = 0;
  14164. #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
  14165. const
  14166. #endif
  14167. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  14168. while (memb && memb->name) {
  14169. if (memb->name[0] == '_' && memb->name[1] == '_') {
  14170. #if PY_VERSION_HEX < 0x030900b1
  14171. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  14172. assert(memb->type == T_PYSSIZET);
  14173. assert(memb->flags == READONLY);
  14174. type->tp_weaklistoffset = memb->offset;
  14175. changed = 1;
  14176. }
  14177. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  14178. assert(memb->type == T_PYSSIZET);
  14179. assert(memb->flags == READONLY);
  14180. type->tp_dictoffset = memb->offset;
  14181. changed = 1;
  14182. }
  14183. #if CYTHON_METH_FASTCALL
  14184. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  14185. assert(memb->type == T_PYSSIZET);
  14186. assert(memb->flags == READONLY);
  14187. #if PY_VERSION_HEX >= 0x030800b4
  14188. type->tp_vectorcall_offset = memb->offset;
  14189. #else
  14190. type->tp_print = (printfunc) memb->offset;
  14191. #endif
  14192. changed = 1;
  14193. }
  14194. #endif
  14195. #else
  14196. if ((0));
  14197. #endif
  14198. #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
  14199. else if (strcmp(memb->name, "__module__") == 0) {
  14200. PyObject *descr;
  14201. assert(memb->type == T_OBJECT);
  14202. assert(memb->flags == 0 || memb->flags == READONLY);
  14203. descr = PyDescr_NewMember(type, memb);
  14204. if (unlikely(!descr))
  14205. return -1;
  14206. if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
  14207. Py_DECREF(descr);
  14208. return -1;
  14209. }
  14210. Py_DECREF(descr);
  14211. changed = 1;
  14212. }
  14213. #endif
  14214. }
  14215. memb++;
  14216. }
  14217. if (changed)
  14218. PyType_Modified(type);
  14219. }
  14220. #endif
  14221. return 0;
  14222. }
  14223. #endif
  14224. /* PyObjectCallNoArg */
  14225. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  14226. PyObject *arg[2] = {NULL, NULL};
  14227. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  14228. }
  14229. /* PyObjectGetMethod */
  14230. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  14231. PyObject *attr;
  14232. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  14233. __Pyx_TypeName type_name;
  14234. PyTypeObject *tp = Py_TYPE(obj);
  14235. PyObject *descr;
  14236. descrgetfunc f = NULL;
  14237. PyObject **dictptr, *dict;
  14238. int meth_found = 0;
  14239. assert (*method == NULL);
  14240. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  14241. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14242. goto try_unpack;
  14243. }
  14244. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  14245. return 0;
  14246. }
  14247. descr = _PyType_Lookup(tp, name);
  14248. if (likely(descr != NULL)) {
  14249. Py_INCREF(descr);
  14250. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  14251. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  14252. #elif PY_MAJOR_VERSION >= 3
  14253. #ifdef __Pyx_CyFunction_USED
  14254. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  14255. #else
  14256. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  14257. #endif
  14258. #else
  14259. #ifdef __Pyx_CyFunction_USED
  14260. if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
  14261. #else
  14262. if (likely(PyFunction_Check(descr)))
  14263. #endif
  14264. #endif
  14265. {
  14266. meth_found = 1;
  14267. } else {
  14268. f = Py_TYPE(descr)->tp_descr_get;
  14269. if (f != NULL && PyDescr_IsData(descr)) {
  14270. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14271. Py_DECREF(descr);
  14272. goto try_unpack;
  14273. }
  14274. }
  14275. }
  14276. dictptr = _PyObject_GetDictPtr(obj);
  14277. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  14278. Py_INCREF(dict);
  14279. attr = __Pyx_PyDict_GetItemStr(dict, name);
  14280. if (attr != NULL) {
  14281. Py_INCREF(attr);
  14282. Py_DECREF(dict);
  14283. Py_XDECREF(descr);
  14284. goto try_unpack;
  14285. }
  14286. Py_DECREF(dict);
  14287. }
  14288. if (meth_found) {
  14289. *method = descr;
  14290. return 1;
  14291. }
  14292. if (f != NULL) {
  14293. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  14294. Py_DECREF(descr);
  14295. goto try_unpack;
  14296. }
  14297. if (likely(descr != NULL)) {
  14298. *method = descr;
  14299. return 0;
  14300. }
  14301. type_name = __Pyx_PyType_GetName(tp);
  14302. PyErr_Format(PyExc_AttributeError,
  14303. #if PY_MAJOR_VERSION >= 3
  14304. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  14305. type_name, name);
  14306. #else
  14307. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
  14308. type_name, PyString_AS_STRING(name));
  14309. #endif
  14310. __Pyx_DECREF_TypeName(type_name);
  14311. return 0;
  14312. #else
  14313. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  14314. goto try_unpack;
  14315. #endif
  14316. try_unpack:
  14317. #if CYTHON_UNPACK_METHODS
  14318. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  14319. PyObject *function = PyMethod_GET_FUNCTION(attr);
  14320. Py_INCREF(function);
  14321. Py_DECREF(attr);
  14322. *method = function;
  14323. return 1;
  14324. }
  14325. #endif
  14326. *method = attr;
  14327. return 0;
  14328. }
  14329. /* PyObjectCallMethod0 */
  14330. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  14331. PyObject *method = NULL, *result = NULL;
  14332. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  14333. if (likely(is_method)) {
  14334. result = __Pyx_PyObject_CallOneArg(method, obj);
  14335. Py_DECREF(method);
  14336. return result;
  14337. }
  14338. if (unlikely(!method)) goto bad;
  14339. result = __Pyx_PyObject_CallNoArg(method);
  14340. Py_DECREF(method);
  14341. bad:
  14342. return result;
  14343. }
  14344. /* ValidateBasesTuple */
  14345. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  14346. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  14347. Py_ssize_t i, n;
  14348. #if CYTHON_ASSUME_SAFE_MACROS
  14349. n = PyTuple_GET_SIZE(bases);
  14350. #else
  14351. n = PyTuple_Size(bases);
  14352. if (n < 0) return -1;
  14353. #endif
  14354. for (i = 1; i < n; i++)
  14355. {
  14356. #if CYTHON_AVOID_BORROWED_REFS
  14357. PyObject *b0 = PySequence_GetItem(bases, i);
  14358. if (!b0) return -1;
  14359. #elif CYTHON_ASSUME_SAFE_MACROS
  14360. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  14361. #else
  14362. PyObject *b0 = PyTuple_GetItem(bases, i);
  14363. if (!b0) return -1;
  14364. #endif
  14365. PyTypeObject *b;
  14366. #if PY_MAJOR_VERSION < 3
  14367. if (PyClass_Check(b0))
  14368. {
  14369. PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
  14370. PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
  14371. #if CYTHON_AVOID_BORROWED_REFS
  14372. Py_DECREF(b0);
  14373. #endif
  14374. return -1;
  14375. }
  14376. #endif
  14377. b = (PyTypeObject*) b0;
  14378. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  14379. {
  14380. __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
  14381. PyErr_Format(PyExc_TypeError,
  14382. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  14383. __Pyx_DECREF_TypeName(b_name);
  14384. #if CYTHON_AVOID_BORROWED_REFS
  14385. Py_DECREF(b0);
  14386. #endif
  14387. return -1;
  14388. }
  14389. if (dictoffset == 0)
  14390. {
  14391. Py_ssize_t b_dictoffset = 0;
  14392. #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
  14393. b_dictoffset = b->tp_dictoffset;
  14394. #else
  14395. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  14396. if (!py_b_dictoffset) goto dictoffset_return;
  14397. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  14398. Py_DECREF(py_b_dictoffset);
  14399. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  14400. #endif
  14401. if (b_dictoffset) {
  14402. {
  14403. __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
  14404. PyErr_Format(PyExc_TypeError,
  14405. "extension type '%.200s' has no __dict__ slot, "
  14406. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  14407. "either add 'cdef dict __dict__' to the extension type "
  14408. "or add '__slots__ = [...]' to the base type",
  14409. type_name, b_name);
  14410. __Pyx_DECREF_TypeName(b_name);
  14411. }
  14412. #if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY)
  14413. dictoffset_return:
  14414. #endif
  14415. #if CYTHON_AVOID_BORROWED_REFS
  14416. Py_DECREF(b0);
  14417. #endif
  14418. return -1;
  14419. }
  14420. }
  14421. #if CYTHON_AVOID_BORROWED_REFS
  14422. Py_DECREF(b0);
  14423. #endif
  14424. }
  14425. return 0;
  14426. }
  14427. #endif
  14428. /* PyType_Ready */
  14429. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  14430. #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
  14431. (void)__Pyx_PyObject_CallMethod0;
  14432. #if CYTHON_USE_TYPE_SPECS
  14433. (void)__Pyx_validate_bases_tuple;
  14434. #endif
  14435. return PyType_Ready(t);
  14436. #else
  14437. int r;
  14438. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  14439. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  14440. return -1;
  14441. #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
  14442. {
  14443. int gc_was_enabled;
  14444. #if PY_VERSION_HEX >= 0x030A00b1
  14445. gc_was_enabled = PyGC_Disable();
  14446. (void)__Pyx_PyObject_CallMethod0;
  14447. #else
  14448. PyObject *ret, *py_status;
  14449. PyObject *gc = NULL;
  14450. #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
  14451. gc = PyImport_GetModule(__pyx_kp_u_gc);
  14452. #endif
  14453. if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
  14454. if (unlikely(!gc)) return -1;
  14455. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
  14456. if (unlikely(!py_status)) {
  14457. Py_DECREF(gc);
  14458. return -1;
  14459. }
  14460. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  14461. Py_DECREF(py_status);
  14462. if (gc_was_enabled > 0) {
  14463. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
  14464. if (unlikely(!ret)) {
  14465. Py_DECREF(gc);
  14466. return -1;
  14467. }
  14468. Py_DECREF(ret);
  14469. } else if (unlikely(gc_was_enabled == -1)) {
  14470. Py_DECREF(gc);
  14471. return -1;
  14472. }
  14473. #endif
  14474. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  14475. #if PY_VERSION_HEX >= 0x030A0000
  14476. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  14477. #endif
  14478. #else
  14479. (void)__Pyx_PyObject_CallMethod0;
  14480. #endif
  14481. r = PyType_Ready(t);
  14482. #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
  14483. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  14484. #if PY_VERSION_HEX >= 0x030A00b1
  14485. if (gc_was_enabled)
  14486. PyGC_Enable();
  14487. #else
  14488. if (gc_was_enabled) {
  14489. PyObject *tp, *v, *tb;
  14490. PyErr_Fetch(&tp, &v, &tb);
  14491. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
  14492. if (likely(ret || r == -1)) {
  14493. Py_XDECREF(ret);
  14494. PyErr_Restore(tp, v, tb);
  14495. } else {
  14496. Py_XDECREF(tp);
  14497. Py_XDECREF(v);
  14498. Py_XDECREF(tb);
  14499. r = -1;
  14500. }
  14501. }
  14502. Py_DECREF(gc);
  14503. #endif
  14504. }
  14505. #endif
  14506. return r;
  14507. #endif
  14508. }
  14509. /* PyObject_GenericGetAttrNoDict */
  14510. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  14511. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  14512. __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
  14513. PyErr_Format(PyExc_AttributeError,
  14514. #if PY_MAJOR_VERSION >= 3
  14515. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  14516. type_name, attr_name);
  14517. #else
  14518. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
  14519. type_name, PyString_AS_STRING(attr_name));
  14520. #endif
  14521. __Pyx_DECREF_TypeName(type_name);
  14522. return NULL;
  14523. }
  14524. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  14525. PyObject *descr;
  14526. PyTypeObject *tp = Py_TYPE(obj);
  14527. if (unlikely(!PyString_Check(attr_name))) {
  14528. return PyObject_GenericGetAttr(obj, attr_name);
  14529. }
  14530. assert(!tp->tp_dictoffset);
  14531. descr = _PyType_Lookup(tp, attr_name);
  14532. if (unlikely(!descr)) {
  14533. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  14534. }
  14535. Py_INCREF(descr);
  14536. #if PY_MAJOR_VERSION < 3
  14537. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  14538. #endif
  14539. {
  14540. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  14541. if (unlikely(f)) {
  14542. PyObject *res = f(descr, obj, (PyObject *)tp);
  14543. Py_DECREF(descr);
  14544. return res;
  14545. }
  14546. }
  14547. return descr;
  14548. }
  14549. #endif
  14550. /* GetTopmostException */
  14551. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  14552. static _PyErr_StackItem *
  14553. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  14554. {
  14555. _PyErr_StackItem *exc_info = tstate->exc_info;
  14556. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  14557. exc_info->previous_item != NULL)
  14558. {
  14559. exc_info = exc_info->previous_item;
  14560. }
  14561. return exc_info;
  14562. }
  14563. #endif
  14564. /* SaveResetException */
  14565. #if CYTHON_FAST_THREAD_STATE
  14566. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  14567. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  14568. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  14569. PyObject *exc_value = exc_info->exc_value;
  14570. if (exc_value == NULL || exc_value == Py_None) {
  14571. *value = NULL;
  14572. *type = NULL;
  14573. *tb = NULL;
  14574. } else {
  14575. *value = exc_value;
  14576. Py_INCREF(*value);
  14577. *type = (PyObject*) Py_TYPE(exc_value);
  14578. Py_INCREF(*type);
  14579. *tb = PyException_GetTraceback(exc_value);
  14580. }
  14581. #elif CYTHON_USE_EXC_INFO_STACK
  14582. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  14583. *type = exc_info->exc_type;
  14584. *value = exc_info->exc_value;
  14585. *tb = exc_info->exc_traceback;
  14586. Py_XINCREF(*type);
  14587. Py_XINCREF(*value);
  14588. Py_XINCREF(*tb);
  14589. #else
  14590. *type = tstate->exc_type;
  14591. *value = tstate->exc_value;
  14592. *tb = tstate->exc_traceback;
  14593. Py_XINCREF(*type);
  14594. Py_XINCREF(*value);
  14595. Py_XINCREF(*tb);
  14596. #endif
  14597. }
  14598. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  14599. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  14600. _PyErr_StackItem *exc_info = tstate->exc_info;
  14601. PyObject *tmp_value = exc_info->exc_value;
  14602. exc_info->exc_value = value;
  14603. Py_XDECREF(tmp_value);
  14604. Py_XDECREF(type);
  14605. Py_XDECREF(tb);
  14606. #else
  14607. PyObject *tmp_type, *tmp_value, *tmp_tb;
  14608. #if CYTHON_USE_EXC_INFO_STACK
  14609. _PyErr_StackItem *exc_info = tstate->exc_info;
  14610. tmp_type = exc_info->exc_type;
  14611. tmp_value = exc_info->exc_value;
  14612. tmp_tb = exc_info->exc_traceback;
  14613. exc_info->exc_type = type;
  14614. exc_info->exc_value = value;
  14615. exc_info->exc_traceback = tb;
  14616. #else
  14617. tmp_type = tstate->exc_type;
  14618. tmp_value = tstate->exc_value;
  14619. tmp_tb = tstate->exc_traceback;
  14620. tstate->exc_type = type;
  14621. tstate->exc_value = value;
  14622. tstate->exc_traceback = tb;
  14623. #endif
  14624. Py_XDECREF(tmp_type);
  14625. Py_XDECREF(tmp_value);
  14626. Py_XDECREF(tmp_tb);
  14627. #endif
  14628. }
  14629. #endif
  14630. /* FastTypeChecks */
  14631. #if CYTHON_COMPILING_IN_CPYTHON
  14632. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  14633. while (a) {
  14634. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  14635. if (a == b)
  14636. return 1;
  14637. }
  14638. return b == &PyBaseObject_Type;
  14639. }
  14640. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  14641. PyObject *mro;
  14642. if (a == b) return 1;
  14643. mro = a->tp_mro;
  14644. if (likely(mro)) {
  14645. Py_ssize_t i, n;
  14646. n = PyTuple_GET_SIZE(mro);
  14647. for (i = 0; i < n; i++) {
  14648. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  14649. return 1;
  14650. }
  14651. return 0;
  14652. }
  14653. return __Pyx_InBases(a, b);
  14654. }
  14655. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  14656. PyObject *mro;
  14657. if (cls == a || cls == b) return 1;
  14658. mro = cls->tp_mro;
  14659. if (likely(mro)) {
  14660. Py_ssize_t i, n;
  14661. n = PyTuple_GET_SIZE(mro);
  14662. for (i = 0; i < n; i++) {
  14663. PyObject *base = PyTuple_GET_ITEM(mro, i);
  14664. if (base == (PyObject *)a || base == (PyObject *)b)
  14665. return 1;
  14666. }
  14667. return 0;
  14668. }
  14669. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  14670. }
  14671. #if PY_MAJOR_VERSION == 2
  14672. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  14673. PyObject *exception, *value, *tb;
  14674. int res;
  14675. __Pyx_PyThreadState_declare
  14676. __Pyx_PyThreadState_assign
  14677. __Pyx_ErrFetch(&exception, &value, &tb);
  14678. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  14679. if (unlikely(res == -1)) {
  14680. PyErr_WriteUnraisable(err);
  14681. res = 0;
  14682. }
  14683. if (!res) {
  14684. res = PyObject_IsSubclass(err, exc_type2);
  14685. if (unlikely(res == -1)) {
  14686. PyErr_WriteUnraisable(err);
  14687. res = 0;
  14688. }
  14689. }
  14690. __Pyx_ErrRestore(exception, value, tb);
  14691. return res;
  14692. }
  14693. #else
  14694. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  14695. if (exc_type1) {
  14696. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  14697. } else {
  14698. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  14699. }
  14700. }
  14701. #endif
  14702. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  14703. Py_ssize_t i, n;
  14704. assert(PyExceptionClass_Check(exc_type));
  14705. n = PyTuple_GET_SIZE(tuple);
  14706. #if PY_MAJOR_VERSION >= 3
  14707. for (i=0; i<n; i++) {
  14708. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  14709. }
  14710. #endif
  14711. for (i=0; i<n; i++) {
  14712. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  14713. #if PY_MAJOR_VERSION < 3
  14714. if (likely(exc_type == t)) return 1;
  14715. #endif
  14716. if (likely(PyExceptionClass_Check(t))) {
  14717. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  14718. } else {
  14719. }
  14720. }
  14721. return 0;
  14722. }
  14723. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  14724. if (likely(err == exc_type)) return 1;
  14725. if (likely(PyExceptionClass_Check(err))) {
  14726. if (likely(PyExceptionClass_Check(exc_type))) {
  14727. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  14728. } else if (likely(PyTuple_Check(exc_type))) {
  14729. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  14730. } else {
  14731. }
  14732. }
  14733. return PyErr_GivenExceptionMatches(err, exc_type);
  14734. }
  14735. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  14736. assert(PyExceptionClass_Check(exc_type1));
  14737. assert(PyExceptionClass_Check(exc_type2));
  14738. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  14739. if (likely(PyExceptionClass_Check(err))) {
  14740. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  14741. }
  14742. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  14743. }
  14744. #endif
  14745. /* Import */
  14746. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  14747. PyObject *module = 0;
  14748. PyObject *empty_dict = 0;
  14749. PyObject *empty_list = 0;
  14750. #if PY_MAJOR_VERSION < 3
  14751. PyObject *py_import;
  14752. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  14753. if (unlikely(!py_import))
  14754. goto bad;
  14755. if (!from_list) {
  14756. empty_list = PyList_New(0);
  14757. if (unlikely(!empty_list))
  14758. goto bad;
  14759. from_list = empty_list;
  14760. }
  14761. #endif
  14762. empty_dict = PyDict_New();
  14763. if (unlikely(!empty_dict))
  14764. goto bad;
  14765. {
  14766. #if PY_MAJOR_VERSION >= 3
  14767. if (level == -1) {
  14768. if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
  14769. module = PyImport_ImportModuleLevelObject(
  14770. name, __pyx_d, empty_dict, from_list, 1);
  14771. if (unlikely(!module)) {
  14772. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  14773. goto bad;
  14774. PyErr_Clear();
  14775. }
  14776. }
  14777. level = 0;
  14778. }
  14779. #endif
  14780. if (!module) {
  14781. #if PY_MAJOR_VERSION < 3
  14782. PyObject *py_level = PyInt_FromLong(level);
  14783. if (unlikely(!py_level))
  14784. goto bad;
  14785. module = PyObject_CallFunctionObjArgs(py_import,
  14786. name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
  14787. Py_DECREF(py_level);
  14788. #else
  14789. module = PyImport_ImportModuleLevelObject(
  14790. name, __pyx_d, empty_dict, from_list, level);
  14791. #endif
  14792. }
  14793. }
  14794. bad:
  14795. Py_XDECREF(empty_dict);
  14796. Py_XDECREF(empty_list);
  14797. #if PY_MAJOR_VERSION < 3
  14798. Py_XDECREF(py_import);
  14799. #endif
  14800. return module;
  14801. }
  14802. /* ImportFrom */
  14803. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  14804. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  14805. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  14806. const char* module_name_str = 0;
  14807. PyObject* module_name = 0;
  14808. PyObject* module_dot = 0;
  14809. PyObject* full_name = 0;
  14810. PyErr_Clear();
  14811. module_name_str = PyModule_GetName(module);
  14812. if (unlikely(!module_name_str)) { goto modbad; }
  14813. module_name = PyUnicode_FromString(module_name_str);
  14814. if (unlikely(!module_name)) { goto modbad; }
  14815. module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__3);
  14816. if (unlikely(!module_dot)) { goto modbad; }
  14817. full_name = PyUnicode_Concat(module_dot, name);
  14818. if (unlikely(!full_name)) { goto modbad; }
  14819. #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
  14820. {
  14821. PyObject *modules = PyImport_GetModuleDict();
  14822. if (unlikely(!modules))
  14823. goto modbad;
  14824. value = PyObject_GetItem(modules, full_name);
  14825. }
  14826. #else
  14827. value = PyImport_GetModule(full_name);
  14828. #endif
  14829. modbad:
  14830. Py_XDECREF(full_name);
  14831. Py_XDECREF(module_dot);
  14832. Py_XDECREF(module_name);
  14833. }
  14834. if (unlikely(!value)) {
  14835. PyErr_Format(PyExc_ImportError,
  14836. #if PY_MAJOR_VERSION < 3
  14837. "cannot import name %.230s", PyString_AS_STRING(name));
  14838. #else
  14839. "cannot import name %S", name);
  14840. #endif
  14841. }
  14842. return value;
  14843. }
  14844. /* FetchSharedCythonModule */
  14845. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  14846. return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
  14847. }
  14848. /* FetchCommonType */
  14849. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  14850. const char *name,
  14851. Py_ssize_t basicsize,
  14852. Py_ssize_t expected_basicsize) {
  14853. if (!PyType_Check(cached_type)) {
  14854. PyErr_Format(PyExc_TypeError,
  14855. "Shared Cython type %.200s is not a type object", name);
  14856. return -1;
  14857. }
  14858. if (basicsize != expected_basicsize) {
  14859. PyErr_Format(PyExc_TypeError,
  14860. "Shared Cython type %.200s has the wrong size, try recompiling",
  14861. name);
  14862. return -1;
  14863. }
  14864. return 0;
  14865. }
  14866. #if !CYTHON_USE_TYPE_SPECS
  14867. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  14868. PyObject* abi_module;
  14869. const char* object_name;
  14870. PyTypeObject *cached_type = NULL;
  14871. abi_module = __Pyx_FetchSharedCythonABIModule();
  14872. if (!abi_module) return NULL;
  14873. object_name = strrchr(type->tp_name, '.');
  14874. object_name = object_name ? object_name+1 : type->tp_name;
  14875. cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
  14876. if (cached_type) {
  14877. if (__Pyx_VerifyCachedType(
  14878. (PyObject *)cached_type,
  14879. object_name,
  14880. cached_type->tp_basicsize,
  14881. type->tp_basicsize) < 0) {
  14882. goto bad;
  14883. }
  14884. goto done;
  14885. }
  14886. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  14887. PyErr_Clear();
  14888. if (PyType_Ready(type) < 0) goto bad;
  14889. if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
  14890. goto bad;
  14891. Py_INCREF(type);
  14892. cached_type = type;
  14893. done:
  14894. Py_DECREF(abi_module);
  14895. return cached_type;
  14896. bad:
  14897. Py_XDECREF(cached_type);
  14898. cached_type = NULL;
  14899. goto done;
  14900. }
  14901. #else
  14902. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
  14903. PyObject *abi_module, *cached_type = NULL;
  14904. const char* object_name = strrchr(spec->name, '.');
  14905. object_name = object_name ? object_name+1 : spec->name;
  14906. abi_module = __Pyx_FetchSharedCythonABIModule();
  14907. if (!abi_module) return NULL;
  14908. cached_type = PyObject_GetAttrString(abi_module, object_name);
  14909. if (cached_type) {
  14910. Py_ssize_t basicsize;
  14911. #if CYTHON_COMPILING_IN_LIMITED_API
  14912. PyObject *py_basicsize;
  14913. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  14914. if (unlikely(!py_basicsize)) goto bad;
  14915. basicsize = PyLong_AsSsize_t(py_basicsize);
  14916. Py_DECREF(py_basicsize);
  14917. py_basicsize = 0;
  14918. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
  14919. #else
  14920. basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
  14921. #endif
  14922. if (__Pyx_VerifyCachedType(
  14923. cached_type,
  14924. object_name,
  14925. basicsize,
  14926. spec->basicsize) < 0) {
  14927. goto bad;
  14928. }
  14929. goto done;
  14930. }
  14931. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  14932. PyErr_Clear();
  14933. CYTHON_UNUSED_VAR(module);
  14934. cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
  14935. if (unlikely(!cached_type)) goto bad;
  14936. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  14937. if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
  14938. done:
  14939. Py_DECREF(abi_module);
  14940. assert(cached_type == NULL || PyType_Check(cached_type));
  14941. return (PyTypeObject *) cached_type;
  14942. bad:
  14943. Py_XDECREF(cached_type);
  14944. cached_type = NULL;
  14945. goto done;
  14946. }
  14947. #endif
  14948. /* PyVectorcallFastCallDict */
  14949. #if CYTHON_METH_FASTCALL
  14950. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14951. {
  14952. PyObject *res = NULL;
  14953. PyObject *kwnames;
  14954. PyObject **newargs;
  14955. PyObject **kwvalues;
  14956. Py_ssize_t i, pos;
  14957. size_t j;
  14958. PyObject *key, *value;
  14959. unsigned long keys_are_strings;
  14960. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  14961. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  14962. if (unlikely(newargs == NULL)) {
  14963. PyErr_NoMemory();
  14964. return NULL;
  14965. }
  14966. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  14967. kwnames = PyTuple_New(nkw);
  14968. if (unlikely(kwnames == NULL)) {
  14969. PyMem_Free(newargs);
  14970. return NULL;
  14971. }
  14972. kwvalues = newargs + nargs;
  14973. pos = i = 0;
  14974. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  14975. while (PyDict_Next(kw, &pos, &key, &value)) {
  14976. keys_are_strings &= Py_TYPE(key)->tp_flags;
  14977. Py_INCREF(key);
  14978. Py_INCREF(value);
  14979. PyTuple_SET_ITEM(kwnames, i, key);
  14980. kwvalues[i] = value;
  14981. i++;
  14982. }
  14983. if (unlikely(!keys_are_strings)) {
  14984. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  14985. goto cleanup;
  14986. }
  14987. res = vc(func, newargs, nargs, kwnames);
  14988. cleanup:
  14989. Py_DECREF(kwnames);
  14990. for (i = 0; i < nkw; i++)
  14991. Py_DECREF(kwvalues[i]);
  14992. PyMem_Free(newargs);
  14993. return res;
  14994. }
  14995. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  14996. {
  14997. if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
  14998. return vc(func, args, nargs, NULL);
  14999. }
  15000. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  15001. }
  15002. #endif
  15003. /* CythonFunctionShared */
  15004. #if CYTHON_COMPILING_IN_LIMITED_API
  15005. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
  15006. if (__Pyx_CyFunction_Check(func)) {
  15007. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  15008. } else if (PyCFunction_Check(func)) {
  15009. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  15010. }
  15011. return 0;
  15012. }
  15013. #else
  15014. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
  15015. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  15016. }
  15017. #endif
  15018. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  15019. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  15020. __Pyx_Py_XDECREF_SET(
  15021. __Pyx_CyFunction_GetClassObj(f),
  15022. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  15023. #else
  15024. __Pyx_Py_XDECREF_SET(
  15025. ((PyCMethodObject *) (f))->mm_class,
  15026. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  15027. #endif
  15028. }
  15029. static PyObject *
  15030. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
  15031. {
  15032. CYTHON_UNUSED_VAR(closure);
  15033. if (unlikely(op->func_doc == NULL)) {
  15034. #if CYTHON_COMPILING_IN_LIMITED_API
  15035. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  15036. if (unlikely(!op->func_doc)) return NULL;
  15037. #else
  15038. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  15039. #if PY_MAJOR_VERSION >= 3
  15040. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  15041. #else
  15042. op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  15043. #endif
  15044. if (unlikely(op->func_doc == NULL))
  15045. return NULL;
  15046. } else {
  15047. Py_INCREF(Py_None);
  15048. return Py_None;
  15049. }
  15050. #endif
  15051. }
  15052. Py_INCREF(op->func_doc);
  15053. return op->func_doc;
  15054. }
  15055. static int
  15056. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15057. {
  15058. CYTHON_UNUSED_VAR(context);
  15059. if (value == NULL) {
  15060. value = Py_None;
  15061. }
  15062. Py_INCREF(value);
  15063. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  15064. return 0;
  15065. }
  15066. static PyObject *
  15067. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  15068. {
  15069. CYTHON_UNUSED_VAR(context);
  15070. if (unlikely(op->func_name == NULL)) {
  15071. #if CYTHON_COMPILING_IN_LIMITED_API
  15072. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  15073. #elif PY_MAJOR_VERSION >= 3
  15074. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  15075. #else
  15076. op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  15077. #endif
  15078. if (unlikely(op->func_name == NULL))
  15079. return NULL;
  15080. }
  15081. Py_INCREF(op->func_name);
  15082. return op->func_name;
  15083. }
  15084. static int
  15085. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15086. {
  15087. CYTHON_UNUSED_VAR(context);
  15088. #if PY_MAJOR_VERSION >= 3
  15089. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  15090. #else
  15091. if (unlikely(value == NULL || !PyString_Check(value)))
  15092. #endif
  15093. {
  15094. PyErr_SetString(PyExc_TypeError,
  15095. "__name__ must be set to a string object");
  15096. return -1;
  15097. }
  15098. Py_INCREF(value);
  15099. __Pyx_Py_XDECREF_SET(op->func_name, value);
  15100. return 0;
  15101. }
  15102. static PyObject *
  15103. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  15104. {
  15105. CYTHON_UNUSED_VAR(context);
  15106. Py_INCREF(op->func_qualname);
  15107. return op->func_qualname;
  15108. }
  15109. static int
  15110. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15111. {
  15112. CYTHON_UNUSED_VAR(context);
  15113. #if PY_MAJOR_VERSION >= 3
  15114. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  15115. #else
  15116. if (unlikely(value == NULL || !PyString_Check(value)))
  15117. #endif
  15118. {
  15119. PyErr_SetString(PyExc_TypeError,
  15120. "__qualname__ must be set to a string object");
  15121. return -1;
  15122. }
  15123. Py_INCREF(value);
  15124. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  15125. return 0;
  15126. }
  15127. static PyObject *
  15128. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  15129. {
  15130. CYTHON_UNUSED_VAR(context);
  15131. if (unlikely(op->func_dict == NULL)) {
  15132. op->func_dict = PyDict_New();
  15133. if (unlikely(op->func_dict == NULL))
  15134. return NULL;
  15135. }
  15136. Py_INCREF(op->func_dict);
  15137. return op->func_dict;
  15138. }
  15139. static int
  15140. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  15141. {
  15142. CYTHON_UNUSED_VAR(context);
  15143. if (unlikely(value == NULL)) {
  15144. PyErr_SetString(PyExc_TypeError,
  15145. "function's dictionary may not be deleted");
  15146. return -1;
  15147. }
  15148. if (unlikely(!PyDict_Check(value))) {
  15149. PyErr_SetString(PyExc_TypeError,
  15150. "setting function's dictionary to a non-dict");
  15151. return -1;
  15152. }
  15153. Py_INCREF(value);
  15154. __Pyx_Py_XDECREF_SET(op->func_dict, value);
  15155. return 0;
  15156. }
  15157. static PyObject *
  15158. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  15159. {
  15160. CYTHON_UNUSED_VAR(context);
  15161. Py_INCREF(op->func_globals);
  15162. return op->func_globals;
  15163. }
  15164. static PyObject *
  15165. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  15166. {
  15167. CYTHON_UNUSED_VAR(op);
  15168. CYTHON_UNUSED_VAR(context);
  15169. Py_INCREF(Py_None);
  15170. return Py_None;
  15171. }
  15172. static PyObject *
  15173. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  15174. {
  15175. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  15176. CYTHON_UNUSED_VAR(context);
  15177. Py_INCREF(result);
  15178. return result;
  15179. }
  15180. static int
  15181. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  15182. int result = 0;
  15183. PyObject *res = op->defaults_getter((PyObject *) op);
  15184. if (unlikely(!res))
  15185. return -1;
  15186. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15187. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  15188. Py_INCREF(op->defaults_tuple);
  15189. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  15190. Py_INCREF(op->defaults_kwdict);
  15191. #else
  15192. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  15193. if (unlikely(!op->defaults_tuple)) result = -1;
  15194. else {
  15195. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  15196. if (unlikely(!op->defaults_kwdict)) result = -1;
  15197. }
  15198. #endif
  15199. Py_DECREF(res);
  15200. return result;
  15201. }
  15202. static int
  15203. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15204. CYTHON_UNUSED_VAR(context);
  15205. if (!value) {
  15206. value = Py_None;
  15207. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  15208. PyErr_SetString(PyExc_TypeError,
  15209. "__defaults__ must be set to a tuple object");
  15210. return -1;
  15211. }
  15212. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  15213. "currently affect the values used in function calls", 1);
  15214. Py_INCREF(value);
  15215. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  15216. return 0;
  15217. }
  15218. static PyObject *
  15219. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  15220. PyObject* result = op->defaults_tuple;
  15221. CYTHON_UNUSED_VAR(context);
  15222. if (unlikely(!result)) {
  15223. if (op->defaults_getter) {
  15224. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15225. result = op->defaults_tuple;
  15226. } else {
  15227. result = Py_None;
  15228. }
  15229. }
  15230. Py_INCREF(result);
  15231. return result;
  15232. }
  15233. static int
  15234. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15235. CYTHON_UNUSED_VAR(context);
  15236. if (!value) {
  15237. value = Py_None;
  15238. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  15239. PyErr_SetString(PyExc_TypeError,
  15240. "__kwdefaults__ must be set to a dict object");
  15241. return -1;
  15242. }
  15243. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  15244. "currently affect the values used in function calls", 1);
  15245. Py_INCREF(value);
  15246. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  15247. return 0;
  15248. }
  15249. static PyObject *
  15250. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  15251. PyObject* result = op->defaults_kwdict;
  15252. CYTHON_UNUSED_VAR(context);
  15253. if (unlikely(!result)) {
  15254. if (op->defaults_getter) {
  15255. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  15256. result = op->defaults_kwdict;
  15257. } else {
  15258. result = Py_None;
  15259. }
  15260. }
  15261. Py_INCREF(result);
  15262. return result;
  15263. }
  15264. static int
  15265. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15266. CYTHON_UNUSED_VAR(context);
  15267. if (!value || value == Py_None) {
  15268. value = NULL;
  15269. } else if (unlikely(!PyDict_Check(value))) {
  15270. PyErr_SetString(PyExc_TypeError,
  15271. "__annotations__ must be set to a dict object");
  15272. return -1;
  15273. }
  15274. Py_XINCREF(value);
  15275. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  15276. return 0;
  15277. }
  15278. static PyObject *
  15279. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  15280. PyObject* result = op->func_annotations;
  15281. CYTHON_UNUSED_VAR(context);
  15282. if (unlikely(!result)) {
  15283. result = PyDict_New();
  15284. if (unlikely(!result)) return NULL;
  15285. op->func_annotations = result;
  15286. }
  15287. Py_INCREF(result);
  15288. return result;
  15289. }
  15290. static PyObject *
  15291. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  15292. int is_coroutine;
  15293. CYTHON_UNUSED_VAR(context);
  15294. if (op->func_is_coroutine) {
  15295. return __Pyx_NewRef(op->func_is_coroutine);
  15296. }
  15297. is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  15298. #if PY_VERSION_HEX >= 0x03050000
  15299. if (is_coroutine) {
  15300. PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
  15301. fromlist = PyList_New(1);
  15302. if (unlikely(!fromlist)) return NULL;
  15303. Py_INCREF(marker);
  15304. #if CYTHON_ASSUME_SAFE_MACROS
  15305. PyList_SET_ITEM(fromlist, 0, marker);
  15306. #else
  15307. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  15308. Py_DECREF(marker);
  15309. Py_DECREF(fromlist);
  15310. return NULL;
  15311. }
  15312. #endif
  15313. module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
  15314. Py_DECREF(fromlist);
  15315. if (unlikely(!module)) goto ignore;
  15316. op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
  15317. Py_DECREF(module);
  15318. if (likely(op->func_is_coroutine)) {
  15319. return __Pyx_NewRef(op->func_is_coroutine);
  15320. }
  15321. ignore:
  15322. PyErr_Clear();
  15323. }
  15324. #endif
  15325. op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
  15326. return __Pyx_NewRef(op->func_is_coroutine);
  15327. }
  15328. #if CYTHON_COMPILING_IN_LIMITED_API
  15329. static PyObject *
  15330. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  15331. CYTHON_UNUSED_VAR(context);
  15332. return PyObject_GetAttrString(op->func, "__module__");
  15333. }
  15334. static int
  15335. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  15336. CYTHON_UNUSED_VAR(context);
  15337. return PyObject_SetAttrString(op->func, "__module__", value);
  15338. }
  15339. #endif
  15340. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  15341. {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15342. {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  15343. {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15344. {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  15345. {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  15346. {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  15347. {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  15348. {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15349. {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  15350. {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15351. {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  15352. {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15353. {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  15354. {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15355. {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  15356. {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  15357. {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  15358. {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  15359. #if CYTHON_COMPILING_IN_LIMITED_API
  15360. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  15361. #endif
  15362. {0, 0, 0, 0, 0}
  15363. };
  15364. static PyMemberDef __pyx_CyFunction_members[] = {
  15365. #if !CYTHON_COMPILING_IN_LIMITED_API
  15366. {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  15367. #endif
  15368. #if CYTHON_USE_TYPE_SPECS
  15369. {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  15370. #if CYTHON_METH_FASTCALL
  15371. #if CYTHON_BACKPORT_VECTORCALL
  15372. {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  15373. #else
  15374. #if !CYTHON_COMPILING_IN_LIMITED_API
  15375. {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  15376. #endif
  15377. #endif
  15378. #endif
  15379. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  15380. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  15381. #else
  15382. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  15383. #endif
  15384. #endif
  15385. {0, 0, 0, 0, 0}
  15386. };
  15387. static PyObject *
  15388. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  15389. {
  15390. CYTHON_UNUSED_VAR(args);
  15391. #if PY_MAJOR_VERSION >= 3
  15392. Py_INCREF(m->func_qualname);
  15393. return m->func_qualname;
  15394. #else
  15395. return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
  15396. #endif
  15397. }
  15398. static PyMethodDef __pyx_CyFunction_methods[] = {
  15399. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  15400. {0, 0, 0, 0}
  15401. };
  15402. #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
  15403. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  15404. #else
  15405. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  15406. #endif
  15407. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  15408. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  15409. #if !CYTHON_COMPILING_IN_LIMITED_API
  15410. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  15411. #endif
  15412. if (unlikely(op == NULL))
  15413. return NULL;
  15414. #if CYTHON_COMPILING_IN_LIMITED_API
  15415. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  15416. if (unlikely(!op->func)) return NULL;
  15417. #endif
  15418. op->flags = flags;
  15419. __Pyx_CyFunction_weakreflist(op) = NULL;
  15420. #if !CYTHON_COMPILING_IN_LIMITED_API
  15421. cf->m_ml = ml;
  15422. cf->m_self = (PyObject *) op;
  15423. #endif
  15424. Py_XINCREF(closure);
  15425. op->func_closure = closure;
  15426. #if !CYTHON_COMPILING_IN_LIMITED_API
  15427. Py_XINCREF(module);
  15428. cf->m_module = module;
  15429. #endif
  15430. op->func_dict = NULL;
  15431. op->func_name = NULL;
  15432. Py_INCREF(qualname);
  15433. op->func_qualname = qualname;
  15434. op->func_doc = NULL;
  15435. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  15436. op->func_classobj = NULL;
  15437. #else
  15438. ((PyCMethodObject*)op)->mm_class = NULL;
  15439. #endif
  15440. op->func_globals = globals;
  15441. Py_INCREF(op->func_globals);
  15442. Py_XINCREF(code);
  15443. op->func_code = code;
  15444. op->defaults_pyobjects = 0;
  15445. op->defaults_size = 0;
  15446. op->defaults = NULL;
  15447. op->defaults_tuple = NULL;
  15448. op->defaults_kwdict = NULL;
  15449. op->defaults_getter = NULL;
  15450. op->func_annotations = NULL;
  15451. op->func_is_coroutine = NULL;
  15452. #if CYTHON_METH_FASTCALL
  15453. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  15454. case METH_NOARGS:
  15455. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  15456. break;
  15457. case METH_O:
  15458. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  15459. break;
  15460. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  15461. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  15462. break;
  15463. case METH_FASTCALL | METH_KEYWORDS:
  15464. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  15465. break;
  15466. case METH_VARARGS | METH_KEYWORDS:
  15467. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  15468. break;
  15469. default:
  15470. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15471. Py_DECREF(op);
  15472. return NULL;
  15473. }
  15474. #endif
  15475. return (PyObject *) op;
  15476. }
  15477. static int
  15478. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  15479. {
  15480. Py_CLEAR(m->func_closure);
  15481. #if CYTHON_COMPILING_IN_LIMITED_API
  15482. Py_CLEAR(m->func);
  15483. #else
  15484. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  15485. #endif
  15486. Py_CLEAR(m->func_dict);
  15487. Py_CLEAR(m->func_name);
  15488. Py_CLEAR(m->func_qualname);
  15489. Py_CLEAR(m->func_doc);
  15490. Py_CLEAR(m->func_globals);
  15491. Py_CLEAR(m->func_code);
  15492. #if !CYTHON_COMPILING_IN_LIMITED_API
  15493. #if PY_VERSION_HEX < 0x030900B1
  15494. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  15495. #else
  15496. {
  15497. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  15498. ((PyCMethodObject *) (m))->mm_class = NULL;
  15499. Py_XDECREF(cls);
  15500. }
  15501. #endif
  15502. #endif
  15503. Py_CLEAR(m->defaults_tuple);
  15504. Py_CLEAR(m->defaults_kwdict);
  15505. Py_CLEAR(m->func_annotations);
  15506. Py_CLEAR(m->func_is_coroutine);
  15507. if (m->defaults) {
  15508. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  15509. int i;
  15510. for (i = 0; i < m->defaults_pyobjects; i++)
  15511. Py_XDECREF(pydefaults[i]);
  15512. PyObject_Free(m->defaults);
  15513. m->defaults = NULL;
  15514. }
  15515. return 0;
  15516. }
  15517. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15518. {
  15519. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  15520. PyObject_ClearWeakRefs((PyObject *) m);
  15521. __Pyx_CyFunction_clear(m);
  15522. __Pyx_PyHeapTypeObject_GC_Del(m);
  15523. }
  15524. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  15525. {
  15526. PyObject_GC_UnTrack(m);
  15527. __Pyx__CyFunction_dealloc(m);
  15528. }
  15529. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  15530. {
  15531. Py_VISIT(m->func_closure);
  15532. #if CYTHON_COMPILING_IN_LIMITED_API
  15533. Py_VISIT(m->func);
  15534. #else
  15535. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  15536. #endif
  15537. Py_VISIT(m->func_dict);
  15538. Py_VISIT(m->func_name);
  15539. Py_VISIT(m->func_qualname);
  15540. Py_VISIT(m->func_doc);
  15541. Py_VISIT(m->func_globals);
  15542. Py_VISIT(m->func_code);
  15543. #if !CYTHON_COMPILING_IN_LIMITED_API
  15544. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  15545. #endif
  15546. Py_VISIT(m->defaults_tuple);
  15547. Py_VISIT(m->defaults_kwdict);
  15548. Py_VISIT(m->func_is_coroutine);
  15549. if (m->defaults) {
  15550. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  15551. int i;
  15552. for (i = 0; i < m->defaults_pyobjects; i++)
  15553. Py_VISIT(pydefaults[i]);
  15554. }
  15555. return 0;
  15556. }
  15557. static PyObject*
  15558. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  15559. {
  15560. #if PY_MAJOR_VERSION >= 3
  15561. return PyUnicode_FromFormat("<cyfunction %U at %p>",
  15562. op->func_qualname, (void *)op);
  15563. #else
  15564. return PyString_FromFormat("<cyfunction %s at %p>",
  15565. PyString_AsString(op->func_qualname), (void *)op);
  15566. #endif
  15567. }
  15568. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  15569. #if CYTHON_COMPILING_IN_LIMITED_API
  15570. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  15571. PyObject *py_name = NULL;
  15572. PyCFunction meth;
  15573. int flags;
  15574. meth = PyCFunction_GetFunction(f);
  15575. if (unlikely(!meth)) return NULL;
  15576. flags = PyCFunction_GetFlags(f);
  15577. if (unlikely(flags < 0)) return NULL;
  15578. #else
  15579. PyCFunctionObject* f = (PyCFunctionObject*)func;
  15580. PyCFunction meth = f->m_ml->ml_meth;
  15581. int flags = f->m_ml->ml_flags;
  15582. #endif
  15583. Py_ssize_t size;
  15584. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  15585. case METH_VARARGS:
  15586. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  15587. return (*meth)(self, arg);
  15588. break;
  15589. case METH_VARARGS | METH_KEYWORDS:
  15590. return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
  15591. case METH_NOARGS:
  15592. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15593. #if CYTHON_ASSUME_SAFE_MACROS
  15594. size = PyTuple_GET_SIZE(arg);
  15595. #else
  15596. size = PyTuple_Size(arg);
  15597. if (unlikely(size < 0)) return NULL;
  15598. #endif
  15599. if (likely(size == 0))
  15600. return (*meth)(self, NULL);
  15601. #if CYTHON_COMPILING_IN_LIMITED_API
  15602. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  15603. if (!py_name) return NULL;
  15604. PyErr_Format(PyExc_TypeError,
  15605. "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15606. py_name, size);
  15607. Py_DECREF(py_name);
  15608. #else
  15609. PyErr_Format(PyExc_TypeError,
  15610. "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15611. f->m_ml->ml_name, size);
  15612. #endif
  15613. return NULL;
  15614. }
  15615. break;
  15616. case METH_O:
  15617. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  15618. #if CYTHON_ASSUME_SAFE_MACROS
  15619. size = PyTuple_GET_SIZE(arg);
  15620. #else
  15621. size = PyTuple_Size(arg);
  15622. if (unlikely(size < 0)) return NULL;
  15623. #endif
  15624. if (likely(size == 1)) {
  15625. PyObject *result, *arg0;
  15626. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15627. arg0 = PyTuple_GET_ITEM(arg, 0);
  15628. #else
  15629. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  15630. #endif
  15631. result = (*meth)(self, arg0);
  15632. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  15633. Py_DECREF(arg0);
  15634. #endif
  15635. return result;
  15636. }
  15637. #if CYTHON_COMPILING_IN_LIMITED_API
  15638. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  15639. if (!py_name) return NULL;
  15640. PyErr_Format(PyExc_TypeError,
  15641. "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15642. py_name, size);
  15643. Py_DECREF(py_name);
  15644. #else
  15645. PyErr_Format(PyExc_TypeError,
  15646. "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15647. f->m_ml->ml_name, size);
  15648. #endif
  15649. return NULL;
  15650. }
  15651. break;
  15652. default:
  15653. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  15654. return NULL;
  15655. }
  15656. #if CYTHON_COMPILING_IN_LIMITED_API
  15657. py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
  15658. if (!py_name) return NULL;
  15659. PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
  15660. py_name);
  15661. Py_DECREF(py_name);
  15662. #else
  15663. PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  15664. f->m_ml->ml_name);
  15665. #endif
  15666. return NULL;
  15667. }
  15668. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  15669. PyObject *self, *result;
  15670. #if CYTHON_COMPILING_IN_LIMITED_API
  15671. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  15672. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  15673. #else
  15674. self = ((PyCFunctionObject*)func)->m_self;
  15675. #endif
  15676. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  15677. return result;
  15678. }
  15679. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  15680. PyObject *result;
  15681. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  15682. #if CYTHON_METH_FASTCALL
  15683. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  15684. if (vc) {
  15685. #if CYTHON_ASSUME_SAFE_MACROS
  15686. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  15687. #else
  15688. (void) &__Pyx_PyVectorcall_FastCallDict;
  15689. return PyVectorcall_Call(func, args, kw);
  15690. #endif
  15691. }
  15692. #endif
  15693. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15694. Py_ssize_t argc;
  15695. PyObject *new_args;
  15696. PyObject *self;
  15697. #if CYTHON_ASSUME_SAFE_MACROS
  15698. argc = PyTuple_GET_SIZE(args);
  15699. #else
  15700. argc = PyTuple_Size(args);
  15701. if (unlikely(!argc) < 0) return NULL;
  15702. #endif
  15703. new_args = PyTuple_GetSlice(args, 1, argc);
  15704. if (unlikely(!new_args))
  15705. return NULL;
  15706. self = PyTuple_GetItem(args, 0);
  15707. if (unlikely(!self)) {
  15708. Py_DECREF(new_args);
  15709. #if PY_MAJOR_VERSION > 2
  15710. PyErr_Format(PyExc_TypeError,
  15711. "unbound method %.200S() needs an argument",
  15712. cyfunc->func_qualname);
  15713. #else
  15714. PyErr_SetString(PyExc_TypeError,
  15715. "unbound method needs an argument");
  15716. #endif
  15717. return NULL;
  15718. }
  15719. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  15720. Py_DECREF(new_args);
  15721. } else {
  15722. result = __Pyx_CyFunction_Call(func, args, kw);
  15723. }
  15724. return result;
  15725. }
  15726. #if CYTHON_METH_FASTCALL
  15727. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  15728. {
  15729. int ret = 0;
  15730. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  15731. if (unlikely(nargs < 1)) {
  15732. PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
  15733. ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
  15734. return -1;
  15735. }
  15736. ret = 1;
  15737. }
  15738. if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
  15739. PyErr_Format(PyExc_TypeError,
  15740. "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
  15741. return -1;
  15742. }
  15743. return ret;
  15744. }
  15745. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15746. {
  15747. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15748. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  15749. #if CYTHON_BACKPORT_VECTORCALL
  15750. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  15751. #else
  15752. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15753. #endif
  15754. PyObject *self;
  15755. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15756. case 1:
  15757. self = args[0];
  15758. args += 1;
  15759. nargs -= 1;
  15760. break;
  15761. case 0:
  15762. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15763. break;
  15764. default:
  15765. return NULL;
  15766. }
  15767. if (unlikely(nargs != 0)) {
  15768. PyErr_Format(PyExc_TypeError,
  15769. "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15770. def->ml_name, nargs);
  15771. return NULL;
  15772. }
  15773. return def->ml_meth(self, NULL);
  15774. }
  15775. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15776. {
  15777. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15778. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  15779. #if CYTHON_BACKPORT_VECTORCALL
  15780. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  15781. #else
  15782. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15783. #endif
  15784. PyObject *self;
  15785. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  15786. case 1:
  15787. self = args[0];
  15788. args += 1;
  15789. nargs -= 1;
  15790. break;
  15791. case 0:
  15792. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15793. break;
  15794. default:
  15795. return NULL;
  15796. }
  15797. if (unlikely(nargs != 1)) {
  15798. PyErr_Format(PyExc_TypeError,
  15799. "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  15800. def->ml_name, nargs);
  15801. return NULL;
  15802. }
  15803. return def->ml_meth(self, args[0]);
  15804. }
  15805. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15806. {
  15807. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15808. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  15809. #if CYTHON_BACKPORT_VECTORCALL
  15810. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  15811. #else
  15812. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15813. #endif
  15814. PyObject *self;
  15815. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15816. case 1:
  15817. self = args[0];
  15818. args += 1;
  15819. nargs -= 1;
  15820. break;
  15821. case 0:
  15822. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15823. break;
  15824. default:
  15825. return NULL;
  15826. }
  15827. return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
  15828. }
  15829. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  15830. {
  15831. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  15832. PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
  15833. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  15834. #if CYTHON_BACKPORT_VECTORCALL
  15835. Py_ssize_t nargs = (Py_ssize_t)nargsf;
  15836. #else
  15837. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  15838. #endif
  15839. PyObject *self;
  15840. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  15841. case 1:
  15842. self = args[0];
  15843. args += 1;
  15844. nargs -= 1;
  15845. break;
  15846. case 0:
  15847. self = ((PyCFunctionObject*)cyfunc)->m_self;
  15848. break;
  15849. default:
  15850. return NULL;
  15851. }
  15852. return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
  15853. }
  15854. #endif
  15855. #if CYTHON_USE_TYPE_SPECS
  15856. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  15857. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  15858. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  15859. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  15860. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  15861. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  15862. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  15863. {Py_tp_members, (void *)__pyx_CyFunction_members},
  15864. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  15865. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  15866. {0, 0},
  15867. };
  15868. static PyType_Spec __pyx_CyFunctionType_spec = {
  15869. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  15870. sizeof(__pyx_CyFunctionObject),
  15871. 0,
  15872. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  15873. Py_TPFLAGS_METHOD_DESCRIPTOR |
  15874. #endif
  15875. #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
  15876. _Py_TPFLAGS_HAVE_VECTORCALL |
  15877. #endif
  15878. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  15879. __pyx_CyFunctionType_slots
  15880. };
  15881. #else
  15882. static PyTypeObject __pyx_CyFunctionType_type = {
  15883. PyVarObject_HEAD_INIT(0, 0)
  15884. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  15885. sizeof(__pyx_CyFunctionObject),
  15886. 0,
  15887. (destructor) __Pyx_CyFunction_dealloc,
  15888. #if !CYTHON_METH_FASTCALL
  15889. 0,
  15890. #elif CYTHON_BACKPORT_VECTORCALL
  15891. (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
  15892. #else
  15893. offsetof(PyCFunctionObject, vectorcall),
  15894. #endif
  15895. 0,
  15896. 0,
  15897. #if PY_MAJOR_VERSION < 3
  15898. 0,
  15899. #else
  15900. 0,
  15901. #endif
  15902. (reprfunc) __Pyx_CyFunction_repr,
  15903. 0,
  15904. 0,
  15905. 0,
  15906. 0,
  15907. __Pyx_CyFunction_CallAsMethod,
  15908. 0,
  15909. 0,
  15910. 0,
  15911. 0,
  15912. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  15913. Py_TPFLAGS_METHOD_DESCRIPTOR |
  15914. #endif
  15915. #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
  15916. _Py_TPFLAGS_HAVE_VECTORCALL |
  15917. #endif
  15918. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  15919. 0,
  15920. (traverseproc) __Pyx_CyFunction_traverse,
  15921. (inquiry) __Pyx_CyFunction_clear,
  15922. 0,
  15923. #if PY_VERSION_HEX < 0x030500A0
  15924. offsetof(__pyx_CyFunctionObject, func_weakreflist),
  15925. #else
  15926. offsetof(PyCFunctionObject, m_weakreflist),
  15927. #endif
  15928. 0,
  15929. 0,
  15930. __pyx_CyFunction_methods,
  15931. __pyx_CyFunction_members,
  15932. __pyx_CyFunction_getsets,
  15933. 0,
  15934. 0,
  15935. __Pyx_PyMethod_New,
  15936. 0,
  15937. offsetof(__pyx_CyFunctionObject, func_dict),
  15938. 0,
  15939. 0,
  15940. 0,
  15941. 0,
  15942. 0,
  15943. 0,
  15944. 0,
  15945. 0,
  15946. 0,
  15947. 0,
  15948. 0,
  15949. 0,
  15950. #if PY_VERSION_HEX >= 0x030400a1
  15951. 0,
  15952. #endif
  15953. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  15954. 0,
  15955. #endif
  15956. #if __PYX_NEED_TP_PRINT_SLOT
  15957. 0,
  15958. #endif
  15959. #if PY_VERSION_HEX >= 0x030C0000
  15960. 0,
  15961. #endif
  15962. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  15963. 0,
  15964. #endif
  15965. };
  15966. #endif
  15967. static int __pyx_CyFunction_init(PyObject *module) {
  15968. #if CYTHON_USE_TYPE_SPECS
  15969. __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
  15970. #else
  15971. CYTHON_UNUSED_VAR(module);
  15972. __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  15973. #endif
  15974. if (unlikely(__pyx_CyFunctionType == NULL)) {
  15975. return -1;
  15976. }
  15977. return 0;
  15978. }
  15979. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  15980. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15981. m->defaults = PyObject_Malloc(size);
  15982. if (unlikely(!m->defaults))
  15983. return PyErr_NoMemory();
  15984. memset(m->defaults, 0, size);
  15985. m->defaults_pyobjects = pyobjects;
  15986. m->defaults_size = size;
  15987. return m->defaults;
  15988. }
  15989. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  15990. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15991. m->defaults_tuple = tuple;
  15992. Py_INCREF(tuple);
  15993. }
  15994. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  15995. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  15996. m->defaults_kwdict = dict;
  15997. Py_INCREF(dict);
  15998. }
  15999. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  16000. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  16001. m->func_annotations = dict;
  16002. Py_INCREF(dict);
  16003. }
  16004. /* CythonFunction */
  16005. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  16006. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  16007. PyObject *op = __Pyx_CyFunction_Init(
  16008. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
  16009. ml, flags, qualname, closure, module, globals, code
  16010. );
  16011. if (likely(op)) {
  16012. PyObject_GC_Track(op);
  16013. }
  16014. return op;
  16015. }
  16016. /* CLineInTraceback */
  16017. #ifndef CYTHON_CLINE_IN_TRACEBACK
  16018. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  16019. PyObject *use_cline;
  16020. PyObject *ptype, *pvalue, *ptraceback;
  16021. #if CYTHON_COMPILING_IN_CPYTHON
  16022. PyObject **cython_runtime_dict;
  16023. #endif
  16024. CYTHON_MAYBE_UNUSED_VAR(tstate);
  16025. if (unlikely(!__pyx_cython_runtime)) {
  16026. return c_line;
  16027. }
  16028. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  16029. #if CYTHON_COMPILING_IN_CPYTHON
  16030. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  16031. if (likely(cython_runtime_dict)) {
  16032. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  16033. use_cline, *cython_runtime_dict,
  16034. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  16035. } else
  16036. #endif
  16037. {
  16038. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  16039. if (use_cline_obj) {
  16040. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  16041. Py_DECREF(use_cline_obj);
  16042. } else {
  16043. PyErr_Clear();
  16044. use_cline = NULL;
  16045. }
  16046. }
  16047. if (!use_cline) {
  16048. c_line = 0;
  16049. (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  16050. }
  16051. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  16052. c_line = 0;
  16053. }
  16054. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  16055. return c_line;
  16056. }
  16057. #endif
  16058. /* CodeObjectCache */
  16059. #if !CYTHON_COMPILING_IN_LIMITED_API
  16060. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  16061. int start = 0, mid = 0, end = count - 1;
  16062. if (end >= 0 && code_line > entries[end].code_line) {
  16063. return count;
  16064. }
  16065. while (start < end) {
  16066. mid = start + (end - start) / 2;
  16067. if (code_line < entries[mid].code_line) {
  16068. end = mid;
  16069. } else if (code_line > entries[mid].code_line) {
  16070. start = mid + 1;
  16071. } else {
  16072. return mid;
  16073. }
  16074. }
  16075. if (code_line <= entries[mid].code_line) {
  16076. return mid;
  16077. } else {
  16078. return mid + 1;
  16079. }
  16080. }
  16081. static PyCodeObject *__pyx_find_code_object(int code_line) {
  16082. PyCodeObject* code_object;
  16083. int pos;
  16084. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  16085. return NULL;
  16086. }
  16087. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  16088. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  16089. return NULL;
  16090. }
  16091. code_object = __pyx_code_cache.entries[pos].code_object;
  16092. Py_INCREF(code_object);
  16093. return code_object;
  16094. }
  16095. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  16096. int pos, i;
  16097. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  16098. if (unlikely(!code_line)) {
  16099. return;
  16100. }
  16101. if (unlikely(!entries)) {
  16102. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  16103. if (likely(entries)) {
  16104. __pyx_code_cache.entries = entries;
  16105. __pyx_code_cache.max_count = 64;
  16106. __pyx_code_cache.count = 1;
  16107. entries[0].code_line = code_line;
  16108. entries[0].code_object = code_object;
  16109. Py_INCREF(code_object);
  16110. }
  16111. return;
  16112. }
  16113. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  16114. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  16115. PyCodeObject* tmp = entries[pos].code_object;
  16116. entries[pos].code_object = code_object;
  16117. Py_DECREF(tmp);
  16118. return;
  16119. }
  16120. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  16121. int new_max = __pyx_code_cache.max_count + 64;
  16122. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  16123. __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  16124. if (unlikely(!entries)) {
  16125. return;
  16126. }
  16127. __pyx_code_cache.entries = entries;
  16128. __pyx_code_cache.max_count = new_max;
  16129. }
  16130. for (i=__pyx_code_cache.count; i>pos; i--) {
  16131. entries[i] = entries[i-1];
  16132. }
  16133. entries[pos].code_line = code_line;
  16134. entries[pos].code_object = code_object;
  16135. __pyx_code_cache.count++;
  16136. Py_INCREF(code_object);
  16137. }
  16138. #endif
  16139. /* AddTraceback */
  16140. #include "compile.h"
  16141. #include "frameobject.h"
  16142. #include "traceback.h"
  16143. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
  16144. #ifndef Py_BUILD_CORE
  16145. #define Py_BUILD_CORE 1
  16146. #endif
  16147. #include "internal/pycore_frame.h"
  16148. #endif
  16149. #if CYTHON_COMPILING_IN_LIMITED_API
  16150. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  16151. PyObject *firstlineno, PyObject *name) {
  16152. PyObject *replace = NULL;
  16153. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  16154. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  16155. replace = PyObject_GetAttrString(code, "replace");
  16156. if (likely(replace)) {
  16157. PyObject *result;
  16158. result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
  16159. Py_DECREF(replace);
  16160. return result;
  16161. }
  16162. PyErr_Clear();
  16163. #if __PYX_LIMITED_VERSION_HEX < 0x030780000
  16164. {
  16165. PyObject *compiled = NULL, *result = NULL;
  16166. if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
  16167. if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
  16168. compiled = Py_CompileString(
  16169. "out = type(code)(\n"
  16170. " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
  16171. " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
  16172. " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
  16173. " code.co_lnotab)\n", "<dummy>", Py_file_input);
  16174. if (!compiled) return NULL;
  16175. result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
  16176. Py_DECREF(compiled);
  16177. if (!result) PyErr_Print();
  16178. Py_DECREF(result);
  16179. result = PyDict_GetItemString(scratch_dict, "out");
  16180. if (result) Py_INCREF(result);
  16181. return result;
  16182. }
  16183. #else
  16184. return NULL;
  16185. #endif
  16186. }
  16187. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16188. int py_line, const char *filename) {
  16189. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  16190. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  16191. PyObject *exc_type, *exc_value, *exc_traceback;
  16192. int success = 0;
  16193. if (c_line) {
  16194. (void) __pyx_cfilenm;
  16195. (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  16196. }
  16197. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  16198. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  16199. if (unlikely(!code_object)) goto bad;
  16200. py_py_line = PyLong_FromLong(py_line);
  16201. if (unlikely(!py_py_line)) goto bad;
  16202. py_funcname = PyUnicode_FromString(funcname);
  16203. if (unlikely(!py_funcname)) goto bad;
  16204. dict = PyDict_New();
  16205. if (unlikely(!dict)) goto bad;
  16206. {
  16207. PyObject *old_code_object = code_object;
  16208. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  16209. Py_DECREF(old_code_object);
  16210. }
  16211. if (unlikely(!code_object)) goto bad;
  16212. getframe = PySys_GetObject("_getframe");
  16213. if (unlikely(!getframe)) goto bad;
  16214. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  16215. frame = PyEval_EvalCode(code_object, dict, dict);
  16216. if (unlikely(!frame) || frame == Py_None) goto bad;
  16217. success = 1;
  16218. bad:
  16219. PyErr_Restore(exc_type, exc_value, exc_traceback);
  16220. Py_XDECREF(code_object);
  16221. Py_XDECREF(py_py_line);
  16222. Py_XDECREF(py_funcname);
  16223. Py_XDECREF(dict);
  16224. Py_XDECREF(replace);
  16225. if (success) {
  16226. PyTraceBack_Here(
  16227. (struct _frame*)frame);
  16228. }
  16229. Py_XDECREF(frame);
  16230. }
  16231. #else
  16232. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  16233. const char *funcname, int c_line,
  16234. int py_line, const char *filename) {
  16235. PyCodeObject *py_code = NULL;
  16236. PyObject *py_funcname = NULL;
  16237. #if PY_MAJOR_VERSION < 3
  16238. PyObject *py_srcfile = NULL;
  16239. py_srcfile = PyString_FromString(filename);
  16240. if (!py_srcfile) goto bad;
  16241. #endif
  16242. if (c_line) {
  16243. #if PY_MAJOR_VERSION < 3
  16244. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16245. if (!py_funcname) goto bad;
  16246. #else
  16247. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  16248. if (!py_funcname) goto bad;
  16249. funcname = PyUnicode_AsUTF8(py_funcname);
  16250. if (!funcname) goto bad;
  16251. #endif
  16252. }
  16253. else {
  16254. #if PY_MAJOR_VERSION < 3
  16255. py_funcname = PyString_FromString(funcname);
  16256. if (!py_funcname) goto bad;
  16257. #endif
  16258. }
  16259. #if PY_MAJOR_VERSION < 3
  16260. py_code = __Pyx_PyCode_New(
  16261. 0,
  16262. 0,
  16263. 0,
  16264. 0,
  16265. 0,
  16266. 0,
  16267. __pyx_empty_bytes, /*PyObject *code,*/
  16268. __pyx_empty_tuple, /*PyObject *consts,*/
  16269. __pyx_empty_tuple, /*PyObject *names,*/
  16270. __pyx_empty_tuple, /*PyObject *varnames,*/
  16271. __pyx_empty_tuple, /*PyObject *freevars,*/
  16272. __pyx_empty_tuple, /*PyObject *cellvars,*/
  16273. py_srcfile, /*PyObject *filename,*/
  16274. py_funcname, /*PyObject *name,*/
  16275. py_line,
  16276. __pyx_empty_bytes /*PyObject *lnotab*/
  16277. );
  16278. Py_DECREF(py_srcfile);
  16279. #else
  16280. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  16281. #endif
  16282. Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
  16283. return py_code;
  16284. bad:
  16285. Py_XDECREF(py_funcname);
  16286. #if PY_MAJOR_VERSION < 3
  16287. Py_XDECREF(py_srcfile);
  16288. #endif
  16289. return NULL;
  16290. }
  16291. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  16292. int py_line, const char *filename) {
  16293. PyCodeObject *py_code = 0;
  16294. PyFrameObject *py_frame = 0;
  16295. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  16296. PyObject *ptype, *pvalue, *ptraceback;
  16297. if (c_line) {
  16298. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  16299. }
  16300. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  16301. if (!py_code) {
  16302. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  16303. py_code = __Pyx_CreateCodeObjectForTraceback(
  16304. funcname, c_line, py_line, filename);
  16305. if (!py_code) {
  16306. /* If the code object creation fails, then we should clear the
  16307. fetched exception references and propagate the new exception */
  16308. Py_XDECREF(ptype);
  16309. Py_XDECREF(pvalue);
  16310. Py_XDECREF(ptraceback);
  16311. goto bad;
  16312. }
  16313. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  16314. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  16315. }
  16316. py_frame = PyFrame_New(
  16317. tstate, /*PyThreadState *tstate,*/
  16318. py_code, /*PyCodeObject *code,*/
  16319. __pyx_d, /*PyObject *globals,*/
  16320. 0 /*PyObject *locals*/
  16321. );
  16322. if (!py_frame) goto bad;
  16323. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  16324. PyTraceBack_Here(py_frame);
  16325. bad:
  16326. Py_XDECREF(py_code);
  16327. Py_XDECREF(py_frame);
  16328. }
  16329. #endif
  16330. /* CIntFromPyVerify */
  16331. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  16332. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  16333. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  16334. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  16335. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  16336. {\
  16337. func_type value = func_value;\
  16338. if (sizeof(target_type) < sizeof(func_type)) {\
  16339. if (unlikely(value != (func_type) (target_type) value)) {\
  16340. func_type zero = 0;\
  16341. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  16342. return (target_type) -1;\
  16343. if (is_unsigned && unlikely(value < zero))\
  16344. goto raise_neg_overflow;\
  16345. else\
  16346. goto raise_overflow;\
  16347. }\
  16348. }\
  16349. return (target_type) value;\
  16350. }
  16351. /* CIntFromPy */
  16352. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  16353. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16354. #pragma GCC diagnostic push
  16355. #pragma GCC diagnostic ignored "-Wconversion"
  16356. #endif
  16357. const int neg_one = (int) -1, const_zero = (int) 0;
  16358. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16359. #pragma GCC diagnostic pop
  16360. #endif
  16361. const int is_unsigned = neg_one > const_zero;
  16362. #if PY_MAJOR_VERSION < 3
  16363. if (likely(PyInt_Check(x))) {
  16364. if ((sizeof(int) < sizeof(long))) {
  16365. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  16366. } else {
  16367. long val = PyInt_AS_LONG(x);
  16368. if (is_unsigned && unlikely(val < 0)) {
  16369. goto raise_neg_overflow;
  16370. }
  16371. return (int) val;
  16372. }
  16373. } else
  16374. #endif
  16375. if (likely(PyLong_Check(x))) {
  16376. if (is_unsigned) {
  16377. #if CYTHON_USE_PYLONG_INTERNALS
  16378. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16379. goto raise_neg_overflow;
  16380. } else if (__Pyx_PyLong_IsCompact(x)) {
  16381. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16382. } else {
  16383. const digit* digits = __Pyx_PyLong_Digits(x);
  16384. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16385. switch (__Pyx_PyLong_DigitCount(x)) {
  16386. case 2:
  16387. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16388. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16389. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16390. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  16391. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16392. }
  16393. }
  16394. break;
  16395. case 3:
  16396. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16397. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16398. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16399. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  16400. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16401. }
  16402. }
  16403. break;
  16404. case 4:
  16405. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16406. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16407. __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])))
  16408. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  16409. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  16410. }
  16411. }
  16412. break;
  16413. }
  16414. }
  16415. #endif
  16416. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16417. if (unlikely(Py_SIZE(x) < 0)) {
  16418. goto raise_neg_overflow;
  16419. }
  16420. #else
  16421. {
  16422. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16423. if (unlikely(result < 0))
  16424. return (int) -1;
  16425. if (unlikely(result == 1))
  16426. goto raise_neg_overflow;
  16427. }
  16428. #endif
  16429. if ((sizeof(int) <= sizeof(unsigned long))) {
  16430. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  16431. #ifdef HAVE_LONG_LONG
  16432. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  16433. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16434. #endif
  16435. }
  16436. } else {
  16437. #if CYTHON_USE_PYLONG_INTERNALS
  16438. if (__Pyx_PyLong_IsCompact(x)) {
  16439. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16440. } else {
  16441. const digit* digits = __Pyx_PyLong_Digits(x);
  16442. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16443. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16444. case -2:
  16445. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  16446. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16447. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16448. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16449. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16450. }
  16451. }
  16452. break;
  16453. case 2:
  16454. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  16455. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16456. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16457. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16458. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16459. }
  16460. }
  16461. break;
  16462. case -3:
  16463. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  16464. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16465. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16466. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16467. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16468. }
  16469. }
  16470. break;
  16471. case 3:
  16472. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  16473. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16474. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16475. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16476. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16477. }
  16478. }
  16479. break;
  16480. case -4:
  16481. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  16482. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16483. __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])))
  16484. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16485. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16486. }
  16487. }
  16488. break;
  16489. case 4:
  16490. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  16491. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16492. __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])))
  16493. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  16494. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  16495. }
  16496. }
  16497. break;
  16498. }
  16499. }
  16500. #endif
  16501. if ((sizeof(int) <= sizeof(long))) {
  16502. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  16503. #ifdef HAVE_LONG_LONG
  16504. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  16505. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  16506. #endif
  16507. }
  16508. }
  16509. {
  16510. int val;
  16511. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  16512. #if PY_MAJOR_VERSION < 3
  16513. if (likely(v) && !PyLong_Check(v)) {
  16514. PyObject *tmp = v;
  16515. v = PyNumber_Long(tmp);
  16516. Py_DECREF(tmp);
  16517. }
  16518. #endif
  16519. if (likely(v)) {
  16520. int ret = -1;
  16521. #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16522. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16523. unsigned char *bytes = (unsigned char *)&val;
  16524. ret = _PyLong_AsByteArray((PyLongObject *)v,
  16525. bytes, sizeof(val),
  16526. is_little, !is_unsigned);
  16527. #else
  16528. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16529. int bits, remaining_bits, is_negative = 0;
  16530. long idigit;
  16531. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16532. if (unlikely(!PyLong_CheckExact(v))) {
  16533. PyObject *tmp = v;
  16534. v = PyNumber_Long(v);
  16535. assert(PyLong_CheckExact(v));
  16536. Py_DECREF(tmp);
  16537. if (unlikely(!v)) return (int) -1;
  16538. }
  16539. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16540. if (Py_SIZE(x) == 0)
  16541. return (int) 0;
  16542. is_negative = Py_SIZE(x) < 0;
  16543. #else
  16544. {
  16545. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16546. if (unlikely(result < 0))
  16547. return (int) -1;
  16548. is_negative = result == 1;
  16549. }
  16550. #endif
  16551. if (is_unsigned && unlikely(is_negative)) {
  16552. goto raise_neg_overflow;
  16553. } else if (is_negative) {
  16554. stepval = PyNumber_Invert(v);
  16555. if (unlikely(!stepval))
  16556. return (int) -1;
  16557. } else {
  16558. stepval = __Pyx_NewRef(v);
  16559. }
  16560. val = (int) 0;
  16561. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16562. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16563. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  16564. PyObject *tmp, *digit;
  16565. digit = PyNumber_And(stepval, mask);
  16566. if (unlikely(!digit)) goto done;
  16567. idigit = PyLong_AsLong(digit);
  16568. Py_DECREF(digit);
  16569. if (unlikely(idigit < 0)) goto done;
  16570. tmp = PyNumber_Rshift(stepval, shift);
  16571. if (unlikely(!tmp)) goto done;
  16572. Py_DECREF(stepval); stepval = tmp;
  16573. val |= ((int) idigit) << bits;
  16574. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16575. if (Py_SIZE(stepval) == 0)
  16576. goto unpacking_done;
  16577. #endif
  16578. }
  16579. idigit = PyLong_AsLong(stepval);
  16580. if (unlikely(idigit < 0)) goto done;
  16581. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  16582. if (unlikely(idigit >= (1L << remaining_bits)))
  16583. goto raise_overflow;
  16584. val |= ((int) idigit) << bits;
  16585. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16586. unpacking_done:
  16587. #endif
  16588. if (!is_unsigned) {
  16589. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  16590. goto raise_overflow;
  16591. if (is_negative)
  16592. val = ~val;
  16593. }
  16594. ret = 0;
  16595. done:
  16596. Py_XDECREF(shift);
  16597. Py_XDECREF(mask);
  16598. Py_XDECREF(stepval);
  16599. #endif
  16600. Py_DECREF(v);
  16601. if (likely(!ret))
  16602. return val;
  16603. }
  16604. return (int) -1;
  16605. }
  16606. } else {
  16607. int val;
  16608. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  16609. if (!tmp) return (int) -1;
  16610. val = __Pyx_PyInt_As_int(tmp);
  16611. Py_DECREF(tmp);
  16612. return val;
  16613. }
  16614. raise_overflow:
  16615. PyErr_SetString(PyExc_OverflowError,
  16616. "value too large to convert to int");
  16617. return (int) -1;
  16618. raise_neg_overflow:
  16619. PyErr_SetString(PyExc_OverflowError,
  16620. "can't convert negative value to int");
  16621. return (int) -1;
  16622. }
  16623. /* CIntToPy */
  16624. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  16625. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16626. #pragma GCC diagnostic push
  16627. #pragma GCC diagnostic ignored "-Wconversion"
  16628. #endif
  16629. const int neg_one = (int) -1, const_zero = (int) 0;
  16630. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16631. #pragma GCC diagnostic pop
  16632. #endif
  16633. const int is_unsigned = neg_one > const_zero;
  16634. if (is_unsigned) {
  16635. if (sizeof(int) < sizeof(long)) {
  16636. return PyInt_FromLong((long) value);
  16637. } else if (sizeof(int) <= sizeof(unsigned long)) {
  16638. return PyLong_FromUnsignedLong((unsigned long) value);
  16639. #ifdef HAVE_LONG_LONG
  16640. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  16641. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16642. #endif
  16643. }
  16644. } else {
  16645. if (sizeof(int) <= sizeof(long)) {
  16646. return PyInt_FromLong((long) value);
  16647. #ifdef HAVE_LONG_LONG
  16648. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  16649. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16650. #endif
  16651. }
  16652. }
  16653. {
  16654. int one = 1; int little = (int)*(unsigned char *)&one;
  16655. unsigned char *bytes = (unsigned char *)&value;
  16656. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16657. return _PyLong_FromByteArray(bytes, sizeof(int),
  16658. little, !is_unsigned);
  16659. #else
  16660. PyObject *from_bytes, *result = NULL;
  16661. PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
  16662. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16663. if (!from_bytes) return NULL;
  16664. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
  16665. if (!py_bytes) goto limited_bad;
  16666. order_str = PyUnicode_FromString(little ? "little" : "big");
  16667. if (!order_str) goto limited_bad;
  16668. arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
  16669. if (!arg_tuple) goto limited_bad;
  16670. if (!is_unsigned) {
  16671. kwds = PyDict_New();
  16672. if (!kwds) goto limited_bad;
  16673. if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
  16674. }
  16675. result = PyObject_Call(from_bytes, arg_tuple, kwds);
  16676. limited_bad:
  16677. Py_XDECREF(kwds);
  16678. Py_XDECREF(arg_tuple);
  16679. Py_XDECREF(order_str);
  16680. Py_XDECREF(py_bytes);
  16681. Py_XDECREF(from_bytes);
  16682. return result;
  16683. #endif
  16684. }
  16685. }
  16686. /* CIntToPy */
  16687. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  16688. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16689. #pragma GCC diagnostic push
  16690. #pragma GCC diagnostic ignored "-Wconversion"
  16691. #endif
  16692. const long neg_one = (long) -1, const_zero = (long) 0;
  16693. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16694. #pragma GCC diagnostic pop
  16695. #endif
  16696. const int is_unsigned = neg_one > const_zero;
  16697. if (is_unsigned) {
  16698. if (sizeof(long) < sizeof(long)) {
  16699. return PyInt_FromLong((long) value);
  16700. } else if (sizeof(long) <= sizeof(unsigned long)) {
  16701. return PyLong_FromUnsignedLong((unsigned long) value);
  16702. #ifdef HAVE_LONG_LONG
  16703. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  16704. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  16705. #endif
  16706. }
  16707. } else {
  16708. if (sizeof(long) <= sizeof(long)) {
  16709. return PyInt_FromLong((long) value);
  16710. #ifdef HAVE_LONG_LONG
  16711. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  16712. return PyLong_FromLongLong((PY_LONG_LONG) value);
  16713. #endif
  16714. }
  16715. }
  16716. {
  16717. int one = 1; int little = (int)*(unsigned char *)&one;
  16718. unsigned char *bytes = (unsigned char *)&value;
  16719. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  16720. return _PyLong_FromByteArray(bytes, sizeof(long),
  16721. little, !is_unsigned);
  16722. #else
  16723. PyObject *from_bytes, *result = NULL;
  16724. PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
  16725. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  16726. if (!from_bytes) return NULL;
  16727. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  16728. if (!py_bytes) goto limited_bad;
  16729. order_str = PyUnicode_FromString(little ? "little" : "big");
  16730. if (!order_str) goto limited_bad;
  16731. arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
  16732. if (!arg_tuple) goto limited_bad;
  16733. if (!is_unsigned) {
  16734. kwds = PyDict_New();
  16735. if (!kwds) goto limited_bad;
  16736. if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
  16737. }
  16738. result = PyObject_Call(from_bytes, arg_tuple, kwds);
  16739. limited_bad:
  16740. Py_XDECREF(kwds);
  16741. Py_XDECREF(arg_tuple);
  16742. Py_XDECREF(order_str);
  16743. Py_XDECREF(py_bytes);
  16744. Py_XDECREF(from_bytes);
  16745. return result;
  16746. #endif
  16747. }
  16748. }
  16749. /* CIntFromPy */
  16750. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  16751. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16752. #pragma GCC diagnostic push
  16753. #pragma GCC diagnostic ignored "-Wconversion"
  16754. #endif
  16755. const long neg_one = (long) -1, const_zero = (long) 0;
  16756. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  16757. #pragma GCC diagnostic pop
  16758. #endif
  16759. const int is_unsigned = neg_one > const_zero;
  16760. #if PY_MAJOR_VERSION < 3
  16761. if (likely(PyInt_Check(x))) {
  16762. if ((sizeof(long) < sizeof(long))) {
  16763. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  16764. } else {
  16765. long val = PyInt_AS_LONG(x);
  16766. if (is_unsigned && unlikely(val < 0)) {
  16767. goto raise_neg_overflow;
  16768. }
  16769. return (long) val;
  16770. }
  16771. } else
  16772. #endif
  16773. if (likely(PyLong_Check(x))) {
  16774. if (is_unsigned) {
  16775. #if CYTHON_USE_PYLONG_INTERNALS
  16776. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  16777. goto raise_neg_overflow;
  16778. } else if (__Pyx_PyLong_IsCompact(x)) {
  16779. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  16780. } else {
  16781. const digit* digits = __Pyx_PyLong_Digits(x);
  16782. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16783. switch (__Pyx_PyLong_DigitCount(x)) {
  16784. case 2:
  16785. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16786. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16787. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16788. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  16789. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16790. }
  16791. }
  16792. break;
  16793. case 3:
  16794. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16795. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16796. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16797. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  16798. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16799. }
  16800. }
  16801. break;
  16802. case 4:
  16803. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16804. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16805. __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])))
  16806. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  16807. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  16808. }
  16809. }
  16810. break;
  16811. }
  16812. }
  16813. #endif
  16814. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  16815. if (unlikely(Py_SIZE(x) < 0)) {
  16816. goto raise_neg_overflow;
  16817. }
  16818. #else
  16819. {
  16820. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16821. if (unlikely(result < 0))
  16822. return (long) -1;
  16823. if (unlikely(result == 1))
  16824. goto raise_neg_overflow;
  16825. }
  16826. #endif
  16827. if ((sizeof(long) <= sizeof(unsigned long))) {
  16828. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  16829. #ifdef HAVE_LONG_LONG
  16830. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  16831. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  16832. #endif
  16833. }
  16834. } else {
  16835. #if CYTHON_USE_PYLONG_INTERNALS
  16836. if (__Pyx_PyLong_IsCompact(x)) {
  16837. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  16838. } else {
  16839. const digit* digits = __Pyx_PyLong_Digits(x);
  16840. assert(__Pyx_PyLong_DigitCount(x) > 1);
  16841. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  16842. case -2:
  16843. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  16844. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16845. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16846. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16847. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16848. }
  16849. }
  16850. break;
  16851. case 2:
  16852. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  16853. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  16854. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16855. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16856. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16857. }
  16858. }
  16859. break;
  16860. case -3:
  16861. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  16862. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16863. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16864. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16865. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16866. }
  16867. }
  16868. break;
  16869. case 3:
  16870. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  16871. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  16872. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  16873. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16874. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16875. }
  16876. }
  16877. break;
  16878. case -4:
  16879. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  16880. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16881. __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])))
  16882. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16883. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16884. }
  16885. }
  16886. break;
  16887. case 4:
  16888. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  16889. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  16890. __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])))
  16891. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  16892. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  16893. }
  16894. }
  16895. break;
  16896. }
  16897. }
  16898. #endif
  16899. if ((sizeof(long) <= sizeof(long))) {
  16900. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  16901. #ifdef HAVE_LONG_LONG
  16902. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  16903. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  16904. #endif
  16905. }
  16906. }
  16907. {
  16908. long val;
  16909. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  16910. #if PY_MAJOR_VERSION < 3
  16911. if (likely(v) && !PyLong_Check(v)) {
  16912. PyObject *tmp = v;
  16913. v = PyNumber_Long(tmp);
  16914. Py_DECREF(tmp);
  16915. }
  16916. #endif
  16917. if (likely(v)) {
  16918. int ret = -1;
  16919. #if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  16920. int one = 1; int is_little = (int)*(unsigned char *)&one;
  16921. unsigned char *bytes = (unsigned char *)&val;
  16922. ret = _PyLong_AsByteArray((PyLongObject *)v,
  16923. bytes, sizeof(val),
  16924. is_little, !is_unsigned);
  16925. #else
  16926. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  16927. int bits, remaining_bits, is_negative = 0;
  16928. long idigit;
  16929. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  16930. if (unlikely(!PyLong_CheckExact(v))) {
  16931. PyObject *tmp = v;
  16932. v = PyNumber_Long(v);
  16933. assert(PyLong_CheckExact(v));
  16934. Py_DECREF(tmp);
  16935. if (unlikely(!v)) return (long) -1;
  16936. }
  16937. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16938. if (Py_SIZE(x) == 0)
  16939. return (long) 0;
  16940. is_negative = Py_SIZE(x) < 0;
  16941. #else
  16942. {
  16943. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  16944. if (unlikely(result < 0))
  16945. return (long) -1;
  16946. is_negative = result == 1;
  16947. }
  16948. #endif
  16949. if (is_unsigned && unlikely(is_negative)) {
  16950. goto raise_neg_overflow;
  16951. } else if (is_negative) {
  16952. stepval = PyNumber_Invert(v);
  16953. if (unlikely(!stepval))
  16954. return (long) -1;
  16955. } else {
  16956. stepval = __Pyx_NewRef(v);
  16957. }
  16958. val = (long) 0;
  16959. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  16960. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  16961. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  16962. PyObject *tmp, *digit;
  16963. digit = PyNumber_And(stepval, mask);
  16964. if (unlikely(!digit)) goto done;
  16965. idigit = PyLong_AsLong(digit);
  16966. Py_DECREF(digit);
  16967. if (unlikely(idigit < 0)) goto done;
  16968. tmp = PyNumber_Rshift(stepval, shift);
  16969. if (unlikely(!tmp)) goto done;
  16970. Py_DECREF(stepval); stepval = tmp;
  16971. val |= ((long) idigit) << bits;
  16972. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16973. if (Py_SIZE(stepval) == 0)
  16974. goto unpacking_done;
  16975. #endif
  16976. }
  16977. idigit = PyLong_AsLong(stepval);
  16978. if (unlikely(idigit < 0)) goto done;
  16979. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  16980. if (unlikely(idigit >= (1L << remaining_bits)))
  16981. goto raise_overflow;
  16982. val |= ((long) idigit) << bits;
  16983. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000
  16984. unpacking_done:
  16985. #endif
  16986. if (!is_unsigned) {
  16987. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  16988. goto raise_overflow;
  16989. if (is_negative)
  16990. val = ~val;
  16991. }
  16992. ret = 0;
  16993. done:
  16994. Py_XDECREF(shift);
  16995. Py_XDECREF(mask);
  16996. Py_XDECREF(stepval);
  16997. #endif
  16998. Py_DECREF(v);
  16999. if (likely(!ret))
  17000. return val;
  17001. }
  17002. return (long) -1;
  17003. }
  17004. } else {
  17005. long val;
  17006. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  17007. if (!tmp) return (long) -1;
  17008. val = __Pyx_PyInt_As_long(tmp);
  17009. Py_DECREF(tmp);
  17010. return val;
  17011. }
  17012. raise_overflow:
  17013. PyErr_SetString(PyExc_OverflowError,
  17014. "value too large to convert to long");
  17015. return (long) -1;
  17016. raise_neg_overflow:
  17017. PyErr_SetString(PyExc_OverflowError,
  17018. "can't convert negative value to long");
  17019. return (long) -1;
  17020. }
  17021. /* FormatTypeName */
  17022. #if CYTHON_COMPILING_IN_LIMITED_API
  17023. static __Pyx_TypeName
  17024. __Pyx_PyType_GetName(PyTypeObject* tp)
  17025. {
  17026. PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  17027. __pyx_n_s_name);
  17028. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
  17029. PyErr_Clear();
  17030. Py_XDECREF(name);
  17031. name = __Pyx_NewRef(__pyx_n_s__22);
  17032. }
  17033. return name;
  17034. }
  17035. #endif
  17036. /* SwapException */
  17037. #if CYTHON_FAST_THREAD_STATE
  17038. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17039. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17040. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  17041. _PyErr_StackItem *exc_info = tstate->exc_info;
  17042. tmp_value = exc_info->exc_value;
  17043. exc_info->exc_value = *value;
  17044. if (tmp_value == NULL || tmp_value == Py_None) {
  17045. Py_XDECREF(tmp_value);
  17046. tmp_value = NULL;
  17047. tmp_type = NULL;
  17048. tmp_tb = NULL;
  17049. } else {
  17050. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  17051. Py_INCREF(tmp_type);
  17052. #if CYTHON_COMPILING_IN_CPYTHON
  17053. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  17054. Py_XINCREF(tmp_tb);
  17055. #else
  17056. tmp_tb = PyException_GetTraceback(tmp_value);
  17057. #endif
  17058. }
  17059. #elif CYTHON_USE_EXC_INFO_STACK
  17060. _PyErr_StackItem *exc_info = tstate->exc_info;
  17061. tmp_type = exc_info->exc_type;
  17062. tmp_value = exc_info->exc_value;
  17063. tmp_tb = exc_info->exc_traceback;
  17064. exc_info->exc_type = *type;
  17065. exc_info->exc_value = *value;
  17066. exc_info->exc_traceback = *tb;
  17067. #else
  17068. tmp_type = tstate->exc_type;
  17069. tmp_value = tstate->exc_value;
  17070. tmp_tb = tstate->exc_traceback;
  17071. tstate->exc_type = *type;
  17072. tstate->exc_value = *value;
  17073. tstate->exc_traceback = *tb;
  17074. #endif
  17075. *type = tmp_type;
  17076. *value = tmp_value;
  17077. *tb = tmp_tb;
  17078. }
  17079. #else
  17080. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  17081. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17082. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  17083. PyErr_SetExcInfo(*type, *value, *tb);
  17084. *type = tmp_type;
  17085. *value = tmp_value;
  17086. *tb = tmp_tb;
  17087. }
  17088. #endif
  17089. /* PyObjectCall2Args */
  17090. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  17091. PyObject *args[3] = {NULL, arg1, arg2};
  17092. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17093. }
  17094. /* PyObjectCallMethod1 */
  17095. #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
  17096. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  17097. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  17098. Py_DECREF(method);
  17099. return result;
  17100. }
  17101. #endif
  17102. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  17103. #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
  17104. PyObject *args[2] = {obj, arg};
  17105. (void) __Pyx_PyObject_GetMethod;
  17106. (void) __Pyx_PyObject_CallOneArg;
  17107. (void) __Pyx_PyObject_Call2Args;
  17108. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  17109. #else
  17110. PyObject *method = NULL, *result;
  17111. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  17112. if (likely(is_method)) {
  17113. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  17114. Py_DECREF(method);
  17115. return result;
  17116. }
  17117. if (unlikely(!method)) return NULL;
  17118. return __Pyx__PyObject_CallMethod1(method, arg);
  17119. #endif
  17120. }
  17121. /* CoroutineBase */
  17122. #include <frameobject.h>
  17123. #if PY_VERSION_HEX >= 0x030b00a6
  17124. #ifndef Py_BUILD_CORE
  17125. #define Py_BUILD_CORE 1
  17126. #endif
  17127. #include "internal/pycore_frame.h"
  17128. #endif
  17129. #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
  17130. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  17131. PyObject *et, *ev, *tb;
  17132. PyObject *value = NULL;
  17133. CYTHON_UNUSED_VAR(__pyx_tstate);
  17134. __Pyx_ErrFetch(&et, &ev, &tb);
  17135. if (!et) {
  17136. Py_XDECREF(tb);
  17137. Py_XDECREF(ev);
  17138. Py_INCREF(Py_None);
  17139. *pvalue = Py_None;
  17140. return 0;
  17141. }
  17142. if (likely(et == PyExc_StopIteration)) {
  17143. if (!ev) {
  17144. Py_INCREF(Py_None);
  17145. value = Py_None;
  17146. }
  17147. #if PY_VERSION_HEX >= 0x030300A0
  17148. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17149. value = ((PyStopIterationObject *)ev)->value;
  17150. Py_INCREF(value);
  17151. Py_DECREF(ev);
  17152. }
  17153. #endif
  17154. else if (unlikely(PyTuple_Check(ev))) {
  17155. if (PyTuple_GET_SIZE(ev) >= 1) {
  17156. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17157. value = PyTuple_GET_ITEM(ev, 0);
  17158. Py_INCREF(value);
  17159. #else
  17160. value = PySequence_ITEM(ev, 0);
  17161. #endif
  17162. } else {
  17163. Py_INCREF(Py_None);
  17164. value = Py_None;
  17165. }
  17166. Py_DECREF(ev);
  17167. }
  17168. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  17169. value = ev;
  17170. }
  17171. if (likely(value)) {
  17172. Py_XDECREF(tb);
  17173. Py_DECREF(et);
  17174. *pvalue = value;
  17175. return 0;
  17176. }
  17177. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  17178. __Pyx_ErrRestore(et, ev, tb);
  17179. return -1;
  17180. }
  17181. PyErr_NormalizeException(&et, &ev, &tb);
  17182. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  17183. __Pyx_ErrRestore(et, ev, tb);
  17184. return -1;
  17185. }
  17186. Py_XDECREF(tb);
  17187. Py_DECREF(et);
  17188. #if PY_VERSION_HEX >= 0x030300A0
  17189. value = ((PyStopIterationObject *)ev)->value;
  17190. Py_INCREF(value);
  17191. Py_DECREF(ev);
  17192. #else
  17193. {
  17194. PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
  17195. Py_DECREF(ev);
  17196. if (likely(args)) {
  17197. value = PySequence_GetItem(args, 0);
  17198. Py_DECREF(args);
  17199. }
  17200. if (unlikely(!value)) {
  17201. __Pyx_ErrRestore(NULL, NULL, NULL);
  17202. Py_INCREF(Py_None);
  17203. value = Py_None;
  17204. }
  17205. }
  17206. #endif
  17207. *pvalue = value;
  17208. return 0;
  17209. }
  17210. static CYTHON_INLINE
  17211. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  17212. #if PY_VERSION_HEX >= 0x030B00a4
  17213. Py_CLEAR(exc_state->exc_value);
  17214. #else
  17215. PyObject *t, *v, *tb;
  17216. t = exc_state->exc_type;
  17217. v = exc_state->exc_value;
  17218. tb = exc_state->exc_traceback;
  17219. exc_state->exc_type = NULL;
  17220. exc_state->exc_value = NULL;
  17221. exc_state->exc_traceback = NULL;
  17222. Py_XDECREF(t);
  17223. Py_XDECREF(v);
  17224. Py_XDECREF(tb);
  17225. #endif
  17226. }
  17227. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  17228. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  17229. const char *msg;
  17230. CYTHON_MAYBE_UNUSED_VAR(gen);
  17231. if ((0)) {
  17232. #ifdef __Pyx_Coroutine_USED
  17233. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  17234. msg = "coroutine already executing";
  17235. #endif
  17236. #ifdef __Pyx_AsyncGen_USED
  17237. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  17238. msg = "async generator already executing";
  17239. #endif
  17240. } else {
  17241. msg = "generator already executing";
  17242. }
  17243. PyErr_SetString(PyExc_ValueError, msg);
  17244. }
  17245. #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
  17246. static void __Pyx__Coroutine_NotStartedError(PyObject *gen) {
  17247. const char *msg;
  17248. CYTHON_MAYBE_UNUSED_VAR(gen);
  17249. if ((0)) {
  17250. #ifdef __Pyx_Coroutine_USED
  17251. } else if (__Pyx_Coroutine_Check(gen)) {
  17252. msg = "can't send non-None value to a just-started coroutine";
  17253. #endif
  17254. #ifdef __Pyx_AsyncGen_USED
  17255. } else if (__Pyx_AsyncGen_CheckExact(gen)) {
  17256. msg = "can't send non-None value to a just-started async generator";
  17257. #endif
  17258. } else {
  17259. msg = "can't send non-None value to a just-started generator";
  17260. }
  17261. PyErr_SetString(PyExc_TypeError, msg);
  17262. }
  17263. #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
  17264. static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  17265. CYTHON_MAYBE_UNUSED_VAR(gen);
  17266. CYTHON_MAYBE_UNUSED_VAR(closing);
  17267. #ifdef __Pyx_Coroutine_USED
  17268. if (!closing && __Pyx_Coroutine_Check(gen)) {
  17269. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  17270. } else
  17271. #endif
  17272. if (value) {
  17273. #ifdef __Pyx_AsyncGen_USED
  17274. if (__Pyx_AsyncGen_CheckExact(gen))
  17275. PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
  17276. else
  17277. #endif
  17278. PyErr_SetNone(PyExc_StopIteration);
  17279. }
  17280. }
  17281. static
  17282. PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
  17283. __Pyx_PyThreadState_declare
  17284. PyThreadState *tstate;
  17285. __Pyx_ExcInfoStruct *exc_state;
  17286. PyObject *retval;
  17287. assert(!self->is_running);
  17288. if (unlikely(self->resume_label == 0)) {
  17289. if (unlikely(value && value != Py_None)) {
  17290. return __Pyx_Coroutine_NotStartedError((PyObject*)self);
  17291. }
  17292. }
  17293. if (unlikely(self->resume_label == -1)) {
  17294. return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  17295. }
  17296. #if CYTHON_FAST_THREAD_STATE
  17297. __Pyx_PyThreadState_assign
  17298. tstate = __pyx_tstate;
  17299. #else
  17300. tstate = __Pyx_PyThreadState_Current;
  17301. #endif
  17302. exc_state = &self->gi_exc_state;
  17303. if (exc_state->exc_value) {
  17304. #if CYTHON_COMPILING_IN_PYPY
  17305. #else
  17306. PyObject *exc_tb;
  17307. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17308. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17309. #elif PY_VERSION_HEX >= 0x030B00a4
  17310. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  17311. #else
  17312. exc_tb = exc_state->exc_traceback;
  17313. #endif
  17314. if (exc_tb) {
  17315. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17316. PyFrameObject *f = tb->tb_frame;
  17317. assert(f->f_back == NULL);
  17318. #if PY_VERSION_HEX >= 0x030B00A1
  17319. f->f_back = PyThreadState_GetFrame(tstate);
  17320. #else
  17321. Py_XINCREF(tstate->frame);
  17322. f->f_back = tstate->frame;
  17323. #endif
  17324. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  17325. Py_DECREF(exc_tb);
  17326. #endif
  17327. }
  17328. #endif
  17329. }
  17330. #if CYTHON_USE_EXC_INFO_STACK
  17331. exc_state->previous_item = tstate->exc_info;
  17332. tstate->exc_info = exc_state;
  17333. #else
  17334. if (exc_state->exc_type) {
  17335. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17336. } else {
  17337. __Pyx_Coroutine_ExceptionClear(exc_state);
  17338. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  17339. }
  17340. #endif
  17341. self->is_running = 1;
  17342. retval = self->body(self, tstate, value);
  17343. self->is_running = 0;
  17344. #if CYTHON_USE_EXC_INFO_STACK
  17345. exc_state = &self->gi_exc_state;
  17346. tstate->exc_info = exc_state->previous_item;
  17347. exc_state->previous_item = NULL;
  17348. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  17349. #endif
  17350. return retval;
  17351. }
  17352. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  17353. #if CYTHON_COMPILING_IN_PYPY
  17354. CYTHON_UNUSED_VAR(exc_state);
  17355. #else
  17356. PyObject *exc_tb;
  17357. #if PY_VERSION_HEX >= 0x030B00a4
  17358. if (!exc_state->exc_value) return;
  17359. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  17360. #else
  17361. exc_tb = exc_state->exc_traceback;
  17362. #endif
  17363. if (likely(exc_tb)) {
  17364. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  17365. PyFrameObject *f = tb->tb_frame;
  17366. Py_CLEAR(f->f_back);
  17367. #if PY_VERSION_HEX >= 0x030B00a4
  17368. Py_DECREF(exc_tb);
  17369. #endif
  17370. }
  17371. #endif
  17372. }
  17373. static CYTHON_INLINE
  17374. PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) {
  17375. CYTHON_MAYBE_UNUSED_VAR(gen);
  17376. if (unlikely(!retval)) {
  17377. __Pyx_PyThreadState_declare
  17378. __Pyx_PyThreadState_assign
  17379. if (!__Pyx_PyErr_Occurred()) {
  17380. PyObject *exc = PyExc_StopIteration;
  17381. #ifdef __Pyx_AsyncGen_USED
  17382. if (__Pyx_AsyncGen_CheckExact(gen))
  17383. exc = __Pyx_PyExc_StopAsyncIteration;
  17384. #endif
  17385. __Pyx_PyErr_SetNone(exc);
  17386. }
  17387. }
  17388. return retval;
  17389. }
  17390. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  17391. static CYTHON_INLINE
  17392. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  17393. #if PY_VERSION_HEX <= 0x030A00A1
  17394. return _PyGen_Send(gen, arg);
  17395. #else
  17396. PyObject *result;
  17397. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  17398. if (PyAsyncGen_CheckExact(gen)) {
  17399. assert(result == Py_None);
  17400. PyErr_SetNone(PyExc_StopAsyncIteration);
  17401. }
  17402. else if (result == Py_None) {
  17403. PyErr_SetNone(PyExc_StopIteration);
  17404. }
  17405. else {
  17406. #if PY_VERSION_HEX < 0x030d00A1
  17407. _PyGen_SetStopIterationValue(result);
  17408. #else
  17409. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  17410. PyErr_SetObject(PyExc_StopIteration, result);
  17411. } else {
  17412. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  17413. if (likely(exc != NULL)) {
  17414. PyErr_SetObject(PyExc_StopIteration, exc);
  17415. Py_DECREF(exc);
  17416. }
  17417. }
  17418. #endif
  17419. }
  17420. Py_DECREF(result);
  17421. result = NULL;
  17422. }
  17423. return result;
  17424. #endif
  17425. }
  17426. #endif
  17427. static CYTHON_INLINE
  17428. PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
  17429. PyObject *ret;
  17430. PyObject *val = NULL;
  17431. __Pyx_Coroutine_Undelegate(gen);
  17432. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  17433. ret = __Pyx_Coroutine_SendEx(gen, val, 0);
  17434. Py_XDECREF(val);
  17435. return ret;
  17436. }
  17437. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  17438. PyObject *retval;
  17439. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17440. PyObject *yf = gen->yieldfrom;
  17441. if (unlikely(gen->is_running))
  17442. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17443. if (yf) {
  17444. PyObject *ret;
  17445. gen->is_running = 1;
  17446. #ifdef __Pyx_Generator_USED
  17447. if (__Pyx_Generator_CheckExact(yf)) {
  17448. ret = __Pyx_Coroutine_Send(yf, value);
  17449. } else
  17450. #endif
  17451. #ifdef __Pyx_Coroutine_USED
  17452. if (__Pyx_Coroutine_Check(yf)) {
  17453. ret = __Pyx_Coroutine_Send(yf, value);
  17454. } else
  17455. #endif
  17456. #ifdef __Pyx_AsyncGen_USED
  17457. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17458. ret = __Pyx_async_gen_asend_send(yf, value);
  17459. } else
  17460. #endif
  17461. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  17462. if (PyGen_CheckExact(yf)) {
  17463. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17464. } else
  17465. #endif
  17466. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  17467. if (PyCoro_CheckExact(yf)) {
  17468. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  17469. } else
  17470. #endif
  17471. {
  17472. if (value == Py_None)
  17473. ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
  17474. else
  17475. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
  17476. }
  17477. gen->is_running = 0;
  17478. if (likely(ret)) {
  17479. return ret;
  17480. }
  17481. retval = __Pyx_Coroutine_FinishDelegation(gen);
  17482. } else {
  17483. retval = __Pyx_Coroutine_SendEx(gen, value, 0);
  17484. }
  17485. return __Pyx_Coroutine_MethodReturn(self, retval);
  17486. }
  17487. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  17488. PyObject *retval = NULL;
  17489. int err = 0;
  17490. #ifdef __Pyx_Generator_USED
  17491. if (__Pyx_Generator_CheckExact(yf)) {
  17492. retval = __Pyx_Coroutine_Close(yf);
  17493. if (!retval)
  17494. return -1;
  17495. } else
  17496. #endif
  17497. #ifdef __Pyx_Coroutine_USED
  17498. if (__Pyx_Coroutine_Check(yf)) {
  17499. retval = __Pyx_Coroutine_Close(yf);
  17500. if (!retval)
  17501. return -1;
  17502. } else
  17503. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17504. retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
  17505. if (!retval)
  17506. return -1;
  17507. } else
  17508. #endif
  17509. #ifdef __Pyx_AsyncGen_USED
  17510. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  17511. retval = __Pyx_async_gen_asend_close(yf, NULL);
  17512. } else
  17513. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  17514. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  17515. } else
  17516. #endif
  17517. {
  17518. PyObject *meth;
  17519. gen->is_running = 1;
  17520. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close);
  17521. if (unlikely(!meth)) {
  17522. if (unlikely(PyErr_Occurred())) {
  17523. PyErr_WriteUnraisable(yf);
  17524. }
  17525. } else {
  17526. retval = __Pyx_PyObject_CallNoArg(meth);
  17527. Py_DECREF(meth);
  17528. if (unlikely(!retval))
  17529. err = -1;
  17530. }
  17531. gen->is_running = 0;
  17532. }
  17533. Py_XDECREF(retval);
  17534. return err;
  17535. }
  17536. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  17537. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  17538. PyObject *yf = gen->yieldfrom;
  17539. if (unlikely(gen->is_running))
  17540. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17541. if (yf) {
  17542. PyObject *ret;
  17543. gen->is_running = 1;
  17544. #ifdef __Pyx_Generator_USED
  17545. if (__Pyx_Generator_CheckExact(yf)) {
  17546. ret = __Pyx_Generator_Next(yf);
  17547. } else
  17548. #endif
  17549. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  17550. if (PyGen_CheckExact(yf)) {
  17551. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  17552. } else
  17553. #endif
  17554. #ifdef __Pyx_Coroutine_USED
  17555. if (__Pyx_Coroutine_Check(yf)) {
  17556. ret = __Pyx_Coroutine_Send(yf, Py_None);
  17557. } else
  17558. #endif
  17559. ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf);
  17560. gen->is_running = 0;
  17561. if (likely(ret)) {
  17562. return ret;
  17563. }
  17564. return __Pyx_Coroutine_FinishDelegation(gen);
  17565. }
  17566. return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
  17567. }
  17568. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  17569. CYTHON_UNUSED_VAR(arg);
  17570. return __Pyx_Coroutine_Close(self);
  17571. }
  17572. static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
  17573. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17574. PyObject *retval, *raised_exception;
  17575. PyObject *yf = gen->yieldfrom;
  17576. int err = 0;
  17577. if (unlikely(gen->is_running))
  17578. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17579. if (yf) {
  17580. Py_INCREF(yf);
  17581. err = __Pyx_Coroutine_CloseIter(gen, yf);
  17582. __Pyx_Coroutine_Undelegate(gen);
  17583. Py_DECREF(yf);
  17584. }
  17585. if (err == 0)
  17586. PyErr_SetNone(PyExc_GeneratorExit);
  17587. retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
  17588. if (unlikely(retval)) {
  17589. const char *msg;
  17590. Py_DECREF(retval);
  17591. if ((0)) {
  17592. #ifdef __Pyx_Coroutine_USED
  17593. } else if (__Pyx_Coroutine_Check(self)) {
  17594. msg = "coroutine ignored GeneratorExit";
  17595. #endif
  17596. #ifdef __Pyx_AsyncGen_USED
  17597. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  17598. #if PY_VERSION_HEX < 0x03060000
  17599. msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
  17600. #else
  17601. msg = "async generator ignored GeneratorExit";
  17602. #endif
  17603. #endif
  17604. } else {
  17605. msg = "generator ignored GeneratorExit";
  17606. }
  17607. PyErr_SetString(PyExc_RuntimeError, msg);
  17608. return NULL;
  17609. }
  17610. raised_exception = PyErr_Occurred();
  17611. if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
  17612. if (raised_exception) PyErr_Clear();
  17613. Py_INCREF(Py_None);
  17614. return Py_None;
  17615. }
  17616. return NULL;
  17617. }
  17618. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  17619. PyObject *args, int close_on_genexit) {
  17620. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17621. PyObject *yf = gen->yieldfrom;
  17622. if (unlikely(gen->is_running))
  17623. return __Pyx_Coroutine_AlreadyRunningError(gen);
  17624. if (yf) {
  17625. PyObject *ret;
  17626. Py_INCREF(yf);
  17627. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  17628. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  17629. Py_DECREF(yf);
  17630. __Pyx_Coroutine_Undelegate(gen);
  17631. if (err < 0)
  17632. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  17633. goto throw_here;
  17634. }
  17635. gen->is_running = 1;
  17636. if (0
  17637. #ifdef __Pyx_Generator_USED
  17638. || __Pyx_Generator_CheckExact(yf)
  17639. #endif
  17640. #ifdef __Pyx_Coroutine_USED
  17641. || __Pyx_Coroutine_Check(yf)
  17642. #endif
  17643. ) {
  17644. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  17645. #ifdef __Pyx_Coroutine_USED
  17646. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  17647. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  17648. #endif
  17649. } else {
  17650. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw);
  17651. if (unlikely(!meth)) {
  17652. Py_DECREF(yf);
  17653. if (unlikely(PyErr_Occurred())) {
  17654. gen->is_running = 0;
  17655. return NULL;
  17656. }
  17657. __Pyx_Coroutine_Undelegate(gen);
  17658. gen->is_running = 0;
  17659. goto throw_here;
  17660. }
  17661. if (likely(args)) {
  17662. ret = __Pyx_PyObject_Call(meth, args, NULL);
  17663. } else {
  17664. PyObject *cargs[4] = {NULL, typ, val, tb};
  17665. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  17666. }
  17667. Py_DECREF(meth);
  17668. }
  17669. gen->is_running = 0;
  17670. Py_DECREF(yf);
  17671. if (!ret) {
  17672. ret = __Pyx_Coroutine_FinishDelegation(gen);
  17673. }
  17674. return __Pyx_Coroutine_MethodReturn(self, ret);
  17675. }
  17676. throw_here:
  17677. __Pyx_Raise(typ, val, tb, NULL);
  17678. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  17679. }
  17680. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  17681. PyObject *typ;
  17682. PyObject *val = NULL;
  17683. PyObject *tb = NULL;
  17684. if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)))
  17685. return NULL;
  17686. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  17687. }
  17688. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  17689. #if PY_VERSION_HEX >= 0x030B00a4
  17690. Py_VISIT(exc_state->exc_value);
  17691. #else
  17692. Py_VISIT(exc_state->exc_type);
  17693. Py_VISIT(exc_state->exc_value);
  17694. Py_VISIT(exc_state->exc_traceback);
  17695. #endif
  17696. return 0;
  17697. }
  17698. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  17699. Py_VISIT(gen->closure);
  17700. Py_VISIT(gen->classobj);
  17701. Py_VISIT(gen->yieldfrom);
  17702. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  17703. }
  17704. static int __Pyx_Coroutine_clear(PyObject *self) {
  17705. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17706. Py_CLEAR(gen->closure);
  17707. Py_CLEAR(gen->classobj);
  17708. Py_CLEAR(gen->yieldfrom);
  17709. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  17710. #ifdef __Pyx_AsyncGen_USED
  17711. if (__Pyx_AsyncGen_CheckExact(self)) {
  17712. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  17713. }
  17714. #endif
  17715. Py_CLEAR(gen->gi_code);
  17716. Py_CLEAR(gen->gi_frame);
  17717. Py_CLEAR(gen->gi_name);
  17718. Py_CLEAR(gen->gi_qualname);
  17719. Py_CLEAR(gen->gi_modulename);
  17720. return 0;
  17721. }
  17722. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  17723. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17724. PyObject_GC_UnTrack(gen);
  17725. if (gen->gi_weakreflist != NULL)
  17726. PyObject_ClearWeakRefs(self);
  17727. if (gen->resume_label >= 0) {
  17728. PyObject_GC_Track(self);
  17729. #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
  17730. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  17731. #else
  17732. Py_TYPE(gen)->tp_del(self);
  17733. if (unlikely(Py_REFCNT(self) > 0))
  17734. #endif
  17735. {
  17736. return;
  17737. }
  17738. PyObject_GC_UnTrack(self);
  17739. }
  17740. #ifdef __Pyx_AsyncGen_USED
  17741. if (__Pyx_AsyncGen_CheckExact(self)) {
  17742. /* We have to handle this case for asynchronous generators
  17743. right here, because this code has to be between UNTRACK
  17744. and GC_Del. */
  17745. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  17746. }
  17747. #endif
  17748. __Pyx_Coroutine_clear(self);
  17749. __Pyx_PyHeapTypeObject_GC_Del(gen);
  17750. }
  17751. static void __Pyx_Coroutine_del(PyObject *self) {
  17752. PyObject *error_type, *error_value, *error_traceback;
  17753. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  17754. __Pyx_PyThreadState_declare
  17755. if (gen->resume_label < 0) {
  17756. return;
  17757. }
  17758. #if !CYTHON_USE_TP_FINALIZE
  17759. assert(self->ob_refcnt == 0);
  17760. __Pyx_SET_REFCNT(self, 1);
  17761. #endif
  17762. __Pyx_PyThreadState_assign
  17763. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  17764. #ifdef __Pyx_AsyncGen_USED
  17765. if (__Pyx_AsyncGen_CheckExact(self)) {
  17766. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  17767. PyObject *finalizer = agen->ag_finalizer;
  17768. if (finalizer && !agen->ag_closed) {
  17769. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  17770. if (unlikely(!res)) {
  17771. PyErr_WriteUnraisable(self);
  17772. } else {
  17773. Py_DECREF(res);
  17774. }
  17775. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  17776. return;
  17777. }
  17778. }
  17779. #endif
  17780. if (unlikely(gen->resume_label == 0 && !error_value)) {
  17781. #ifdef __Pyx_Coroutine_USED
  17782. #ifdef __Pyx_Generator_USED
  17783. if (!__Pyx_Generator_CheckExact(self))
  17784. #endif
  17785. {
  17786. PyObject_GC_UnTrack(self);
  17787. #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
  17788. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  17789. PyErr_WriteUnraisable(self);
  17790. #else
  17791. {PyObject *msg;
  17792. char *cmsg;
  17793. #if CYTHON_COMPILING_IN_PYPY
  17794. msg = NULL;
  17795. cmsg = (char*) "coroutine was never awaited";
  17796. #else
  17797. char *cname;
  17798. PyObject *qualname;
  17799. qualname = gen->gi_qualname;
  17800. cname = PyString_AS_STRING(qualname);
  17801. msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
  17802. if (unlikely(!msg)) {
  17803. PyErr_Clear();
  17804. cmsg = (char*) "coroutine was never awaited";
  17805. } else {
  17806. cmsg = PyString_AS_STRING(msg);
  17807. }
  17808. #endif
  17809. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
  17810. PyErr_WriteUnraisable(self);
  17811. Py_XDECREF(msg);}
  17812. #endif
  17813. PyObject_GC_Track(self);
  17814. }
  17815. #endif
  17816. } else {
  17817. PyObject *res = __Pyx_Coroutine_Close(self);
  17818. if (unlikely(!res)) {
  17819. if (PyErr_Occurred())
  17820. PyErr_WriteUnraisable(self);
  17821. } else {
  17822. Py_DECREF(res);
  17823. }
  17824. }
  17825. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  17826. #if !CYTHON_USE_TP_FINALIZE
  17827. assert(Py_REFCNT(self) > 0);
  17828. if (likely(--self->ob_refcnt == 0)) {
  17829. return;
  17830. }
  17831. {
  17832. Py_ssize_t refcnt = Py_REFCNT(self);
  17833. _Py_NewReference(self);
  17834. __Pyx_SET_REFCNT(self, refcnt);
  17835. }
  17836. #if CYTHON_COMPILING_IN_CPYTHON
  17837. assert(PyType_IS_GC(Py_TYPE(self)) &&
  17838. _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
  17839. _Py_DEC_REFTOTAL;
  17840. #endif
  17841. #ifdef COUNT_ALLOCS
  17842. --Py_TYPE(self)->tp_frees;
  17843. --Py_TYPE(self)->tp_allocs;
  17844. #endif
  17845. #endif
  17846. }
  17847. static PyObject *
  17848. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  17849. {
  17850. PyObject *name = self->gi_name;
  17851. CYTHON_UNUSED_VAR(context);
  17852. if (unlikely(!name)) name = Py_None;
  17853. Py_INCREF(name);
  17854. return name;
  17855. }
  17856. static int
  17857. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  17858. {
  17859. CYTHON_UNUSED_VAR(context);
  17860. #if PY_MAJOR_VERSION >= 3
  17861. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  17862. #else
  17863. if (unlikely(value == NULL || !PyString_Check(value)))
  17864. #endif
  17865. {
  17866. PyErr_SetString(PyExc_TypeError,
  17867. "__name__ must be set to a string object");
  17868. return -1;
  17869. }
  17870. Py_INCREF(value);
  17871. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  17872. return 0;
  17873. }
  17874. static PyObject *
  17875. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  17876. {
  17877. PyObject *name = self->gi_qualname;
  17878. CYTHON_UNUSED_VAR(context);
  17879. if (unlikely(!name)) name = Py_None;
  17880. Py_INCREF(name);
  17881. return name;
  17882. }
  17883. static int
  17884. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  17885. {
  17886. CYTHON_UNUSED_VAR(context);
  17887. #if PY_MAJOR_VERSION >= 3
  17888. if (unlikely(value == NULL || !PyUnicode_Check(value)))
  17889. #else
  17890. if (unlikely(value == NULL || !PyString_Check(value)))
  17891. #endif
  17892. {
  17893. PyErr_SetString(PyExc_TypeError,
  17894. "__qualname__ must be set to a string object");
  17895. return -1;
  17896. }
  17897. Py_INCREF(value);
  17898. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  17899. return 0;
  17900. }
  17901. static PyObject *
  17902. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context)
  17903. {
  17904. PyObject *frame = self->gi_frame;
  17905. CYTHON_UNUSED_VAR(context);
  17906. if (!frame) {
  17907. if (unlikely(!self->gi_code)) {
  17908. Py_RETURN_NONE;
  17909. }
  17910. frame = (PyObject *) PyFrame_New(
  17911. PyThreadState_Get(), /*PyThreadState *tstate,*/
  17912. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  17913. __pyx_d, /*PyObject *globals,*/
  17914. 0 /*PyObject *locals*/
  17915. );
  17916. if (unlikely(!frame))
  17917. return NULL;
  17918. self->gi_frame = frame;
  17919. }
  17920. Py_INCREF(frame);
  17921. return frame;
  17922. }
  17923. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  17924. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  17925. PyObject *name, PyObject *qualname, PyObject *module_name) {
  17926. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  17927. if (unlikely(!gen))
  17928. return NULL;
  17929. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  17930. }
  17931. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  17932. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  17933. PyObject *name, PyObject *qualname, PyObject *module_name) {
  17934. gen->body = body;
  17935. gen->closure = closure;
  17936. Py_XINCREF(closure);
  17937. gen->is_running = 0;
  17938. gen->resume_label = 0;
  17939. gen->classobj = NULL;
  17940. gen->yieldfrom = NULL;
  17941. #if PY_VERSION_HEX >= 0x030B00a4
  17942. gen->gi_exc_state.exc_value = NULL;
  17943. #else
  17944. gen->gi_exc_state.exc_type = NULL;
  17945. gen->gi_exc_state.exc_value = NULL;
  17946. gen->gi_exc_state.exc_traceback = NULL;
  17947. #endif
  17948. #if CYTHON_USE_EXC_INFO_STACK
  17949. gen->gi_exc_state.previous_item = NULL;
  17950. #endif
  17951. gen->gi_weakreflist = NULL;
  17952. Py_XINCREF(qualname);
  17953. gen->gi_qualname = qualname;
  17954. Py_XINCREF(name);
  17955. gen->gi_name = name;
  17956. Py_XINCREF(module_name);
  17957. gen->gi_modulename = module_name;
  17958. Py_XINCREF(code);
  17959. gen->gi_code = code;
  17960. gen->gi_frame = NULL;
  17961. PyObject_GC_Track(gen);
  17962. return gen;
  17963. }
  17964. /* PatchModuleWithCoroutine */
  17965. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
  17966. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  17967. int result;
  17968. PyObject *globals, *result_obj;
  17969. globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
  17970. result = PyDict_SetItemString(globals, "_cython_coroutine_type",
  17971. #ifdef __Pyx_Coroutine_USED
  17972. (PyObject*)__pyx_CoroutineType);
  17973. #else
  17974. Py_None);
  17975. #endif
  17976. if (unlikely(result < 0)) goto ignore;
  17977. result = PyDict_SetItemString(globals, "_cython_generator_type",
  17978. #ifdef __Pyx_Generator_USED
  17979. (PyObject*)__pyx_GeneratorType);
  17980. #else
  17981. Py_None);
  17982. #endif
  17983. if (unlikely(result < 0)) goto ignore;
  17984. if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
  17985. if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
  17986. result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
  17987. if (unlikely(!result_obj)) goto ignore;
  17988. Py_DECREF(result_obj);
  17989. Py_DECREF(globals);
  17990. return module;
  17991. ignore:
  17992. Py_XDECREF(globals);
  17993. PyErr_WriteUnraisable(module);
  17994. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
  17995. Py_DECREF(module);
  17996. module = NULL;
  17997. }
  17998. #else
  17999. py_code++;
  18000. #endif
  18001. return module;
  18002. }
  18003. /* PatchGeneratorABC */
  18004. #ifndef CYTHON_REGISTER_ABCS
  18005. #define CYTHON_REGISTER_ABCS 1
  18006. #endif
  18007. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  18008. static PyObject* __Pyx_patch_abc_module(PyObject *module);
  18009. static PyObject* __Pyx_patch_abc_module(PyObject *module) {
  18010. module = __Pyx_Coroutine_patch_module(
  18011. module, ""
  18012. "if _cython_generator_type is not None:\n"
  18013. " try: Generator = _module.Generator\n"
  18014. " except AttributeError: pass\n"
  18015. " else: Generator.register(_cython_generator_type)\n"
  18016. "if _cython_coroutine_type is not None:\n"
  18017. " try: Coroutine = _module.Coroutine\n"
  18018. " except AttributeError: pass\n"
  18019. " else: Coroutine.register(_cython_coroutine_type)\n"
  18020. );
  18021. return module;
  18022. }
  18023. #endif
  18024. static int __Pyx_patch_abc(void) {
  18025. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  18026. static int abc_patched = 0;
  18027. if (CYTHON_REGISTER_ABCS && !abc_patched) {
  18028. PyObject *module;
  18029. module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
  18030. if (unlikely(!module)) {
  18031. PyErr_WriteUnraisable(NULL);
  18032. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
  18033. ((PY_MAJOR_VERSION >= 3) ?
  18034. "Cython module failed to register with collections.abc module" :
  18035. "Cython module failed to register with collections module"), 1) < 0)) {
  18036. return -1;
  18037. }
  18038. } else {
  18039. module = __Pyx_patch_abc_module(module);
  18040. abc_patched = 1;
  18041. if (unlikely(!module))
  18042. return -1;
  18043. Py_DECREF(module);
  18044. }
  18045. module = PyImport_ImportModule("backports_abc");
  18046. if (module) {
  18047. module = __Pyx_patch_abc_module(module);
  18048. Py_XDECREF(module);
  18049. }
  18050. if (!module) {
  18051. PyErr_Clear();
  18052. }
  18053. }
  18054. #else
  18055. if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
  18056. #endif
  18057. return 0;
  18058. }
  18059. /* Generator */
  18060. static PyMethodDef __pyx_Generator_methods[] = {
  18061. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  18062. (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  18063. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  18064. (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  18065. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  18066. (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  18067. {0, 0, 0, 0}
  18068. };
  18069. static PyMemberDef __pyx_Generator_memberlist[] = {
  18070. {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
  18071. {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  18072. (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
  18073. {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  18074. {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  18075. #if CYTHON_USE_TYPE_SPECS
  18076. {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  18077. #endif
  18078. {0, 0, 0, 0, 0}
  18079. };
  18080. static PyGetSetDef __pyx_Generator_getsets[] = {
  18081. {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  18082. (char*) PyDoc_STR("name of the generator"), 0},
  18083. {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  18084. (char*) PyDoc_STR("qualified name of the generator"), 0},
  18085. {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  18086. (char*) PyDoc_STR("Frame of the generator"), 0},
  18087. {0, 0, 0, 0, 0}
  18088. };
  18089. #if CYTHON_USE_TYPE_SPECS
  18090. static PyType_Slot __pyx_GeneratorType_slots[] = {
  18091. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  18092. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  18093. {Py_tp_iter, (void *)PyObject_SelfIter},
  18094. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  18095. {Py_tp_methods, (void *)__pyx_Generator_methods},
  18096. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  18097. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  18098. {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict},
  18099. #if CYTHON_USE_TP_FINALIZE
  18100. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  18101. #endif
  18102. {0, 0},
  18103. };
  18104. static PyType_Spec __pyx_GeneratorType_spec = {
  18105. __PYX_TYPE_MODULE_PREFIX "generator",
  18106. sizeof(__pyx_CoroutineObject),
  18107. 0,
  18108. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
  18109. __pyx_GeneratorType_slots
  18110. };
  18111. #else
  18112. static PyTypeObject __pyx_GeneratorType_type = {
  18113. PyVarObject_HEAD_INIT(0, 0)
  18114. __PYX_TYPE_MODULE_PREFIX "generator",
  18115. sizeof(__pyx_CoroutineObject),
  18116. 0,
  18117. (destructor) __Pyx_Coroutine_dealloc,
  18118. 0,
  18119. 0,
  18120. 0,
  18121. 0,
  18122. 0,
  18123. 0,
  18124. 0,
  18125. 0,
  18126. 0,
  18127. 0,
  18128. 0,
  18129. 0,
  18130. 0,
  18131. 0,
  18132. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
  18133. 0,
  18134. (traverseproc) __Pyx_Coroutine_traverse,
  18135. 0,
  18136. 0,
  18137. offsetof(__pyx_CoroutineObject, gi_weakreflist),
  18138. 0,
  18139. (iternextfunc) __Pyx_Generator_Next,
  18140. __pyx_Generator_methods,
  18141. __pyx_Generator_memberlist,
  18142. __pyx_Generator_getsets,
  18143. 0,
  18144. 0,
  18145. 0,
  18146. 0,
  18147. 0,
  18148. 0,
  18149. 0,
  18150. 0,
  18151. 0,
  18152. 0,
  18153. 0,
  18154. 0,
  18155. 0,
  18156. 0,
  18157. 0,
  18158. #if CYTHON_USE_TP_FINALIZE
  18159. 0,
  18160. #else
  18161. __Pyx_Coroutine_del,
  18162. #endif
  18163. 0,
  18164. #if CYTHON_USE_TP_FINALIZE
  18165. __Pyx_Coroutine_del,
  18166. #elif PY_VERSION_HEX >= 0x030400a1
  18167. 0,
  18168. #endif
  18169. #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  18170. 0,
  18171. #endif
  18172. #if __PYX_NEED_TP_PRINT_SLOT
  18173. 0,
  18174. #endif
  18175. #if PY_VERSION_HEX >= 0x030C0000
  18176. 0,
  18177. #endif
  18178. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  18179. 0,
  18180. #endif
  18181. };
  18182. #endif
  18183. static int __pyx_Generator_init(PyObject *module) {
  18184. #if CYTHON_USE_TYPE_SPECS
  18185. __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL);
  18186. #else
  18187. CYTHON_UNUSED_VAR(module);
  18188. __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  18189. __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
  18190. __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
  18191. #endif
  18192. if (unlikely(!__pyx_GeneratorType)) {
  18193. return -1;
  18194. }
  18195. return 0;
  18196. }
  18197. /* CheckBinaryVersion */
  18198. static unsigned long __Pyx_get_runtime_version(void) {
  18199. #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
  18200. return Py_Version & ~0xFFUL;
  18201. #else
  18202. const char* rt_version = Py_GetVersion();
  18203. unsigned long version = 0;
  18204. unsigned long factor = 0x01000000UL;
  18205. unsigned int digit = 0;
  18206. int i = 0;
  18207. while (factor) {
  18208. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  18209. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  18210. ++i;
  18211. }
  18212. version += factor * digit;
  18213. if (rt_version[i] != '.')
  18214. break;
  18215. digit = 0;
  18216. factor >>= 8;
  18217. ++i;
  18218. }
  18219. return version;
  18220. #endif
  18221. }
  18222. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  18223. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  18224. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  18225. return 0;
  18226. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  18227. return 1;
  18228. {
  18229. char message[200];
  18230. PyOS_snprintf(message, sizeof(message),
  18231. "compile time Python version %d.%d "
  18232. "of module '%.100s' "
  18233. "%s "
  18234. "runtime version %d.%d",
  18235. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  18236. __Pyx_MODULE_NAME,
  18237. (allow_newer) ? "was newer than" : "does not match",
  18238. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  18239. );
  18240. return PyErr_WarnEx(NULL, message, 1);
  18241. }
  18242. }
  18243. /* InitStrings */
  18244. #if PY_MAJOR_VERSION >= 3
  18245. static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
  18246. if (t.is_unicode | t.is_str) {
  18247. if (t.intern) {
  18248. *str = PyUnicode_InternFromString(t.s);
  18249. } else if (t.encoding) {
  18250. *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
  18251. } else {
  18252. *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
  18253. }
  18254. } else {
  18255. *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
  18256. }
  18257. if (!*str)
  18258. return -1;
  18259. if (PyObject_Hash(*str) == -1)
  18260. return -1;
  18261. return 0;
  18262. }
  18263. #endif
  18264. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  18265. while (t->p) {
  18266. #if PY_MAJOR_VERSION >= 3
  18267. __Pyx_InitString(*t, t->p);
  18268. #else
  18269. if (t->is_unicode) {
  18270. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  18271. } else if (t->intern) {
  18272. *t->p = PyString_InternFromString(t->s);
  18273. } else {
  18274. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  18275. }
  18276. if (!*t->p)
  18277. return -1;
  18278. if (PyObject_Hash(*t->p) == -1)
  18279. return -1;
  18280. #endif
  18281. ++t;
  18282. }
  18283. return 0;
  18284. }
  18285. #include <string.h>
  18286. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  18287. size_t len = strlen(s);
  18288. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  18289. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  18290. return -1;
  18291. }
  18292. return (Py_ssize_t) len;
  18293. }
  18294. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  18295. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18296. if (unlikely(len < 0)) return NULL;
  18297. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  18298. }
  18299. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  18300. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  18301. if (unlikely(len < 0)) return NULL;
  18302. return PyByteArray_FromStringAndSize(c_str, len);
  18303. }
  18304. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  18305. Py_ssize_t ignore;
  18306. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  18307. }
  18308. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  18309. #if !CYTHON_PEP393_ENABLED
  18310. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18311. char* defenc_c;
  18312. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  18313. if (!defenc) return NULL;
  18314. defenc_c = PyBytes_AS_STRING(defenc);
  18315. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18316. {
  18317. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  18318. char* c;
  18319. for (c = defenc_c; c < end; c++) {
  18320. if ((unsigned char) (*c) >= 128) {
  18321. PyUnicode_AsASCIIString(o);
  18322. return NULL;
  18323. }
  18324. }
  18325. }
  18326. #endif
  18327. *length = PyBytes_GET_SIZE(defenc);
  18328. return defenc_c;
  18329. }
  18330. #else
  18331. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18332. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  18333. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18334. if (likely(PyUnicode_IS_ASCII(o))) {
  18335. *length = PyUnicode_GET_LENGTH(o);
  18336. return PyUnicode_AsUTF8(o);
  18337. } else {
  18338. PyUnicode_AsASCIIString(o);
  18339. return NULL;
  18340. }
  18341. #else
  18342. return PyUnicode_AsUTF8AndSize(o, length);
  18343. #endif
  18344. }
  18345. #endif
  18346. #endif
  18347. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  18348. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  18349. if (
  18350. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  18351. __Pyx_sys_getdefaultencoding_not_ascii &&
  18352. #endif
  18353. PyUnicode_Check(o)) {
  18354. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  18355. } else
  18356. #endif
  18357. #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  18358. if (PyByteArray_Check(o)) {
  18359. *length = PyByteArray_GET_SIZE(o);
  18360. return PyByteArray_AS_STRING(o);
  18361. } else
  18362. #endif
  18363. {
  18364. char* result;
  18365. int r = PyBytes_AsStringAndSize(o, &result, length);
  18366. if (unlikely(r < 0)) {
  18367. return NULL;
  18368. } else {
  18369. return result;
  18370. }
  18371. }
  18372. }
  18373. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  18374. int is_true = x == Py_True;
  18375. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  18376. else return PyObject_IsTrue(x);
  18377. }
  18378. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  18379. int retval;
  18380. if (unlikely(!x)) return -1;
  18381. retval = __Pyx_PyObject_IsTrue(x);
  18382. Py_DECREF(x);
  18383. return retval;
  18384. }
  18385. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  18386. __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
  18387. #if PY_MAJOR_VERSION >= 3
  18388. if (PyLong_Check(result)) {
  18389. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  18390. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  18391. "The ability to return an instance of a strict subclass of int is deprecated, "
  18392. "and may be removed in a future version of Python.",
  18393. result_type_name)) {
  18394. __Pyx_DECREF_TypeName(result_type_name);
  18395. Py_DECREF(result);
  18396. return NULL;
  18397. }
  18398. __Pyx_DECREF_TypeName(result_type_name);
  18399. return result;
  18400. }
  18401. #endif
  18402. PyErr_Format(PyExc_TypeError,
  18403. "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
  18404. type_name, type_name, result_type_name);
  18405. __Pyx_DECREF_TypeName(result_type_name);
  18406. Py_DECREF(result);
  18407. return NULL;
  18408. }
  18409. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  18410. #if CYTHON_USE_TYPE_SLOTS
  18411. PyNumberMethods *m;
  18412. #endif
  18413. const char *name = NULL;
  18414. PyObject *res = NULL;
  18415. #if PY_MAJOR_VERSION < 3
  18416. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  18417. #else
  18418. if (likely(PyLong_Check(x)))
  18419. #endif
  18420. return __Pyx_NewRef(x);
  18421. #if CYTHON_USE_TYPE_SLOTS
  18422. m = Py_TYPE(x)->tp_as_number;
  18423. #if PY_MAJOR_VERSION < 3
  18424. if (m && m->nb_int) {
  18425. name = "int";
  18426. res = m->nb_int(x);
  18427. }
  18428. else if (m && m->nb_long) {
  18429. name = "long";
  18430. res = m->nb_long(x);
  18431. }
  18432. #else
  18433. if (likely(m && m->nb_int)) {
  18434. name = "int";
  18435. res = m->nb_int(x);
  18436. }
  18437. #endif
  18438. #else
  18439. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  18440. res = PyNumber_Int(x);
  18441. }
  18442. #endif
  18443. if (likely(res)) {
  18444. #if PY_MAJOR_VERSION < 3
  18445. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  18446. #else
  18447. if (unlikely(!PyLong_CheckExact(res))) {
  18448. #endif
  18449. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  18450. }
  18451. }
  18452. else if (!PyErr_Occurred()) {
  18453. PyErr_SetString(PyExc_TypeError,
  18454. "an integer is required");
  18455. }
  18456. return res;
  18457. }
  18458. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  18459. Py_ssize_t ival;
  18460. PyObject *x;
  18461. #if PY_MAJOR_VERSION < 3
  18462. if (likely(PyInt_CheckExact(b))) {
  18463. if (sizeof(Py_ssize_t) >= sizeof(long))
  18464. return PyInt_AS_LONG(b);
  18465. else
  18466. return PyInt_AsSsize_t(b);
  18467. }
  18468. #endif
  18469. if (likely(PyLong_CheckExact(b))) {
  18470. #if CYTHON_USE_PYLONG_INTERNALS
  18471. if (likely(__Pyx_PyLong_IsCompact(b))) {
  18472. return __Pyx_PyLong_CompactValue(b);
  18473. } else {
  18474. const digit* digits = __Pyx_PyLong_Digits(b);
  18475. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  18476. switch (size) {
  18477. case 2:
  18478. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18479. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18480. }
  18481. break;
  18482. case -2:
  18483. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  18484. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18485. }
  18486. break;
  18487. case 3:
  18488. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18489. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18490. }
  18491. break;
  18492. case -3:
  18493. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  18494. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  18495. }
  18496. break;
  18497. case 4:
  18498. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18499. 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]));
  18500. }
  18501. break;
  18502. case -4:
  18503. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  18504. 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]));
  18505. }
  18506. break;
  18507. }
  18508. }
  18509. #endif
  18510. return PyLong_AsSsize_t(b);
  18511. }
  18512. x = PyNumber_Index(b);
  18513. if (!x) return -1;
  18514. ival = PyInt_AsSsize_t(x);
  18515. Py_DECREF(x);
  18516. return ival;
  18517. }
  18518. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  18519. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  18520. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  18521. #if PY_MAJOR_VERSION < 3
  18522. } else if (likely(PyInt_CheckExact(o))) {
  18523. return PyInt_AS_LONG(o);
  18524. #endif
  18525. } else {
  18526. Py_ssize_t ival;
  18527. PyObject *x;
  18528. x = PyNumber_Index(o);
  18529. if (!x) return -1;
  18530. ival = PyInt_AsLong(x);
  18531. Py_DECREF(x);
  18532. return ival;
  18533. }
  18534. }
  18535. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  18536. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  18537. }
  18538. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  18539. return PyInt_FromSize_t(ival);
  18540. }
  18541. /* #### Code section: utility_code_pragmas_end ### */
  18542. #ifdef _MSC_VER
  18543. #pragma warning( pop )
  18544. #endif
  18545. /* #### Code section: end ### */
  18546. #endif /* Py_PYTHON_H */