ArtNetProcessor_cy_pi.c 788 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120
  1. /* Generated by Cython 0.29.21 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "depends": [],
  6. "name": "ArtNetProcessor_cy_pi",
  7. "sources": [
  8. "ArtNetProcessor_cy_pi.pyx"
  9. ]
  10. },
  11. "module_name": "ArtNetProcessor_cy_pi"
  12. }
  13. END: Cython Metadata */
  14. #define PY_SSIZE_T_CLEAN
  15. #include "Python.h"
  16. #ifndef Py_PYTHON_H
  17. #error Python headers needed to compile C extensions, please install development version of Python.
  18. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  19. #error Cython requires Python 2.6+ or Python 3.3+.
  20. #else
  21. #define CYTHON_ABI "0_29_21"
  22. #define CYTHON_HEX_VERSION 0x001D15F0
  23. #define CYTHON_FUTURE_DIVISION 0
  24. #include <stddef.h>
  25. #ifndef offsetof
  26. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  27. #endif
  28. #if !defined(WIN32) && !defined(MS_WINDOWS)
  29. #ifndef __stdcall
  30. #define __stdcall
  31. #endif
  32. #ifndef __cdecl
  33. #define __cdecl
  34. #endif
  35. #ifndef __fastcall
  36. #define __fastcall
  37. #endif
  38. #endif
  39. #ifndef DL_IMPORT
  40. #define DL_IMPORT(t) t
  41. #endif
  42. #ifndef DL_EXPORT
  43. #define DL_EXPORT(t) t
  44. #endif
  45. #define __PYX_COMMA ,
  46. #ifndef HAVE_LONG_LONG
  47. #if PY_VERSION_HEX >= 0x02070000
  48. #define HAVE_LONG_LONG
  49. #endif
  50. #endif
  51. #ifndef PY_LONG_LONG
  52. #define PY_LONG_LONG LONG_LONG
  53. #endif
  54. #ifndef Py_HUGE_VAL
  55. #define Py_HUGE_VAL HUGE_VAL
  56. #endif
  57. #ifdef PYPY_VERSION
  58. #define CYTHON_COMPILING_IN_PYPY 1
  59. #define CYTHON_COMPILING_IN_PYSTON 0
  60. #define CYTHON_COMPILING_IN_CPYTHON 0
  61. #undef CYTHON_USE_TYPE_SLOTS
  62. #define CYTHON_USE_TYPE_SLOTS 0
  63. #undef CYTHON_USE_PYTYPE_LOOKUP
  64. #define CYTHON_USE_PYTYPE_LOOKUP 0
  65. #if PY_VERSION_HEX < 0x03050000
  66. #undef CYTHON_USE_ASYNC_SLOTS
  67. #define CYTHON_USE_ASYNC_SLOTS 0
  68. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  69. #define CYTHON_USE_ASYNC_SLOTS 1
  70. #endif
  71. #undef CYTHON_USE_PYLIST_INTERNALS
  72. #define CYTHON_USE_PYLIST_INTERNALS 0
  73. #undef CYTHON_USE_UNICODE_INTERNALS
  74. #define CYTHON_USE_UNICODE_INTERNALS 0
  75. #undef CYTHON_USE_UNICODE_WRITER
  76. #define CYTHON_USE_UNICODE_WRITER 0
  77. #undef CYTHON_USE_PYLONG_INTERNALS
  78. #define CYTHON_USE_PYLONG_INTERNALS 0
  79. #undef CYTHON_AVOID_BORROWED_REFS
  80. #define CYTHON_AVOID_BORROWED_REFS 1
  81. #undef CYTHON_ASSUME_SAFE_MACROS
  82. #define CYTHON_ASSUME_SAFE_MACROS 0
  83. #undef CYTHON_UNPACK_METHODS
  84. #define CYTHON_UNPACK_METHODS 0
  85. #undef CYTHON_FAST_THREAD_STATE
  86. #define CYTHON_FAST_THREAD_STATE 0
  87. #undef CYTHON_FAST_PYCALL
  88. #define CYTHON_FAST_PYCALL 0
  89. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  90. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  91. #undef CYTHON_USE_TP_FINALIZE
  92. #define CYTHON_USE_TP_FINALIZE 0
  93. #undef CYTHON_USE_DICT_VERSIONS
  94. #define CYTHON_USE_DICT_VERSIONS 0
  95. #undef CYTHON_USE_EXC_INFO_STACK
  96. #define CYTHON_USE_EXC_INFO_STACK 0
  97. #elif defined(PYSTON_VERSION)
  98. #define CYTHON_COMPILING_IN_PYPY 0
  99. #define CYTHON_COMPILING_IN_PYSTON 1
  100. #define CYTHON_COMPILING_IN_CPYTHON 0
  101. #ifndef CYTHON_USE_TYPE_SLOTS
  102. #define CYTHON_USE_TYPE_SLOTS 1
  103. #endif
  104. #undef CYTHON_USE_PYTYPE_LOOKUP
  105. #define CYTHON_USE_PYTYPE_LOOKUP 0
  106. #undef CYTHON_USE_ASYNC_SLOTS
  107. #define CYTHON_USE_ASYNC_SLOTS 0
  108. #undef CYTHON_USE_PYLIST_INTERNALS
  109. #define CYTHON_USE_PYLIST_INTERNALS 0
  110. #ifndef CYTHON_USE_UNICODE_INTERNALS
  111. #define CYTHON_USE_UNICODE_INTERNALS 1
  112. #endif
  113. #undef CYTHON_USE_UNICODE_WRITER
  114. #define CYTHON_USE_UNICODE_WRITER 0
  115. #undef CYTHON_USE_PYLONG_INTERNALS
  116. #define CYTHON_USE_PYLONG_INTERNALS 0
  117. #ifndef CYTHON_AVOID_BORROWED_REFS
  118. #define CYTHON_AVOID_BORROWED_REFS 0
  119. #endif
  120. #ifndef CYTHON_ASSUME_SAFE_MACROS
  121. #define CYTHON_ASSUME_SAFE_MACROS 1
  122. #endif
  123. #ifndef CYTHON_UNPACK_METHODS
  124. #define CYTHON_UNPACK_METHODS 1
  125. #endif
  126. #undef CYTHON_FAST_THREAD_STATE
  127. #define CYTHON_FAST_THREAD_STATE 0
  128. #undef CYTHON_FAST_PYCALL
  129. #define CYTHON_FAST_PYCALL 0
  130. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  131. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  132. #undef CYTHON_USE_TP_FINALIZE
  133. #define CYTHON_USE_TP_FINALIZE 0
  134. #undef CYTHON_USE_DICT_VERSIONS
  135. #define CYTHON_USE_DICT_VERSIONS 0
  136. #undef CYTHON_USE_EXC_INFO_STACK
  137. #define CYTHON_USE_EXC_INFO_STACK 0
  138. #else
  139. #define CYTHON_COMPILING_IN_PYPY 0
  140. #define CYTHON_COMPILING_IN_PYSTON 0
  141. #define CYTHON_COMPILING_IN_CPYTHON 1
  142. #ifndef CYTHON_USE_TYPE_SLOTS
  143. #define CYTHON_USE_TYPE_SLOTS 1
  144. #endif
  145. #if PY_VERSION_HEX < 0x02070000
  146. #undef CYTHON_USE_PYTYPE_LOOKUP
  147. #define CYTHON_USE_PYTYPE_LOOKUP 0
  148. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  149. #define CYTHON_USE_PYTYPE_LOOKUP 1
  150. #endif
  151. #if PY_MAJOR_VERSION < 3
  152. #undef CYTHON_USE_ASYNC_SLOTS
  153. #define CYTHON_USE_ASYNC_SLOTS 0
  154. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  155. #define CYTHON_USE_ASYNC_SLOTS 1
  156. #endif
  157. #if PY_VERSION_HEX < 0x02070000
  158. #undef CYTHON_USE_PYLONG_INTERNALS
  159. #define CYTHON_USE_PYLONG_INTERNALS 0
  160. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  161. #define CYTHON_USE_PYLONG_INTERNALS 1
  162. #endif
  163. #ifndef CYTHON_USE_PYLIST_INTERNALS
  164. #define CYTHON_USE_PYLIST_INTERNALS 1
  165. #endif
  166. #ifndef CYTHON_USE_UNICODE_INTERNALS
  167. #define CYTHON_USE_UNICODE_INTERNALS 1
  168. #endif
  169. #if PY_VERSION_HEX < 0x030300F0
  170. #undef CYTHON_USE_UNICODE_WRITER
  171. #define CYTHON_USE_UNICODE_WRITER 0
  172. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  173. #define CYTHON_USE_UNICODE_WRITER 1
  174. #endif
  175. #ifndef CYTHON_AVOID_BORROWED_REFS
  176. #define CYTHON_AVOID_BORROWED_REFS 0
  177. #endif
  178. #ifndef CYTHON_ASSUME_SAFE_MACROS
  179. #define CYTHON_ASSUME_SAFE_MACROS 1
  180. #endif
  181. #ifndef CYTHON_UNPACK_METHODS
  182. #define CYTHON_UNPACK_METHODS 1
  183. #endif
  184. #ifndef CYTHON_FAST_THREAD_STATE
  185. #define CYTHON_FAST_THREAD_STATE 1
  186. #endif
  187. #ifndef CYTHON_FAST_PYCALL
  188. #define CYTHON_FAST_PYCALL 1
  189. #endif
  190. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  191. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  192. #endif
  193. #ifndef CYTHON_USE_TP_FINALIZE
  194. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  195. #endif
  196. #ifndef CYTHON_USE_DICT_VERSIONS
  197. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  198. #endif
  199. #ifndef CYTHON_USE_EXC_INFO_STACK
  200. #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  201. #endif
  202. #endif
  203. #if !defined(CYTHON_FAST_PYCCALL)
  204. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  205. #endif
  206. #if CYTHON_USE_PYLONG_INTERNALS
  207. #include "longintrepr.h"
  208. #undef SHIFT
  209. #undef BASE
  210. #undef MASK
  211. #ifdef SIZEOF_VOID_P
  212. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  213. #endif
  214. #endif
  215. #ifndef __has_attribute
  216. #define __has_attribute(x) 0
  217. #endif
  218. #ifndef __has_cpp_attribute
  219. #define __has_cpp_attribute(x) 0
  220. #endif
  221. #ifndef CYTHON_RESTRICT
  222. #if defined(__GNUC__)
  223. #define CYTHON_RESTRICT __restrict__
  224. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  225. #define CYTHON_RESTRICT __restrict
  226. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  227. #define CYTHON_RESTRICT restrict
  228. #else
  229. #define CYTHON_RESTRICT
  230. #endif
  231. #endif
  232. #ifndef CYTHON_UNUSED
  233. # if defined(__GNUC__)
  234. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  235. # define CYTHON_UNUSED __attribute__ ((__unused__))
  236. # else
  237. # define CYTHON_UNUSED
  238. # endif
  239. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  240. # define CYTHON_UNUSED __attribute__ ((__unused__))
  241. # else
  242. # define CYTHON_UNUSED
  243. # endif
  244. #endif
  245. #ifndef CYTHON_MAYBE_UNUSED_VAR
  246. # if defined(__cplusplus)
  247. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  248. # else
  249. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  250. # endif
  251. #endif
  252. #ifndef CYTHON_NCP_UNUSED
  253. # if CYTHON_COMPILING_IN_CPYTHON
  254. # define CYTHON_NCP_UNUSED
  255. # else
  256. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  257. # endif
  258. #endif
  259. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  260. #ifdef _MSC_VER
  261. #ifndef _MSC_STDINT_H_
  262. #if _MSC_VER < 1300
  263. typedef unsigned char uint8_t;
  264. typedef unsigned int uint32_t;
  265. #else
  266. typedef unsigned __int8 uint8_t;
  267. typedef unsigned __int32 uint32_t;
  268. #endif
  269. #endif
  270. #else
  271. #include <stdint.h>
  272. #endif
  273. #ifndef CYTHON_FALLTHROUGH
  274. #if defined(__cplusplus) && __cplusplus >= 201103L
  275. #if __has_cpp_attribute(fallthrough)
  276. #define CYTHON_FALLTHROUGH [[fallthrough]]
  277. #elif __has_cpp_attribute(clang::fallthrough)
  278. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  279. #elif __has_cpp_attribute(gnu::fallthrough)
  280. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  281. #endif
  282. #endif
  283. #ifndef CYTHON_FALLTHROUGH
  284. #if __has_attribute(fallthrough)
  285. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  286. #else
  287. #define CYTHON_FALLTHROUGH
  288. #endif
  289. #endif
  290. #if defined(__clang__ ) && defined(__apple_build_version__)
  291. #if __apple_build_version__ < 7000000
  292. #undef CYTHON_FALLTHROUGH
  293. #define CYTHON_FALLTHROUGH
  294. #endif
  295. #endif
  296. #endif
  297. #ifndef CYTHON_INLINE
  298. #if defined(__clang__)
  299. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  300. #elif defined(__GNUC__)
  301. #define CYTHON_INLINE __inline__
  302. #elif defined(_MSC_VER)
  303. #define CYTHON_INLINE __inline
  304. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  305. #define CYTHON_INLINE inline
  306. #else
  307. #define CYTHON_INLINE
  308. #endif
  309. #endif
  310. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  311. #define Py_OptimizeFlag 0
  312. #endif
  313. #define __PYX_BUILD_PY_SSIZE_T "n"
  314. #define CYTHON_FORMAT_SSIZE_T "z"
  315. #if PY_MAJOR_VERSION < 3
  316. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  317. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  318. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  319. #define __Pyx_DefaultClassType PyClass_Type
  320. #else
  321. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  322. #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  323. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  324. PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  325. #else
  326. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  327. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  328. #endif
  329. #define __Pyx_DefaultClassType PyType_Type
  330. #endif
  331. #ifndef Py_TPFLAGS_CHECKTYPES
  332. #define Py_TPFLAGS_CHECKTYPES 0
  333. #endif
  334. #ifndef Py_TPFLAGS_HAVE_INDEX
  335. #define Py_TPFLAGS_HAVE_INDEX 0
  336. #endif
  337. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  338. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  339. #endif
  340. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  341. #define Py_TPFLAGS_HAVE_FINALIZE 0
  342. #endif
  343. #ifndef METH_STACKLESS
  344. #define METH_STACKLESS 0
  345. #endif
  346. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  347. #ifndef METH_FASTCALL
  348. #define METH_FASTCALL 0x80
  349. #endif
  350. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  351. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  352. Py_ssize_t nargs, PyObject *kwnames);
  353. #else
  354. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  355. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  356. #endif
  357. #if CYTHON_FAST_PYCCALL
  358. #define __Pyx_PyFastCFunction_Check(func)\
  359. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  360. #else
  361. #define __Pyx_PyFastCFunction_Check(func) 0
  362. #endif
  363. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  364. #define PyObject_Malloc(s) PyMem_Malloc(s)
  365. #define PyObject_Free(p) PyMem_Free(p)
  366. #define PyObject_Realloc(p) PyMem_Realloc(p)
  367. #endif
  368. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  369. #define PyMem_RawMalloc(n) PyMem_Malloc(n)
  370. #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
  371. #define PyMem_RawFree(p) PyMem_Free(p)
  372. #endif
  373. #if CYTHON_COMPILING_IN_PYSTON
  374. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  375. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  376. #else
  377. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  378. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  379. #endif
  380. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  381. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  382. #elif PY_VERSION_HEX >= 0x03060000
  383. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  384. #elif PY_VERSION_HEX >= 0x03000000
  385. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  386. #else
  387. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  388. #endif
  389. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  390. #include "pythread.h"
  391. #define Py_tss_NEEDS_INIT 0
  392. typedef int Py_tss_t;
  393. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  394. *key = PyThread_create_key();
  395. return 0;
  396. }
  397. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  398. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  399. *key = Py_tss_NEEDS_INIT;
  400. return key;
  401. }
  402. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  403. PyObject_Free(key);
  404. }
  405. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  406. return *key != Py_tss_NEEDS_INIT;
  407. }
  408. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  409. PyThread_delete_key(*key);
  410. *key = Py_tss_NEEDS_INIT;
  411. }
  412. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  413. return PyThread_set_key_value(*key, value);
  414. }
  415. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  416. return PyThread_get_key_value(*key);
  417. }
  418. #endif
  419. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  420. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  421. #else
  422. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  423. #endif
  424. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  425. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  426. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  427. #else
  428. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  429. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  430. #endif
  431. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  432. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  433. #else
  434. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  435. #endif
  436. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  437. #define CYTHON_PEP393_ENABLED 1
  438. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  439. 0 : _PyUnicode_Ready((PyObject *)(op)))
  440. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  441. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  442. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  443. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  444. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  445. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  446. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  447. #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  448. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  449. #else
  450. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
  451. #endif
  452. #else
  453. #define CYTHON_PEP393_ENABLED 0
  454. #define PyUnicode_1BYTE_KIND 1
  455. #define PyUnicode_2BYTE_KIND 2
  456. #define PyUnicode_4BYTE_KIND 4
  457. #define __Pyx_PyUnicode_READY(op) (0)
  458. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  459. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  460. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  461. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  462. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  463. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  464. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  465. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  466. #endif
  467. #if CYTHON_COMPILING_IN_PYPY
  468. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  469. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  470. #else
  471. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  472. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  473. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  474. #endif
  475. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  476. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  477. #endif
  478. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  479. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  480. #endif
  481. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  482. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  483. #endif
  484. #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))
  485. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  486. #if PY_MAJOR_VERSION >= 3
  487. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  488. #else
  489. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  490. #endif
  491. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  492. #define PyObject_ASCII(o) PyObject_Repr(o)
  493. #endif
  494. #if PY_MAJOR_VERSION >= 3
  495. #define PyBaseString_Type PyUnicode_Type
  496. #define PyStringObject PyUnicodeObject
  497. #define PyString_Type PyUnicode_Type
  498. #define PyString_Check PyUnicode_Check
  499. #define PyString_CheckExact PyUnicode_CheckExact
  500. #ifndef PyObject_Unicode
  501. #define PyObject_Unicode PyObject_Str
  502. #endif
  503. #endif
  504. #if PY_MAJOR_VERSION >= 3
  505. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  506. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  507. #else
  508. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  509. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  510. #endif
  511. #ifndef PySet_CheckExact
  512. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  513. #endif
  514. #if PY_VERSION_HEX >= 0x030900A4
  515. #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  516. #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  517. #else
  518. #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  519. #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  520. #endif
  521. #if CYTHON_ASSUME_SAFE_MACROS
  522. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  523. #else
  524. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  525. #endif
  526. #if PY_MAJOR_VERSION >= 3
  527. #define PyIntObject PyLongObject
  528. #define PyInt_Type PyLong_Type
  529. #define PyInt_Check(op) PyLong_Check(op)
  530. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  531. #define PyInt_FromString PyLong_FromString
  532. #define PyInt_FromUnicode PyLong_FromUnicode
  533. #define PyInt_FromLong PyLong_FromLong
  534. #define PyInt_FromSize_t PyLong_FromSize_t
  535. #define PyInt_FromSsize_t PyLong_FromSsize_t
  536. #define PyInt_AsLong PyLong_AsLong
  537. #define PyInt_AS_LONG PyLong_AS_LONG
  538. #define PyInt_AsSsize_t PyLong_AsSsize_t
  539. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  540. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  541. #define PyNumber_Int PyNumber_Long
  542. #endif
  543. #if PY_MAJOR_VERSION >= 3
  544. #define PyBoolObject PyLongObject
  545. #endif
  546. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  547. #ifndef PyUnicode_InternFromString
  548. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  549. #endif
  550. #endif
  551. #if PY_VERSION_HEX < 0x030200A4
  552. typedef long Py_hash_t;
  553. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  554. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  555. #else
  556. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  557. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  558. #endif
  559. #if PY_MAJOR_VERSION >= 3
  560. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
  561. #else
  562. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  563. #endif
  564. #if CYTHON_USE_ASYNC_SLOTS
  565. #if PY_VERSION_HEX >= 0x030500B1
  566. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  567. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  568. #else
  569. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  570. #endif
  571. #else
  572. #define __Pyx_PyType_AsAsync(obj) NULL
  573. #endif
  574. #ifndef __Pyx_PyAsyncMethodsStruct
  575. typedef struct {
  576. unaryfunc am_await;
  577. unaryfunc am_aiter;
  578. unaryfunc am_anext;
  579. } __Pyx_PyAsyncMethodsStruct;
  580. #endif
  581. #if defined(WIN32) || defined(MS_WINDOWS)
  582. #define _USE_MATH_DEFINES
  583. #endif
  584. #include <math.h>
  585. #ifdef NAN
  586. #define __PYX_NAN() ((float) NAN)
  587. #else
  588. static CYTHON_INLINE float __PYX_NAN() {
  589. float value;
  590. memset(&value, 0xFF, sizeof(value));
  591. return value;
  592. }
  593. #endif
  594. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  595. #define __Pyx_truncl trunc
  596. #else
  597. #define __Pyx_truncl truncl
  598. #endif
  599. #define __PYX_MARK_ERR_POS(f_index, lineno) \
  600. { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
  601. #define __PYX_ERR(f_index, lineno, Ln_error) \
  602. { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  603. #ifndef __PYX_EXTERN_C
  604. #ifdef __cplusplus
  605. #define __PYX_EXTERN_C extern "C"
  606. #else
  607. #define __PYX_EXTERN_C extern
  608. #endif
  609. #endif
  610. #define __PYX_HAVE__ArtNetProcessor_cy_pi
  611. #define __PYX_HAVE_API__ArtNetProcessor_cy_pi
  612. /* Early includes */
  613. #include <string.h>
  614. #include <stdio.h>
  615. #include "pythread.h"
  616. #include <stdlib.h>
  617. #include "pystate.h"
  618. #ifdef _OPENMP
  619. #include <omp.h>
  620. #endif /* _OPENMP */
  621. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  622. #define CYTHON_WITHOUT_ASSERTIONS
  623. #endif
  624. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  625. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  626. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  627. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  628. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  629. #define __PYX_DEFAULT_STRING_ENCODING ""
  630. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  631. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  632. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  633. #define __Pyx_long_cast(x) ((long)x)
  634. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  635. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  636. (sizeof(type) > sizeof(Py_ssize_t) &&\
  637. likely(v < (type)PY_SSIZE_T_MAX ||\
  638. v == (type)PY_SSIZE_T_MAX) &&\
  639. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  640. v == (type)PY_SSIZE_T_MIN))) ||\
  641. (sizeof(type) == sizeof(Py_ssize_t) &&\
  642. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  643. v == (type)PY_SSIZE_T_MAX))) )
  644. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  645. return (size_t) i < (size_t) limit;
  646. }
  647. #if defined (__cplusplus) && __cplusplus >= 201103L
  648. #include <cstdlib>
  649. #define __Pyx_sst_abs(value) std::abs(value)
  650. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  651. #define __Pyx_sst_abs(value) abs(value)
  652. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  653. #define __Pyx_sst_abs(value) labs(value)
  654. #elif defined (_MSC_VER)
  655. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  656. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  657. #define __Pyx_sst_abs(value) llabs(value)
  658. #elif defined (__GNUC__)
  659. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  660. #else
  661. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  662. #endif
  663. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  664. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  665. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  666. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  667. #define __Pyx_PyBytes_FromString PyBytes_FromString
  668. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  669. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  670. #if PY_MAJOR_VERSION < 3
  671. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  672. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  673. #else
  674. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  675. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  676. #endif
  677. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  678. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  679. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  680. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  681. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  682. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  683. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  684. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  685. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  686. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  687. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  688. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  689. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  690. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  691. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  692. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  693. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  694. const Py_UNICODE *u_end = u;
  695. while (*u_end++) ;
  696. return (size_t)(u_end - u - 1);
  697. }
  698. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  699. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  700. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  701. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  702. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  703. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  704. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  705. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  706. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  707. #define __Pyx_PySequence_Tuple(obj)\
  708. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  709. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  710. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  711. #if CYTHON_ASSUME_SAFE_MACROS
  712. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  713. #else
  714. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  715. #endif
  716. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  717. #if PY_MAJOR_VERSION >= 3
  718. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  719. #else
  720. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  721. #endif
  722. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  723. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  724. static int __Pyx_sys_getdefaultencoding_not_ascii;
  725. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  726. PyObject* sys;
  727. PyObject* default_encoding = NULL;
  728. PyObject* ascii_chars_u = NULL;
  729. PyObject* ascii_chars_b = NULL;
  730. const char* default_encoding_c;
  731. sys = PyImport_ImportModule("sys");
  732. if (!sys) goto bad;
  733. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  734. Py_DECREF(sys);
  735. if (!default_encoding) goto bad;
  736. default_encoding_c = PyBytes_AsString(default_encoding);
  737. if (!default_encoding_c) goto bad;
  738. if (strcmp(default_encoding_c, "ascii") == 0) {
  739. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  740. } else {
  741. char ascii_chars[128];
  742. int c;
  743. for (c = 0; c < 128; c++) {
  744. ascii_chars[c] = c;
  745. }
  746. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  747. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  748. if (!ascii_chars_u) goto bad;
  749. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  750. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  751. PyErr_Format(
  752. PyExc_ValueError,
  753. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  754. default_encoding_c);
  755. goto bad;
  756. }
  757. Py_DECREF(ascii_chars_u);
  758. Py_DECREF(ascii_chars_b);
  759. }
  760. Py_DECREF(default_encoding);
  761. return 0;
  762. bad:
  763. Py_XDECREF(default_encoding);
  764. Py_XDECREF(ascii_chars_u);
  765. Py_XDECREF(ascii_chars_b);
  766. return -1;
  767. }
  768. #endif
  769. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  770. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  771. #else
  772. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  773. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  774. static char* __PYX_DEFAULT_STRING_ENCODING;
  775. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  776. PyObject* sys;
  777. PyObject* default_encoding = NULL;
  778. char* default_encoding_c;
  779. sys = PyImport_ImportModule("sys");
  780. if (!sys) goto bad;
  781. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  782. Py_DECREF(sys);
  783. if (!default_encoding) goto bad;
  784. default_encoding_c = PyBytes_AsString(default_encoding);
  785. if (!default_encoding_c) goto bad;
  786. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  787. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  788. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  789. Py_DECREF(default_encoding);
  790. return 0;
  791. bad:
  792. Py_XDECREF(default_encoding);
  793. return -1;
  794. }
  795. #endif
  796. #endif
  797. /* Test for GCC > 2.95 */
  798. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  799. #define likely(x) __builtin_expect(!!(x), 1)
  800. #define unlikely(x) __builtin_expect(!!(x), 0)
  801. #else /* !__GNUC__ or GCC < 2.95 */
  802. #define likely(x) (x)
  803. #define unlikely(x) (x)
  804. #endif /* __GNUC__ */
  805. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  806. static PyObject *__pyx_m = NULL;
  807. static PyObject *__pyx_d;
  808. static PyObject *__pyx_b;
  809. static PyObject *__pyx_cython_runtime = NULL;
  810. static PyObject *__pyx_empty_tuple;
  811. static PyObject *__pyx_empty_bytes;
  812. static PyObject *__pyx_empty_unicode;
  813. static int __pyx_lineno;
  814. static int __pyx_clineno = 0;
  815. static const char * __pyx_cfilenm= __FILE__;
  816. static const char *__pyx_filename;
  817. static const char *__pyx_f[] = {
  818. "ArtNetProcessor_cy_pi.pyx",
  819. "array.pxd",
  820. "stringsource",
  821. "type.pxd",
  822. "bool.pxd",
  823. "complex.pxd",
  824. };
  825. /* MemviewSliceStruct.proto */
  826. struct __pyx_memoryview_obj;
  827. typedef struct {
  828. struct __pyx_memoryview_obj *memview;
  829. char *data;
  830. Py_ssize_t shape[8];
  831. Py_ssize_t strides[8];
  832. Py_ssize_t suboffsets[8];
  833. } __Pyx_memviewslice;
  834. #define __Pyx_MemoryView_Len(m) (m.shape[0])
  835. /* Atomics.proto */
  836. #include <pythread.h>
  837. #ifndef CYTHON_ATOMICS
  838. #define CYTHON_ATOMICS 1
  839. #endif
  840. #define __pyx_atomic_int_type int
  841. #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
  842. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
  843. !defined(__i386__)
  844. #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
  845. #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
  846. #ifdef __PYX_DEBUG_ATOMICS
  847. #warning "Using GNU atomics"
  848. #endif
  849. #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
  850. #include <Windows.h>
  851. #undef __pyx_atomic_int_type
  852. #define __pyx_atomic_int_type LONG
  853. #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
  854. #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
  855. #ifdef __PYX_DEBUG_ATOMICS
  856. #pragma message ("Using MSVC atomics")
  857. #endif
  858. #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
  859. #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
  860. #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
  861. #ifdef __PYX_DEBUG_ATOMICS
  862. #warning "Using Intel atomics"
  863. #endif
  864. #else
  865. #undef CYTHON_ATOMICS
  866. #define CYTHON_ATOMICS 0
  867. #ifdef __PYX_DEBUG_ATOMICS
  868. #warning "Not using atomics"
  869. #endif
  870. #endif
  871. typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
  872. #if CYTHON_ATOMICS
  873. #define __pyx_add_acquisition_count(memview)\
  874. __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  875. #define __pyx_sub_acquisition_count(memview)\
  876. __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  877. #else
  878. #define __pyx_add_acquisition_count(memview)\
  879. __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  880. #define __pyx_sub_acquisition_count(memview)\
  881. __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  882. #endif
  883. /* ForceInitThreads.proto */
  884. #ifndef __PYX_FORCE_INIT_THREADS
  885. #define __PYX_FORCE_INIT_THREADS 0
  886. #endif
  887. /* NoFastGil.proto */
  888. #define __Pyx_PyGILState_Ensure PyGILState_Ensure
  889. #define __Pyx_PyGILState_Release PyGILState_Release
  890. #define __Pyx_FastGIL_Remember()
  891. #define __Pyx_FastGIL_Forget()
  892. #define __Pyx_FastGilFuncInit()
  893. /* BufferFormatStructs.proto */
  894. #define IS_UNSIGNED(type) (((type) -1) > 0)
  895. struct __Pyx_StructField_;
  896. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  897. typedef struct {
  898. const char* name;
  899. struct __Pyx_StructField_* fields;
  900. size_t size;
  901. size_t arraysize[8];
  902. int ndim;
  903. char typegroup;
  904. char is_unsigned;
  905. int flags;
  906. } __Pyx_TypeInfo;
  907. typedef struct __Pyx_StructField_ {
  908. __Pyx_TypeInfo* type;
  909. const char* name;
  910. size_t offset;
  911. } __Pyx_StructField;
  912. typedef struct {
  913. __Pyx_StructField* field;
  914. size_t parent_offset;
  915. } __Pyx_BufFmt_StackElem;
  916. typedef struct {
  917. __Pyx_StructField root;
  918. __Pyx_BufFmt_StackElem* head;
  919. size_t fmt_offset;
  920. size_t new_count, enc_count;
  921. size_t struct_alignment;
  922. int is_complex;
  923. char enc_type;
  924. char new_packmode;
  925. char enc_packmode;
  926. char is_valid_array;
  927. } __Pyx_BufFmt_Context;
  928. /*--- Type declarations ---*/
  929. #ifndef _ARRAYARRAY_H
  930. struct arrayobject;
  931. typedef struct arrayobject arrayobject;
  932. #endif
  933. struct __pyx_array_obj;
  934. struct __pyx_MemviewEnum_obj;
  935. struct __pyx_memoryview_obj;
  936. struct __pyx_memoryviewslice_obj;
  937. /* "View.MemoryView":105
  938. *
  939. * @cname("__pyx_array")
  940. * cdef class array: # <<<<<<<<<<<<<<
  941. *
  942. * cdef:
  943. */
  944. struct __pyx_array_obj {
  945. PyObject_HEAD
  946. struct __pyx_vtabstruct_array *__pyx_vtab;
  947. char *data;
  948. Py_ssize_t len;
  949. char *format;
  950. int ndim;
  951. Py_ssize_t *_shape;
  952. Py_ssize_t *_strides;
  953. Py_ssize_t itemsize;
  954. PyObject *mode;
  955. PyObject *_format;
  956. void (*callback_free_data)(void *);
  957. int free_data;
  958. int dtype_is_object;
  959. };
  960. /* "View.MemoryView":279
  961. *
  962. * @cname('__pyx_MemviewEnum')
  963. * cdef class Enum(object): # <<<<<<<<<<<<<<
  964. * cdef object name
  965. * def __init__(self, name):
  966. */
  967. struct __pyx_MemviewEnum_obj {
  968. PyObject_HEAD
  969. PyObject *name;
  970. };
  971. /* "View.MemoryView":330
  972. *
  973. * @cname('__pyx_memoryview')
  974. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  975. *
  976. * cdef object obj
  977. */
  978. struct __pyx_memoryview_obj {
  979. PyObject_HEAD
  980. struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  981. PyObject *obj;
  982. PyObject *_size;
  983. PyObject *_array_interface;
  984. PyThread_type_lock lock;
  985. __pyx_atomic_int acquisition_count[2];
  986. __pyx_atomic_int *acquisition_count_aligned_p;
  987. Py_buffer view;
  988. int flags;
  989. int dtype_is_object;
  990. __Pyx_TypeInfo *typeinfo;
  991. };
  992. /* "View.MemoryView":965
  993. *
  994. * @cname('__pyx_memoryviewslice')
  995. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  996. * "Internal class for passing memoryview slices to Python"
  997. *
  998. */
  999. struct __pyx_memoryviewslice_obj {
  1000. struct __pyx_memoryview_obj __pyx_base;
  1001. __Pyx_memviewslice from_slice;
  1002. PyObject *from_object;
  1003. PyObject *(*to_object_func)(char *);
  1004. int (*to_dtype_func)(char *, PyObject *);
  1005. };
  1006. /* "View.MemoryView":105
  1007. *
  1008. * @cname("__pyx_array")
  1009. * cdef class array: # <<<<<<<<<<<<<<
  1010. *
  1011. * cdef:
  1012. */
  1013. struct __pyx_vtabstruct_array {
  1014. PyObject *(*get_memview)(struct __pyx_array_obj *);
  1015. };
  1016. static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
  1017. /* "View.MemoryView":330
  1018. *
  1019. * @cname('__pyx_memoryview')
  1020. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  1021. *
  1022. * cdef object obj
  1023. */
  1024. struct __pyx_vtabstruct_memoryview {
  1025. char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  1026. PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  1027. PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1028. PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  1029. PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1030. PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  1031. PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
  1032. };
  1033. static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
  1034. /* "View.MemoryView":965
  1035. *
  1036. * @cname('__pyx_memoryviewslice')
  1037. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  1038. * "Internal class for passing memoryview slices to Python"
  1039. *
  1040. */
  1041. struct __pyx_vtabstruct__memoryviewslice {
  1042. struct __pyx_vtabstruct_memoryview __pyx_base;
  1043. };
  1044. static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
  1045. /* --- Runtime support code (head) --- */
  1046. /* Refnanny.proto */
  1047. #ifndef CYTHON_REFNANNY
  1048. #define CYTHON_REFNANNY 0
  1049. #endif
  1050. #if CYTHON_REFNANNY
  1051. typedef struct {
  1052. void (*INCREF)(void*, PyObject*, int);
  1053. void (*DECREF)(void*, PyObject*, int);
  1054. void (*GOTREF)(void*, PyObject*, int);
  1055. void (*GIVEREF)(void*, PyObject*, int);
  1056. void* (*SetupContext)(const char*, int, const char*);
  1057. void (*FinishContext)(void**);
  1058. } __Pyx_RefNannyAPIStruct;
  1059. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1060. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1061. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1062. #ifdef WITH_THREAD
  1063. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1064. if (acquire_gil) {\
  1065. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1066. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1067. PyGILState_Release(__pyx_gilstate_save);\
  1068. } else {\
  1069. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1070. }
  1071. #else
  1072. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1073. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1074. #endif
  1075. #define __Pyx_RefNannyFinishContext()\
  1076. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1077. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1078. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1079. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1080. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1081. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1082. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1083. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1084. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1085. #else
  1086. #define __Pyx_RefNannyDeclarations
  1087. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1088. #define __Pyx_RefNannyFinishContext()
  1089. #define __Pyx_INCREF(r) Py_INCREF(r)
  1090. #define __Pyx_DECREF(r) Py_DECREF(r)
  1091. #define __Pyx_GOTREF(r)
  1092. #define __Pyx_GIVEREF(r)
  1093. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1094. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1095. #define __Pyx_XGOTREF(r)
  1096. #define __Pyx_XGIVEREF(r)
  1097. #endif
  1098. #define __Pyx_XDECREF_SET(r, v) do {\
  1099. PyObject *tmp = (PyObject *) r;\
  1100. r = v; __Pyx_XDECREF(tmp);\
  1101. } while (0)
  1102. #define __Pyx_DECREF_SET(r, v) do {\
  1103. PyObject *tmp = (PyObject *) r;\
  1104. r = v; __Pyx_DECREF(tmp);\
  1105. } while (0)
  1106. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1107. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1108. /* PyObjectGetAttrStr.proto */
  1109. #if CYTHON_USE_TYPE_SLOTS
  1110. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1111. #else
  1112. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1113. #endif
  1114. /* GetBuiltinName.proto */
  1115. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1116. /* RaiseArgTupleInvalid.proto */
  1117. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1118. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1119. /* RaiseDoubleKeywords.proto */
  1120. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1121. /* ParseKeywords.proto */
  1122. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1123. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1124. const char* function_name);
  1125. /* PyObjectCall.proto */
  1126. #if CYTHON_COMPILING_IN_CPYTHON
  1127. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1128. #else
  1129. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1130. #endif
  1131. /* GetItemInt.proto */
  1132. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1133. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1134. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1135. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1136. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1137. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1138. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1139. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1140. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1141. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1142. int wraparound, int boundscheck);
  1143. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1144. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1145. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1146. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1147. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1148. int wraparound, int boundscheck);
  1149. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1150. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1151. int is_list, int wraparound, int boundscheck);
  1152. /* SetItemInt.proto */
  1153. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1154. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1155. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
  1156. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  1157. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  1158. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  1159. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  1160. int is_list, int wraparound, int boundscheck);
  1161. /* BufferIndexError.proto */
  1162. static void __Pyx_RaiseBufferIndexError(int axis);
  1163. /* MemviewSliceInit.proto */
  1164. #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
  1165. #define __Pyx_MEMVIEW_DIRECT 1
  1166. #define __Pyx_MEMVIEW_PTR 2
  1167. #define __Pyx_MEMVIEW_FULL 4
  1168. #define __Pyx_MEMVIEW_CONTIG 8
  1169. #define __Pyx_MEMVIEW_STRIDED 16
  1170. #define __Pyx_MEMVIEW_FOLLOW 32
  1171. #define __Pyx_IS_C_CONTIG 1
  1172. #define __Pyx_IS_F_CONTIG 2
  1173. static int __Pyx_init_memviewslice(
  1174. struct __pyx_memoryview_obj *memview,
  1175. int ndim,
  1176. __Pyx_memviewslice *memviewslice,
  1177. int memview_is_new_reference);
  1178. static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
  1179. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1180. static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
  1181. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1182. #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
  1183. #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
  1184. #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
  1185. #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
  1186. static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1187. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1188. /* ArgTypeTest.proto */
  1189. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1190. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1191. __Pyx__ArgTypeTest(obj, type, name, exact))
  1192. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1193. /* PyThreadStateGet.proto */
  1194. #if CYTHON_FAST_THREAD_STATE
  1195. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1196. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1197. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1198. #else
  1199. #define __Pyx_PyThreadState_declare
  1200. #define __Pyx_PyThreadState_assign
  1201. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1202. #endif
  1203. /* PyErrFetchRestore.proto */
  1204. #if CYTHON_FAST_THREAD_STATE
  1205. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1206. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1207. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1208. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1209. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1210. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1211. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1212. #if CYTHON_COMPILING_IN_CPYTHON
  1213. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1214. #else
  1215. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1216. #endif
  1217. #else
  1218. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1219. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1220. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1221. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1222. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1223. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1224. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1225. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1226. #endif
  1227. /* RaiseException.proto */
  1228. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1229. /* PyCFunctionFastCall.proto */
  1230. #if CYTHON_FAST_PYCCALL
  1231. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1232. #else
  1233. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1234. #endif
  1235. /* PyFunctionFastCall.proto */
  1236. #if CYTHON_FAST_PYCALL
  1237. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1238. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1239. #if 1 || PY_VERSION_HEX < 0x030600B1
  1240. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
  1241. #else
  1242. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1243. #endif
  1244. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1245. (sizeof(char [1 - 2*!(cond)]) - 1)
  1246. #ifndef Py_MEMBER_SIZE
  1247. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1248. #endif
  1249. static size_t __pyx_pyframe_localsplus_offset = 0;
  1250. #include "frameobject.h"
  1251. #define __Pxy_PyFrame_Initialize_Offsets()\
  1252. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1253. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1254. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1255. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1256. #endif
  1257. /* PyObjectCall2Args.proto */
  1258. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  1259. /* PyObjectCallMethO.proto */
  1260. #if CYTHON_COMPILING_IN_CPYTHON
  1261. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1262. #endif
  1263. /* PyObjectCallOneArg.proto */
  1264. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1265. /* IncludeStringH.proto */
  1266. #include <string.h>
  1267. /* BytesEquals.proto */
  1268. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1269. /* UnicodeEquals.proto */
  1270. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1271. /* StrEquals.proto */
  1272. #if PY_MAJOR_VERSION >= 3
  1273. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  1274. #else
  1275. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  1276. #endif
  1277. /* None.proto */
  1278. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
  1279. /* UnaryNegOverflows.proto */
  1280. #define UNARY_NEG_WOULD_OVERFLOW(x)\
  1281. (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
  1282. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1283. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
  1284. /* GetAttr.proto */
  1285. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
  1286. /* ObjectGetItem.proto */
  1287. #if CYTHON_USE_TYPE_SLOTS
  1288. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
  1289. #else
  1290. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  1291. #endif
  1292. /* decode_c_string_utf16.proto */
  1293. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
  1294. int byteorder = 0;
  1295. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1296. }
  1297. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
  1298. int byteorder = -1;
  1299. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1300. }
  1301. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
  1302. int byteorder = 1;
  1303. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1304. }
  1305. /* decode_c_string.proto */
  1306. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  1307. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  1308. const char* encoding, const char* errors,
  1309. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
  1310. /* PyErrExceptionMatches.proto */
  1311. #if CYTHON_FAST_THREAD_STATE
  1312. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1313. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1314. #else
  1315. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1316. #endif
  1317. /* GetAttr3.proto */
  1318. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
  1319. /* PyDictVersioning.proto */
  1320. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1321. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1322. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1323. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1324. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1325. (cache_var) = (value);
  1326. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1327. static PY_UINT64_T __pyx_dict_version = 0;\
  1328. static PyObject *__pyx_dict_cached_value = NULL;\
  1329. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1330. (VAR) = __pyx_dict_cached_value;\
  1331. } else {\
  1332. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1333. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1334. }\
  1335. }
  1336. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1337. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1338. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1339. #else
  1340. #define __PYX_GET_DICT_VERSION(dict) (0)
  1341. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1342. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1343. #endif
  1344. /* GetModuleGlobalName.proto */
  1345. #if CYTHON_USE_DICT_VERSIONS
  1346. #define __Pyx_GetModuleGlobalName(var, name) {\
  1347. static PY_UINT64_T __pyx_dict_version = 0;\
  1348. static PyObject *__pyx_dict_cached_value = NULL;\
  1349. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1350. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1351. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1352. }
  1353. #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
  1354. PY_UINT64_T __pyx_dict_version;\
  1355. PyObject *__pyx_dict_cached_value;\
  1356. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1357. }
  1358. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1359. #else
  1360. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1361. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1362. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1363. #endif
  1364. /* RaiseTooManyValuesToUnpack.proto */
  1365. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1366. /* RaiseNeedMoreValuesToUnpack.proto */
  1367. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1368. /* RaiseNoneIterError.proto */
  1369. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  1370. /* ExtTypeTest.proto */
  1371. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1372. /* GetTopmostException.proto */
  1373. #if CYTHON_USE_EXC_INFO_STACK
  1374. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1375. #endif
  1376. /* SaveResetException.proto */
  1377. #if CYTHON_FAST_THREAD_STATE
  1378. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1379. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1380. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1381. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1382. #else
  1383. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1384. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1385. #endif
  1386. /* GetException.proto */
  1387. #if CYTHON_FAST_THREAD_STATE
  1388. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1389. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1390. #else
  1391. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1392. #endif
  1393. /* SwapException.proto */
  1394. #if CYTHON_FAST_THREAD_STATE
  1395. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  1396. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1397. #else
  1398. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  1399. #endif
  1400. /* Import.proto */
  1401. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1402. /* FastTypeChecks.proto */
  1403. #if CYTHON_COMPILING_IN_CPYTHON
  1404. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1405. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1406. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1407. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1408. #else
  1409. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1410. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1411. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1412. #endif
  1413. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1414. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1415. /* ListCompAppend.proto */
  1416. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1417. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1418. PyListObject* L = (PyListObject*) list;
  1419. Py_ssize_t len = Py_SIZE(list);
  1420. if (likely(L->allocated > len)) {
  1421. Py_INCREF(x);
  1422. PyList_SET_ITEM(list, len, x);
  1423. __Pyx_SET_SIZE(list, len + 1);
  1424. return 0;
  1425. }
  1426. return PyList_Append(list, x);
  1427. }
  1428. #else
  1429. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  1430. #endif
  1431. /* PyIntBinop.proto */
  1432. #if !CYTHON_COMPILING_IN_PYPY
  1433. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1434. #else
  1435. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1436. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1437. #endif
  1438. /* ListExtend.proto */
  1439. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1440. #if CYTHON_COMPILING_IN_CPYTHON
  1441. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1442. if (unlikely(!none))
  1443. return -1;
  1444. Py_DECREF(none);
  1445. return 0;
  1446. #else
  1447. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1448. #endif
  1449. }
  1450. /* ListAppend.proto */
  1451. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1452. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1453. PyListObject* L = (PyListObject*) list;
  1454. Py_ssize_t len = Py_SIZE(list);
  1455. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1456. Py_INCREF(x);
  1457. PyList_SET_ITEM(list, len, x);
  1458. __Pyx_SET_SIZE(list, len + 1);
  1459. return 0;
  1460. }
  1461. return PyList_Append(list, x);
  1462. }
  1463. #else
  1464. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1465. #endif
  1466. /* None.proto */
  1467. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1468. /* None.proto */
  1469. static CYTHON_INLINE long __Pyx_div_long(long, long);
  1470. /* ImportFrom.proto */
  1471. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  1472. /* HasAttr.proto */
  1473. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  1474. /* PyObject_GenericGetAttrNoDict.proto */
  1475. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1476. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  1477. #else
  1478. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  1479. #endif
  1480. /* PyObject_GenericGetAttr.proto */
  1481. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1482. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
  1483. #else
  1484. #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
  1485. #endif
  1486. /* SetVTable.proto */
  1487. static int __Pyx_SetVtable(PyObject *dict, void *vtable);
  1488. /* PyObjectGetAttrStrNoError.proto */
  1489. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1490. /* SetupReduce.proto */
  1491. static int __Pyx_setup_reduce(PyObject* type_obj);
  1492. /* TypeImport.proto */
  1493. #ifndef __PYX_HAVE_RT_ImportType_proto
  1494. #define __PYX_HAVE_RT_ImportType_proto
  1495. enum __Pyx_ImportType_CheckSize {
  1496. __Pyx_ImportType_CheckSize_Error = 0,
  1497. __Pyx_ImportType_CheckSize_Warn = 1,
  1498. __Pyx_ImportType_CheckSize_Ignore = 2
  1499. };
  1500. static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
  1501. #endif
  1502. /* CLineInTraceback.proto */
  1503. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1504. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1505. #else
  1506. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1507. #endif
  1508. /* CodeObjectCache.proto */
  1509. typedef struct {
  1510. PyCodeObject* code_object;
  1511. int code_line;
  1512. } __Pyx_CodeObjectCacheEntry;
  1513. struct __Pyx_CodeObjectCache {
  1514. int count;
  1515. int max_count;
  1516. __Pyx_CodeObjectCacheEntry* entries;
  1517. };
  1518. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1519. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1520. static PyCodeObject *__pyx_find_code_object(int code_line);
  1521. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1522. /* AddTraceback.proto */
  1523. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1524. int py_line, const char *filename);
  1525. /* ArrayAPI.proto */
  1526. #ifndef _ARRAYARRAY_H
  1527. #define _ARRAYARRAY_H
  1528. typedef struct arraydescr {
  1529. int typecode;
  1530. int itemsize;
  1531. PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
  1532. int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
  1533. #if PY_MAJOR_VERSION >= 3
  1534. char *formats;
  1535. #endif
  1536. } arraydescr;
  1537. struct arrayobject {
  1538. PyObject_HEAD
  1539. Py_ssize_t ob_size;
  1540. union {
  1541. char *ob_item;
  1542. float *as_floats;
  1543. double *as_doubles;
  1544. int *as_ints;
  1545. unsigned int *as_uints;
  1546. unsigned char *as_uchars;
  1547. signed char *as_schars;
  1548. char *as_chars;
  1549. unsigned long *as_ulongs;
  1550. long *as_longs;
  1551. #if PY_MAJOR_VERSION >= 3
  1552. unsigned long long *as_ulonglongs;
  1553. long long *as_longlongs;
  1554. #endif
  1555. short *as_shorts;
  1556. unsigned short *as_ushorts;
  1557. Py_UNICODE *as_pyunicodes;
  1558. void *as_voidptr;
  1559. } data;
  1560. Py_ssize_t allocated;
  1561. struct arraydescr *ob_descr;
  1562. PyObject *weakreflist;
  1563. #if PY_MAJOR_VERSION >= 3
  1564. int ob_exports;
  1565. #endif
  1566. };
  1567. #ifndef NO_NEWARRAY_INLINE
  1568. static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
  1569. struct arraydescr *descr) {
  1570. arrayobject *op;
  1571. size_t nbytes;
  1572. if (size < 0) {
  1573. PyErr_BadInternalCall();
  1574. return NULL;
  1575. }
  1576. nbytes = size * descr->itemsize;
  1577. if (nbytes / descr->itemsize != (size_t)size) {
  1578. return PyErr_NoMemory();
  1579. }
  1580. op = (arrayobject *) type->tp_alloc(type, 0);
  1581. if (op == NULL) {
  1582. return NULL;
  1583. }
  1584. op->ob_descr = descr;
  1585. op->allocated = size;
  1586. op->weakreflist = NULL;
  1587. op->ob_size = size;
  1588. if (size <= 0) {
  1589. op->data.ob_item = NULL;
  1590. }
  1591. else {
  1592. op->data.ob_item = PyMem_NEW(char, nbytes);
  1593. if (op->data.ob_item == NULL) {
  1594. Py_DECREF(op);
  1595. return PyErr_NoMemory();
  1596. }
  1597. }
  1598. return (PyObject *) op;
  1599. }
  1600. #else
  1601. PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
  1602. struct arraydescr *descr);
  1603. #endif
  1604. static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
  1605. void *items = (void*) self->data.ob_item;
  1606. PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
  1607. if (items == NULL) {
  1608. PyErr_NoMemory();
  1609. return -1;
  1610. }
  1611. self->data.ob_item = (char*) items;
  1612. self->ob_size = n;
  1613. self->allocated = n;
  1614. return 0;
  1615. }
  1616. static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
  1617. void *items = (void*) self->data.ob_item;
  1618. Py_ssize_t newsize;
  1619. if (n < self->allocated && n*4 > self->allocated) {
  1620. self->ob_size = n;
  1621. return 0;
  1622. }
  1623. newsize = n + (n / 2) + 1;
  1624. if (newsize <= n) {
  1625. PyErr_NoMemory();
  1626. return -1;
  1627. }
  1628. PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
  1629. if (items == NULL) {
  1630. PyErr_NoMemory();
  1631. return -1;
  1632. }
  1633. self->data.ob_item = (char*) items;
  1634. self->ob_size = n;
  1635. self->allocated = newsize;
  1636. return 0;
  1637. }
  1638. #endif
  1639. #if PY_MAJOR_VERSION < 3
  1640. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  1641. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  1642. #else
  1643. #define __Pyx_GetBuffer PyObject_GetBuffer
  1644. #define __Pyx_ReleaseBuffer PyBuffer_Release
  1645. #endif
  1646. /* BufferStructDeclare.proto */
  1647. typedef struct {
  1648. Py_ssize_t shape, strides, suboffsets;
  1649. } __Pyx_Buf_DimInfo;
  1650. typedef struct {
  1651. size_t refcount;
  1652. Py_buffer pybuffer;
  1653. } __Pyx_Buffer;
  1654. typedef struct {
  1655. __Pyx_Buffer *rcbuffer;
  1656. char *data;
  1657. __Pyx_Buf_DimInfo diminfo[8];
  1658. } __Pyx_LocalBuf_ND;
  1659. /* MemviewSliceIsContig.proto */
  1660. static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
  1661. /* OverlappingSlices.proto */
  1662. static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  1663. __Pyx_memviewslice *slice2,
  1664. int ndim, size_t itemsize);
  1665. /* Capsule.proto */
  1666. static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
  1667. /* CIntToPy.proto */
  1668. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1669. /* MemviewDtypeToObject.proto */
  1670. static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
  1671. static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);
  1672. /* MemviewSliceCopyTemplate.proto */
  1673. static __Pyx_memviewslice
  1674. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  1675. const char *mode, int ndim,
  1676. size_t sizeof_dtype, int contig_flag,
  1677. int dtype_is_object);
  1678. /* CIntFromPy.proto */
  1679. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1680. /* CIntFromPy.proto */
  1681. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1682. /* CIntToPy.proto */
  1683. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1684. /* CIntFromPy.proto */
  1685. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
  1686. /* IsLittleEndian.proto */
  1687. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
  1688. /* BufferFormatCheck.proto */
  1689. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
  1690. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  1691. __Pyx_BufFmt_StackElem* stack,
  1692. __Pyx_TypeInfo* type);
  1693. /* TypeInfoCompare.proto */
  1694. static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
  1695. /* MemviewSliceValidateAndInit.proto */
  1696. static int __Pyx_ValidateAndInit_memviewslice(
  1697. int *axes_specs,
  1698. int c_or_f_flag,
  1699. int buf_flags,
  1700. int ndim,
  1701. __Pyx_TypeInfo *dtype,
  1702. __Pyx_BufFmt_StackElem stack[],
  1703. __Pyx_memviewslice *memviewslice,
  1704. PyObject *original_obj);
  1705. /* ObjectToMemviewSlice.proto */
  1706. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag);
  1707. /* CheckBinaryVersion.proto */
  1708. static int __Pyx_check_binary_version(void);
  1709. /* InitStrings.proto */
  1710. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1711. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
  1712. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
  1713. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
  1714. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
  1715. static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
  1716. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
  1717. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  1718. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  1719. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  1720. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  1721. /* Module declarations from 'cpython.version' */
  1722. /* Module declarations from '__builtin__' */
  1723. /* Module declarations from 'cpython.type' */
  1724. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1725. /* Module declarations from 'libc.string' */
  1726. /* Module declarations from 'libc.stdio' */
  1727. /* Module declarations from 'cpython.object' */
  1728. /* Module declarations from 'cpython.ref' */
  1729. /* Module declarations from 'cpython.exc' */
  1730. /* Module declarations from 'cpython.module' */
  1731. /* Module declarations from 'cpython.mem' */
  1732. /* Module declarations from 'cpython.tuple' */
  1733. /* Module declarations from 'cpython.list' */
  1734. /* Module declarations from 'cpython.sequence' */
  1735. /* Module declarations from 'cpython.mapping' */
  1736. /* Module declarations from 'cpython.iterator' */
  1737. /* Module declarations from 'cpython.number' */
  1738. /* Module declarations from 'cpython.int' */
  1739. /* Module declarations from '__builtin__' */
  1740. /* Module declarations from 'cpython.bool' */
  1741. static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
  1742. /* Module declarations from 'cpython.long' */
  1743. /* Module declarations from 'cpython.float' */
  1744. /* Module declarations from '__builtin__' */
  1745. /* Module declarations from 'cpython.complex' */
  1746. static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
  1747. /* Module declarations from 'cpython.string' */
  1748. /* Module declarations from 'cpython.unicode' */
  1749. /* Module declarations from 'cpython.dict' */
  1750. /* Module declarations from 'cpython.instance' */
  1751. /* Module declarations from 'cpython.function' */
  1752. /* Module declarations from 'cpython.method' */
  1753. /* Module declarations from 'cpython.weakref' */
  1754. /* Module declarations from 'cpython.getargs' */
  1755. /* Module declarations from 'cpython.pythread' */
  1756. /* Module declarations from 'cpython.pystate' */
  1757. /* Module declarations from 'cpython.cobject' */
  1758. /* Module declarations from 'cpython.oldbuffer' */
  1759. /* Module declarations from 'cpython.set' */
  1760. /* Module declarations from 'cpython.buffer' */
  1761. /* Module declarations from 'cpython.bytes' */
  1762. /* Module declarations from 'cpython.pycapsule' */
  1763. /* Module declarations from 'cpython' */
  1764. /* Module declarations from 'array' */
  1765. /* Module declarations from 'cpython.array' */
  1766. static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0;
  1767. static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
  1768. /* Module declarations from 'ArtNetProcessor_cy_pi' */
  1769. static PyTypeObject *__pyx_array_type = 0;
  1770. static PyTypeObject *__pyx_MemviewEnum_type = 0;
  1771. static PyTypeObject *__pyx_memoryview_type = 0;
  1772. static PyTypeObject *__pyx_memoryviewslice_type = 0;
  1773. static PyObject *generic = 0;
  1774. static PyObject *strided = 0;
  1775. static PyObject *indirect = 0;
  1776. static PyObject *contiguous = 0;
  1777. static PyObject *indirect_contiguous = 0;
  1778. static int __pyx_memoryview_thread_locks_used;
  1779. static PyThread_type_lock __pyx_memoryview_thread_locks[8];
  1780. static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
  1781. static void *__pyx_align_pointer(void *, size_t); /*proto*/
  1782. static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
  1783. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
  1784. static PyObject *_unellipsify(PyObject *, int); /*proto*/
  1785. static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
  1786. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
  1787. static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
  1788. static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
  1789. static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
  1790. static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
  1791. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1792. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1793. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
  1794. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1795. static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
  1796. static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
  1797. static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
  1798. static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
  1799. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
  1800. static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
  1801. static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
  1802. static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
  1803. static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
  1804. static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
  1805. static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
  1806. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
  1807. static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
  1808. static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  1809. static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  1810. static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
  1811. static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
  1812. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
  1813. static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
  1814. #define __Pyx_MODULE_NAME "ArtNetProcessor_cy_pi"
  1815. extern int __pyx_module_is_main_ArtNetProcessor_cy_pi;
  1816. int __pyx_module_is_main_ArtNetProcessor_cy_pi = 0;
  1817. /* Implementation of 'ArtNetProcessor_cy_pi' */
  1818. static PyObject *__pyx_builtin_enumerate;
  1819. static PyObject *__pyx_builtin_MemoryError;
  1820. static PyObject *__pyx_builtin_ValueError;
  1821. static PyObject *__pyx_builtin_range;
  1822. static PyObject *__pyx_builtin_TypeError;
  1823. static PyObject *__pyx_builtin_Ellipsis;
  1824. static PyObject *__pyx_builtin_id;
  1825. static PyObject *__pyx_builtin_IndexError;
  1826. static const char __pyx_k_O[] = "O";
  1827. static const char __pyx_k_a[] = "a";
  1828. static const char __pyx_k_c[] = "c";
  1829. static const char __pyx_k_i[] = "i";
  1830. static const char __pyx_k_v[] = "v";
  1831. static const char __pyx_k_id[] = "id";
  1832. static const char __pyx_k_dmx[] = "dmx";
  1833. static const char __pyx_k_new[] = "__new__";
  1834. static const char __pyx_k_obj[] = "obj";
  1835. static const char __pyx_k_base[] = "base";
  1836. static const char __pyx_k_dict[] = "__dict__";
  1837. static const char __pyx_k_main[] = "__main__";
  1838. static const char __pyx_k_mode[] = "mode";
  1839. static const char __pyx_k_name[] = "name";
  1840. static const char __pyx_k_ndim[] = "ndim";
  1841. static const char __pyx_k_pack[] = "pack";
  1842. static const char __pyx_k_size[] = "size";
  1843. static const char __pyx_k_step[] = "step";
  1844. static const char __pyx_k_stop[] = "stop";
  1845. static const char __pyx_k_test[] = "__test__";
  1846. static const char __pyx_k_ASCII[] = "ASCII";
  1847. static const char __pyx_k_array[] = "array";
  1848. static const char __pyx_k_class[] = "__class__";
  1849. static const char __pyx_k_error[] = "error";
  1850. static const char __pyx_k_flags[] = "flags";
  1851. static const char __pyx_k_merge[] = "merge";
  1852. static const char __pyx_k_range[] = "range";
  1853. static const char __pyx_k_shape[] = "shape";
  1854. static const char __pyx_k_start[] = "start";
  1855. static const char __pyx_k_dmxnew[] = "dmxnew";
  1856. static const char __pyx_k_dmxold[] = "dmxold";
  1857. static const char __pyx_k_encode[] = "encode";
  1858. static const char __pyx_k_format[] = "format";
  1859. static const char __pyx_k_import[] = "__import__";
  1860. static const char __pyx_k_matrix[] = "matrix";
  1861. static const char __pyx_k_name_2[] = "__name__";
  1862. static const char __pyx_k_pickle[] = "pickle";
  1863. static const char __pyx_k_reduce[] = "__reduce__";
  1864. static const char __pyx_k_struct[] = "struct";
  1865. static const char __pyx_k_unpack[] = "unpack";
  1866. static const char __pyx_k_update[] = "update";
  1867. static const char __pyx_k_fortran[] = "fortran";
  1868. static const char __pyx_k_memview[] = "memview";
  1869. static const char __pyx_k_Ellipsis[] = "Ellipsis";
  1870. static const char __pyx_k_getstate[] = "__getstate__";
  1871. static const char __pyx_k_itemsize[] = "itemsize";
  1872. static const char __pyx_k_pyx_type[] = "__pyx_type";
  1873. static const char __pyx_k_setstate[] = "__setstate__";
  1874. static const char __pyx_k_TypeError[] = "TypeError";
  1875. static const char __pyx_k_enumerate[] = "enumerate";
  1876. static const char __pyx_k_hostindex[] = "hostindex";
  1877. static const char __pyx_k_pyx_state[] = "__pyx_state";
  1878. static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
  1879. static const char __pyx_k_IndexError[] = "IndexError";
  1880. static const char __pyx_k_ValueError[] = "ValueError";
  1881. static const char __pyx_k_pyx_result[] = "__pyx_result";
  1882. static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
  1883. static const char __pyx_k_MemoryError[] = "MemoryError";
  1884. static const char __pyx_k_PickleError[] = "PickleError";
  1885. static const char __pyx_k_update_flag[] = "update_flag";
  1886. static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
  1887. static const char __pyx_k_stringsource[] = "stringsource";
  1888. static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
  1889. static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
  1890. static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
  1891. static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
  1892. static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
  1893. static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
  1894. static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
  1895. static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
  1896. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  1897. static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
  1898. static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
  1899. static const char __pyx_k_ArtNetProcessor_cy_pi[] = "ArtNetProcessor_cy_pi";
  1900. static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
  1901. static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
  1902. static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
  1903. static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
  1904. static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
  1905. static const char __pyx_k_ArtNetProcessor_cy_pi_pyx[] = "ArtNetProcessor_cy_pi.pyx";
  1906. static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
  1907. static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
  1908. static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
  1909. static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
  1910. static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
  1911. static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
  1912. static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
  1913. static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
  1914. static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
  1915. static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
  1916. static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
  1917. static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
  1918. static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
  1919. static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
  1920. static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
  1921. static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
  1922. static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
  1923. static PyObject *__pyx_n_s_ASCII;
  1924. static PyObject *__pyx_n_s_ArtNetProcessor_cy_pi;
  1925. static PyObject *__pyx_kp_s_ArtNetProcessor_cy_pi_pyx;
  1926. static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
  1927. static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
  1928. static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
  1929. static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
  1930. static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
  1931. static PyObject *__pyx_n_s_Ellipsis;
  1932. static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
  1933. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
  1934. static PyObject *__pyx_n_s_IndexError;
  1935. static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
  1936. static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
  1937. static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
  1938. static PyObject *__pyx_n_s_MemoryError;
  1939. static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
  1940. static PyObject *__pyx_kp_s_MemoryView_of_r_object;
  1941. static PyObject *__pyx_n_b_O;
  1942. static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
  1943. static PyObject *__pyx_n_s_PickleError;
  1944. static PyObject *__pyx_n_s_TypeError;
  1945. static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
  1946. static PyObject *__pyx_n_s_ValueError;
  1947. static PyObject *__pyx_n_s_View_MemoryView;
  1948. static PyObject *__pyx_n_s_a;
  1949. static PyObject *__pyx_n_s_allocate_buffer;
  1950. static PyObject *__pyx_n_s_array;
  1951. static PyObject *__pyx_n_s_base;
  1952. static PyObject *__pyx_n_s_c;
  1953. static PyObject *__pyx_n_u_c;
  1954. static PyObject *__pyx_n_s_class;
  1955. static PyObject *__pyx_n_s_cline_in_traceback;
  1956. static PyObject *__pyx_kp_s_contiguous_and_direct;
  1957. static PyObject *__pyx_kp_s_contiguous_and_indirect;
  1958. static PyObject *__pyx_n_s_dict;
  1959. static PyObject *__pyx_n_s_dmx;
  1960. static PyObject *__pyx_n_s_dmxnew;
  1961. static PyObject *__pyx_n_s_dmxold;
  1962. static PyObject *__pyx_n_s_dtype_is_object;
  1963. static PyObject *__pyx_n_s_encode;
  1964. static PyObject *__pyx_n_s_enumerate;
  1965. static PyObject *__pyx_n_s_error;
  1966. static PyObject *__pyx_n_s_flags;
  1967. static PyObject *__pyx_n_s_format;
  1968. static PyObject *__pyx_n_s_fortran;
  1969. static PyObject *__pyx_n_u_fortran;
  1970. static PyObject *__pyx_n_s_getstate;
  1971. static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
  1972. static PyObject *__pyx_n_s_hostindex;
  1973. static PyObject *__pyx_n_s_i;
  1974. static PyObject *__pyx_n_s_id;
  1975. static PyObject *__pyx_n_s_import;
  1976. static PyObject *__pyx_n_s_itemsize;
  1977. static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
  1978. static PyObject *__pyx_n_s_main;
  1979. static PyObject *__pyx_n_s_matrix;
  1980. static PyObject *__pyx_n_s_memview;
  1981. static PyObject *__pyx_n_s_merge;
  1982. static PyObject *__pyx_n_s_mode;
  1983. static PyObject *__pyx_n_s_name;
  1984. static PyObject *__pyx_n_s_name_2;
  1985. static PyObject *__pyx_n_s_ndim;
  1986. static PyObject *__pyx_n_s_new;
  1987. static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
  1988. static PyObject *__pyx_n_s_obj;
  1989. static PyObject *__pyx_n_s_pack;
  1990. static PyObject *__pyx_n_s_pickle;
  1991. static PyObject *__pyx_n_s_pyx_PickleError;
  1992. static PyObject *__pyx_n_s_pyx_checksum;
  1993. static PyObject *__pyx_n_s_pyx_getbuffer;
  1994. static PyObject *__pyx_n_s_pyx_result;
  1995. static PyObject *__pyx_n_s_pyx_state;
  1996. static PyObject *__pyx_n_s_pyx_type;
  1997. static PyObject *__pyx_n_s_pyx_unpickle_Enum;
  1998. static PyObject *__pyx_n_s_pyx_vtable;
  1999. static PyObject *__pyx_n_s_range;
  2000. static PyObject *__pyx_n_s_reduce;
  2001. static PyObject *__pyx_n_s_reduce_cython;
  2002. static PyObject *__pyx_n_s_reduce_ex;
  2003. static PyObject *__pyx_n_s_setstate;
  2004. static PyObject *__pyx_n_s_setstate_cython;
  2005. static PyObject *__pyx_n_s_shape;
  2006. static PyObject *__pyx_n_s_size;
  2007. static PyObject *__pyx_n_s_start;
  2008. static PyObject *__pyx_n_s_step;
  2009. static PyObject *__pyx_n_s_stop;
  2010. static PyObject *__pyx_kp_s_strided_and_direct;
  2011. static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
  2012. static PyObject *__pyx_kp_s_strided_and_indirect;
  2013. static PyObject *__pyx_kp_s_stringsource;
  2014. static PyObject *__pyx_n_s_struct;
  2015. static PyObject *__pyx_n_s_test;
  2016. static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
  2017. static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
  2018. static PyObject *__pyx_n_s_unpack;
  2019. static PyObject *__pyx_n_s_update;
  2020. static PyObject *__pyx_n_s_update_flag;
  2021. static PyObject *__pyx_n_s_v;
  2022. static PyObject *__pyx_pf_21ArtNetProcessor_cy_pi_merge(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dmxold, PyObject *__pyx_v_dmxnew, PyObject *__pyx_v_matrix, PyObject *__pyx_v_hostindex); /* proto */
  2023. static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
  2024. static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  2025. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
  2026. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  2027. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2028. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2029. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2030. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
  2031. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2032. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
  2033. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
  2034. static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  2035. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
  2036. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  2037. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  2038. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  2039. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
  2040. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2041. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
  2042. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
  2043. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  2044. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2045. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2046. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2047. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2048. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2049. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2050. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2051. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2052. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2053. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2054. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2055. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2056. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2057. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2058. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2059. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2060. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2061. static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  2062. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2063. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2064. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2065. static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  2066. static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
  2067. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2068. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2069. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2070. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2071. static PyObject *__pyx_int_0;
  2072. static PyObject *__pyx_int_1;
  2073. static PyObject *__pyx_int_184977713;
  2074. static PyObject *__pyx_int_neg_1;
  2075. static PyObject *__pyx_tuple_;
  2076. static PyObject *__pyx_tuple__2;
  2077. static PyObject *__pyx_tuple__3;
  2078. static PyObject *__pyx_tuple__4;
  2079. static PyObject *__pyx_tuple__5;
  2080. static PyObject *__pyx_tuple__6;
  2081. static PyObject *__pyx_tuple__7;
  2082. static PyObject *__pyx_tuple__8;
  2083. static PyObject *__pyx_tuple__9;
  2084. static PyObject *__pyx_slice__15;
  2085. static PyObject *__pyx_tuple__10;
  2086. static PyObject *__pyx_tuple__11;
  2087. static PyObject *__pyx_tuple__12;
  2088. static PyObject *__pyx_tuple__13;
  2089. static PyObject *__pyx_tuple__14;
  2090. static PyObject *__pyx_tuple__16;
  2091. static PyObject *__pyx_tuple__17;
  2092. static PyObject *__pyx_tuple__18;
  2093. static PyObject *__pyx_tuple__19;
  2094. static PyObject *__pyx_tuple__21;
  2095. static PyObject *__pyx_tuple__22;
  2096. static PyObject *__pyx_tuple__23;
  2097. static PyObject *__pyx_tuple__24;
  2098. static PyObject *__pyx_tuple__25;
  2099. static PyObject *__pyx_tuple__26;
  2100. static PyObject *__pyx_codeobj__20;
  2101. static PyObject *__pyx_codeobj__27;
  2102. /* Late includes */
  2103. /* "ArtNetProcessor_cy_pi.pyx":4
  2104. * import array
  2105. *
  2106. * def merge( dmxold, dmxnew , matrix, hostindex): # <<<<<<<<<<<<<<
  2107. * cdef int i = 0
  2108. * cdef int v = 0
  2109. */
  2110. /* Python wrapper */
  2111. static PyObject *__pyx_pw_21ArtNetProcessor_cy_pi_1merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2112. static PyMethodDef __pyx_mdef_21ArtNetProcessor_cy_pi_1merge = {"merge", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_21ArtNetProcessor_cy_pi_1merge, METH_VARARGS|METH_KEYWORDS, 0};
  2113. static PyObject *__pyx_pw_21ArtNetProcessor_cy_pi_1merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2114. PyObject *__pyx_v_dmxold = 0;
  2115. PyObject *__pyx_v_dmxnew = 0;
  2116. PyObject *__pyx_v_matrix = 0;
  2117. PyObject *__pyx_v_hostindex = 0;
  2118. int __pyx_lineno = 0;
  2119. const char *__pyx_filename = NULL;
  2120. int __pyx_clineno = 0;
  2121. PyObject *__pyx_r = 0;
  2122. __Pyx_RefNannyDeclarations
  2123. __Pyx_RefNannySetupContext("merge (wrapper)", 0);
  2124. {
  2125. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmxold,&__pyx_n_s_dmxnew,&__pyx_n_s_matrix,&__pyx_n_s_hostindex,0};
  2126. PyObject* values[4] = {0,0,0,0};
  2127. if (unlikely(__pyx_kwds)) {
  2128. Py_ssize_t kw_args;
  2129. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2130. switch (pos_args) {
  2131. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2132. CYTHON_FALLTHROUGH;
  2133. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2134. CYTHON_FALLTHROUGH;
  2135. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2136. CYTHON_FALLTHROUGH;
  2137. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2138. CYTHON_FALLTHROUGH;
  2139. case 0: break;
  2140. default: goto __pyx_L5_argtuple_error;
  2141. }
  2142. kw_args = PyDict_Size(__pyx_kwds);
  2143. switch (pos_args) {
  2144. case 0:
  2145. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmxold)) != 0)) kw_args--;
  2146. else goto __pyx_L5_argtuple_error;
  2147. CYTHON_FALLTHROUGH;
  2148. case 1:
  2149. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmxnew)) != 0)) kw_args--;
  2150. else {
  2151. __Pyx_RaiseArgtupleInvalid("merge", 1, 4, 4, 1); __PYX_ERR(0, 4, __pyx_L3_error)
  2152. }
  2153. CYTHON_FALLTHROUGH;
  2154. case 2:
  2155. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_matrix)) != 0)) kw_args--;
  2156. else {
  2157. __Pyx_RaiseArgtupleInvalid("merge", 1, 4, 4, 2); __PYX_ERR(0, 4, __pyx_L3_error)
  2158. }
  2159. CYTHON_FALLTHROUGH;
  2160. case 3:
  2161. if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostindex)) != 0)) kw_args--;
  2162. else {
  2163. __Pyx_RaiseArgtupleInvalid("merge", 1, 4, 4, 3); __PYX_ERR(0, 4, __pyx_L3_error)
  2164. }
  2165. }
  2166. if (unlikely(kw_args > 0)) {
  2167. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge") < 0)) __PYX_ERR(0, 4, __pyx_L3_error)
  2168. }
  2169. } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
  2170. goto __pyx_L5_argtuple_error;
  2171. } else {
  2172. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2173. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2174. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2175. values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2176. }
  2177. __pyx_v_dmxold = values[0];
  2178. __pyx_v_dmxnew = values[1];
  2179. __pyx_v_matrix = values[2];
  2180. __pyx_v_hostindex = values[3];
  2181. }
  2182. goto __pyx_L4_argument_unpacking_done;
  2183. __pyx_L5_argtuple_error:;
  2184. __Pyx_RaiseArgtupleInvalid("merge", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4, __pyx_L3_error)
  2185. __pyx_L3_error:;
  2186. __Pyx_AddTraceback("ArtNetProcessor_cy_pi.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2187. __Pyx_RefNannyFinishContext();
  2188. return NULL;
  2189. __pyx_L4_argument_unpacking_done:;
  2190. __pyx_r = __pyx_pf_21ArtNetProcessor_cy_pi_merge(__pyx_self, __pyx_v_dmxold, __pyx_v_dmxnew, __pyx_v_matrix, __pyx_v_hostindex);
  2191. /* function exit code */
  2192. __Pyx_RefNannyFinishContext();
  2193. return __pyx_r;
  2194. }
  2195. static PyObject *__pyx_pf_21ArtNetProcessor_cy_pi_merge(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dmxold, PyObject *__pyx_v_dmxnew, PyObject *__pyx_v_matrix, PyObject *__pyx_v_hostindex) {
  2196. int __pyx_v_i;
  2197. int __pyx_v_v;
  2198. int __pyx_v_update_flag;
  2199. arrayobject *__pyx_v_a = 0;
  2200. __Pyx_memviewslice __pyx_v_dmx = { 0, 0, { 0 }, { 0 }, { 0 } };
  2201. PyObject *__pyx_r = NULL;
  2202. __Pyx_RefNannyDeclarations
  2203. PyObject *__pyx_t_1 = NULL;
  2204. PyObject *__pyx_t_2 = NULL;
  2205. __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2206. int __pyx_t_4;
  2207. Py_ssize_t __pyx_t_5;
  2208. PyObject *(*__pyx_t_6)(PyObject *);
  2209. int __pyx_t_7;
  2210. PyObject *__pyx_t_8 = NULL;
  2211. PyObject *__pyx_t_9 = NULL;
  2212. int __pyx_t_10;
  2213. Py_ssize_t __pyx_t_11;
  2214. int __pyx_lineno = 0;
  2215. const char *__pyx_filename = NULL;
  2216. int __pyx_clineno = 0;
  2217. __Pyx_RefNannySetupContext("merge", 0);
  2218. /* "ArtNetProcessor_cy_pi.pyx":5
  2219. *
  2220. * def merge( dmxold, dmxnew , matrix, hostindex):
  2221. * cdef int i = 0 # <<<<<<<<<<<<<<
  2222. * cdef int v = 0
  2223. * cdef int update_flag = 0
  2224. */
  2225. __pyx_v_i = 0;
  2226. /* "ArtNetProcessor_cy_pi.pyx":6
  2227. * def merge( dmxold, dmxnew , matrix, hostindex):
  2228. * cdef int i = 0
  2229. * cdef int v = 0 # <<<<<<<<<<<<<<
  2230. * cdef int update_flag = 0
  2231. * #cdef int dmx = [0]*512
  2232. */
  2233. __pyx_v_v = 0;
  2234. /* "ArtNetProcessor_cy_pi.pyx":7
  2235. * cdef int i = 0
  2236. * cdef int v = 0
  2237. * cdef int update_flag = 0 # <<<<<<<<<<<<<<
  2238. * #cdef int dmx = [0]*512
  2239. * cdef array.array a = array.array('i', [0]*512)
  2240. */
  2241. __pyx_v_update_flag = 0;
  2242. /* "ArtNetProcessor_cy_pi.pyx":9
  2243. * cdef int update_flag = 0
  2244. * #cdef int dmx = [0]*512
  2245. * cdef array.array a = array.array('i', [0]*512) # <<<<<<<<<<<<<<
  2246. * cdef int[:] dmx = a
  2247. * for i,v in enumerate(dmxnew):
  2248. */
  2249. __pyx_t_1 = PyList_New(1 * 512); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  2250. __Pyx_GOTREF(__pyx_t_1);
  2251. { Py_ssize_t __pyx_temp;
  2252. for (__pyx_temp=0; __pyx_temp < 0x200; __pyx_temp++) {
  2253. __Pyx_INCREF(__pyx_int_0);
  2254. __Pyx_GIVEREF(__pyx_int_0);
  2255. PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_int_0);
  2256. }
  2257. }
  2258. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  2259. __Pyx_GOTREF(__pyx_t_2);
  2260. __Pyx_INCREF(__pyx_n_s_i);
  2261. __Pyx_GIVEREF(__pyx_n_s_i);
  2262. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_i);
  2263. __Pyx_GIVEREF(__pyx_t_1);
  2264. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  2265. __pyx_t_1 = 0;
  2266. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  2267. __Pyx_GOTREF(__pyx_t_1);
  2268. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2269. __pyx_v_a = ((arrayobject *)__pyx_t_1);
  2270. __pyx_t_1 = 0;
  2271. /* "ArtNetProcessor_cy_pi.pyx":10
  2272. * #cdef int dmx = [0]*512
  2273. * cdef array.array a = array.array('i', [0]*512)
  2274. * cdef int[:] dmx = a # <<<<<<<<<<<<<<
  2275. * for i,v in enumerate(dmxnew):
  2276. * if dmxnew[i] != dmxold[i]:
  2277. */
  2278. __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_v_a), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 10, __pyx_L1_error)
  2279. __pyx_v_dmx = __pyx_t_3;
  2280. __pyx_t_3.memview = NULL;
  2281. __pyx_t_3.data = NULL;
  2282. /* "ArtNetProcessor_cy_pi.pyx":11
  2283. * cdef array.array a = array.array('i', [0]*512)
  2284. * cdef int[:] dmx = a
  2285. * for i,v in enumerate(dmxnew): # <<<<<<<<<<<<<<
  2286. * if dmxnew[i] != dmxold[i]:
  2287. * update_flag += 1
  2288. */
  2289. __pyx_t_4 = 0;
  2290. if (likely(PyList_CheckExact(__pyx_v_dmxnew)) || PyTuple_CheckExact(__pyx_v_dmxnew)) {
  2291. __pyx_t_1 = __pyx_v_dmxnew; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
  2292. __pyx_t_6 = NULL;
  2293. } else {
  2294. __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_dmxnew); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  2295. __Pyx_GOTREF(__pyx_t_1);
  2296. __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 11, __pyx_L1_error)
  2297. }
  2298. for (;;) {
  2299. if (likely(!__pyx_t_6)) {
  2300. if (likely(PyList_CheckExact(__pyx_t_1))) {
  2301. if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
  2302. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  2303. __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 11, __pyx_L1_error)
  2304. #else
  2305. __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  2306. __Pyx_GOTREF(__pyx_t_2);
  2307. #endif
  2308. } else {
  2309. if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  2310. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  2311. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 11, __pyx_L1_error)
  2312. #else
  2313. __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  2314. __Pyx_GOTREF(__pyx_t_2);
  2315. #endif
  2316. }
  2317. } else {
  2318. __pyx_t_2 = __pyx_t_6(__pyx_t_1);
  2319. if (unlikely(!__pyx_t_2)) {
  2320. PyObject* exc_type = PyErr_Occurred();
  2321. if (exc_type) {
  2322. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  2323. else __PYX_ERR(0, 11, __pyx_L1_error)
  2324. }
  2325. break;
  2326. }
  2327. __Pyx_GOTREF(__pyx_t_2);
  2328. }
  2329. __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L1_error)
  2330. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2331. __pyx_v_v = __pyx_t_7;
  2332. __pyx_v_i = __pyx_t_4;
  2333. __pyx_t_4 = (__pyx_t_4 + 1);
  2334. /* "ArtNetProcessor_cy_pi.pyx":12
  2335. * cdef int[:] dmx = a
  2336. * for i,v in enumerate(dmxnew):
  2337. * if dmxnew[i] != dmxold[i]: # <<<<<<<<<<<<<<
  2338. * update_flag += 1
  2339. * matrix[i] = hostindex
  2340. */
  2341. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_dmxnew, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
  2342. __Pyx_GOTREF(__pyx_t_2);
  2343. __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_dmxold, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 12, __pyx_L1_error)
  2344. __Pyx_GOTREF(__pyx_t_8);
  2345. __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 12, __pyx_L1_error)
  2346. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2347. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  2348. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 12, __pyx_L1_error)
  2349. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  2350. if (__pyx_t_10) {
  2351. /* "ArtNetProcessor_cy_pi.pyx":13
  2352. * for i,v in enumerate(dmxnew):
  2353. * if dmxnew[i] != dmxold[i]:
  2354. * update_flag += 1 # <<<<<<<<<<<<<<
  2355. * matrix[i] = hostindex
  2356. * dmx[i] = v
  2357. */
  2358. __pyx_v_update_flag = (__pyx_v_update_flag + 1);
  2359. /* "ArtNetProcessor_cy_pi.pyx":14
  2360. * if dmxnew[i] != dmxold[i]:
  2361. * update_flag += 1
  2362. * matrix[i] = hostindex # <<<<<<<<<<<<<<
  2363. * dmx[i] = v
  2364. * return (dmx,matrix,update_flag)
  2365. */
  2366. if (unlikely(__Pyx_SetItemInt(__pyx_v_matrix, __pyx_v_i, __pyx_v_hostindex, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 14, __pyx_L1_error)
  2367. /* "ArtNetProcessor_cy_pi.pyx":12
  2368. * cdef int[:] dmx = a
  2369. * for i,v in enumerate(dmxnew):
  2370. * if dmxnew[i] != dmxold[i]: # <<<<<<<<<<<<<<
  2371. * update_flag += 1
  2372. * matrix[i] = hostindex
  2373. */
  2374. }
  2375. /* "ArtNetProcessor_cy_pi.pyx":15
  2376. * update_flag += 1
  2377. * matrix[i] = hostindex
  2378. * dmx[i] = v # <<<<<<<<<<<<<<
  2379. * return (dmx,matrix,update_flag)
  2380. */
  2381. __pyx_t_11 = __pyx_v_i;
  2382. __pyx_t_7 = -1;
  2383. if (__pyx_t_11 < 0) {
  2384. __pyx_t_11 += __pyx_v_dmx.shape[0];
  2385. if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 0;
  2386. } else if (unlikely(__pyx_t_11 >= __pyx_v_dmx.shape[0])) __pyx_t_7 = 0;
  2387. if (unlikely(__pyx_t_7 != -1)) {
  2388. __Pyx_RaiseBufferIndexError(__pyx_t_7);
  2389. __PYX_ERR(0, 15, __pyx_L1_error)
  2390. }
  2391. *((int *) ( /* dim=0 */ (__pyx_v_dmx.data + __pyx_t_11 * __pyx_v_dmx.strides[0]) )) = __pyx_v_v;
  2392. /* "ArtNetProcessor_cy_pi.pyx":11
  2393. * cdef array.array a = array.array('i', [0]*512)
  2394. * cdef int[:] dmx = a
  2395. * for i,v in enumerate(dmxnew): # <<<<<<<<<<<<<<
  2396. * if dmxnew[i] != dmxold[i]:
  2397. * update_flag += 1
  2398. */
  2399. }
  2400. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2401. /* "ArtNetProcessor_cy_pi.pyx":16
  2402. * matrix[i] = hostindex
  2403. * dmx[i] = v
  2404. * return (dmx,matrix,update_flag) # <<<<<<<<<<<<<<
  2405. */
  2406. __Pyx_XDECREF(__pyx_r);
  2407. __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dmx, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  2408. __Pyx_GOTREF(__pyx_t_1);
  2409. __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_update_flag); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 16, __pyx_L1_error)
  2410. __Pyx_GOTREF(__pyx_t_9);
  2411. __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 16, __pyx_L1_error)
  2412. __Pyx_GOTREF(__pyx_t_8);
  2413. __Pyx_GIVEREF(__pyx_t_1);
  2414. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  2415. __Pyx_INCREF(__pyx_v_matrix);
  2416. __Pyx_GIVEREF(__pyx_v_matrix);
  2417. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_matrix);
  2418. __Pyx_GIVEREF(__pyx_t_9);
  2419. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
  2420. __pyx_t_1 = 0;
  2421. __pyx_t_9 = 0;
  2422. __pyx_r = __pyx_t_8;
  2423. __pyx_t_8 = 0;
  2424. goto __pyx_L0;
  2425. /* "ArtNetProcessor_cy_pi.pyx":4
  2426. * import array
  2427. *
  2428. * def merge( dmxold, dmxnew , matrix, hostindex): # <<<<<<<<<<<<<<
  2429. * cdef int i = 0
  2430. * cdef int v = 0
  2431. */
  2432. /* function exit code */
  2433. __pyx_L1_error:;
  2434. __Pyx_XDECREF(__pyx_t_1);
  2435. __Pyx_XDECREF(__pyx_t_2);
  2436. __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
  2437. __Pyx_XDECREF(__pyx_t_8);
  2438. __Pyx_XDECREF(__pyx_t_9);
  2439. __Pyx_AddTraceback("ArtNetProcessor_cy_pi.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2440. __pyx_r = NULL;
  2441. __pyx_L0:;
  2442. __Pyx_XDECREF((PyObject *)__pyx_v_a);
  2443. __PYX_XDEC_MEMVIEW(&__pyx_v_dmx, 1);
  2444. __Pyx_XGIVEREF(__pyx_r);
  2445. __Pyx_RefNannyFinishContext();
  2446. return __pyx_r;
  2447. }
  2448. /* "array.pxd":93
  2449. * __data_union data
  2450. *
  2451. * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  2452. * # This implementation of getbuffer is geared towards Cython
  2453. * # requirements, and does not yet fulfill the PEP.
  2454. */
  2455. /* Python wrapper */
  2456. static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  2457. static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  2458. int __pyx_r;
  2459. __Pyx_RefNannyDeclarations
  2460. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  2461. __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  2462. /* function exit code */
  2463. __Pyx_RefNannyFinishContext();
  2464. return __pyx_r;
  2465. }
  2466. static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
  2467. PyObject *__pyx_v_item_count = NULL;
  2468. int __pyx_r;
  2469. __Pyx_RefNannyDeclarations
  2470. PyObject *__pyx_t_1 = NULL;
  2471. char *__pyx_t_2;
  2472. int __pyx_t_3;
  2473. PyObject *__pyx_t_4 = NULL;
  2474. Py_ssize_t __pyx_t_5;
  2475. int __pyx_t_6;
  2476. char __pyx_t_7;
  2477. int __pyx_lineno = 0;
  2478. const char *__pyx_filename = NULL;
  2479. int __pyx_clineno = 0;
  2480. if (__pyx_v_info == NULL) {
  2481. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  2482. return -1;
  2483. }
  2484. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  2485. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  2486. __Pyx_GIVEREF(__pyx_v_info->obj);
  2487. /* "array.pxd":98
  2488. * # In particular strided access is always provided regardless
  2489. * # of flags
  2490. * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
  2491. *
  2492. * info.suboffsets = NULL
  2493. */
  2494. __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error)
  2495. __Pyx_GOTREF(__pyx_t_1);
  2496. __pyx_v_item_count = __pyx_t_1;
  2497. __pyx_t_1 = 0;
  2498. /* "array.pxd":100
  2499. * item_count = Py_SIZE(self)
  2500. *
  2501. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  2502. * info.buf = self.data.as_chars
  2503. * info.readonly = 0
  2504. */
  2505. __pyx_v_info->suboffsets = NULL;
  2506. /* "array.pxd":101
  2507. *
  2508. * info.suboffsets = NULL
  2509. * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
  2510. * info.readonly = 0
  2511. * info.ndim = 1
  2512. */
  2513. __pyx_t_2 = __pyx_v_self->data.as_chars;
  2514. __pyx_v_info->buf = __pyx_t_2;
  2515. /* "array.pxd":102
  2516. * info.suboffsets = NULL
  2517. * info.buf = self.data.as_chars
  2518. * info.readonly = 0 # <<<<<<<<<<<<<<
  2519. * info.ndim = 1
  2520. * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
  2521. */
  2522. __pyx_v_info->readonly = 0;
  2523. /* "array.pxd":103
  2524. * info.buf = self.data.as_chars
  2525. * info.readonly = 0
  2526. * info.ndim = 1 # <<<<<<<<<<<<<<
  2527. * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
  2528. * info.len = info.itemsize * item_count
  2529. */
  2530. __pyx_v_info->ndim = 1;
  2531. /* "array.pxd":104
  2532. * info.readonly = 0
  2533. * info.ndim = 1
  2534. * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
  2535. * info.len = info.itemsize * item_count
  2536. *
  2537. */
  2538. __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
  2539. __pyx_v_info->itemsize = __pyx_t_3;
  2540. /* "array.pxd":105
  2541. * info.ndim = 1
  2542. * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
  2543. * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
  2544. *
  2545. * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
  2546. */
  2547. __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 105, __pyx_L1_error)
  2548. __Pyx_GOTREF(__pyx_t_1);
  2549. __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 105, __pyx_L1_error)
  2550. __Pyx_GOTREF(__pyx_t_4);
  2551. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2552. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 105, __pyx_L1_error)
  2553. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2554. __pyx_v_info->len = __pyx_t_5;
  2555. /* "array.pxd":107
  2556. * info.len = info.itemsize * item_count
  2557. *
  2558. * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
  2559. * if not info.shape:
  2560. * raise MemoryError()
  2561. */
  2562. __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));
  2563. /* "array.pxd":108
  2564. *
  2565. * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
  2566. * if not info.shape: # <<<<<<<<<<<<<<
  2567. * raise MemoryError()
  2568. * info.shape[0] = item_count # constant regardless of resizing
  2569. */
  2570. __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0);
  2571. if (unlikely(__pyx_t_6)) {
  2572. /* "array.pxd":109
  2573. * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
  2574. * if not info.shape:
  2575. * raise MemoryError() # <<<<<<<<<<<<<<
  2576. * info.shape[0] = item_count # constant regardless of resizing
  2577. * info.strides = &info.itemsize
  2578. */
  2579. PyErr_NoMemory(); __PYX_ERR(1, 109, __pyx_L1_error)
  2580. /* "array.pxd":108
  2581. *
  2582. * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
  2583. * if not info.shape: # <<<<<<<<<<<<<<
  2584. * raise MemoryError()
  2585. * info.shape[0] = item_count # constant regardless of resizing
  2586. */
  2587. }
  2588. /* "array.pxd":110
  2589. * if not info.shape:
  2590. * raise MemoryError()
  2591. * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
  2592. * info.strides = &info.itemsize
  2593. *
  2594. */
  2595. __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 110, __pyx_L1_error)
  2596. (__pyx_v_info->shape[0]) = __pyx_t_5;
  2597. /* "array.pxd":111
  2598. * raise MemoryError()
  2599. * info.shape[0] = item_count # constant regardless of resizing
  2600. * info.strides = &info.itemsize # <<<<<<<<<<<<<<
  2601. *
  2602. * info.format = <char*> (info.shape + 1)
  2603. */
  2604. __pyx_v_info->strides = (&__pyx_v_info->itemsize);
  2605. /* "array.pxd":113
  2606. * info.strides = &info.itemsize
  2607. *
  2608. * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
  2609. * info.format[0] = self.ob_descr.typecode
  2610. * info.format[1] = 0
  2611. */
  2612. __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
  2613. /* "array.pxd":114
  2614. *
  2615. * info.format = <char*> (info.shape + 1)
  2616. * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
  2617. * info.format[1] = 0
  2618. * info.obj = self
  2619. */
  2620. __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
  2621. (__pyx_v_info->format[0]) = __pyx_t_7;
  2622. /* "array.pxd":115
  2623. * info.format = <char*> (info.shape + 1)
  2624. * info.format[0] = self.ob_descr.typecode
  2625. * info.format[1] = 0 # <<<<<<<<<<<<<<
  2626. * info.obj = self
  2627. *
  2628. */
  2629. (__pyx_v_info->format[1]) = 0;
  2630. /* "array.pxd":116
  2631. * info.format[0] = self.ob_descr.typecode
  2632. * info.format[1] = 0
  2633. * info.obj = self # <<<<<<<<<<<<<<
  2634. *
  2635. * def __releasebuffer__(self, Py_buffer* info):
  2636. */
  2637. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  2638. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  2639. __Pyx_GOTREF(__pyx_v_info->obj);
  2640. __Pyx_DECREF(__pyx_v_info->obj);
  2641. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  2642. /* "array.pxd":93
  2643. * __data_union data
  2644. *
  2645. * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  2646. * # This implementation of getbuffer is geared towards Cython
  2647. * # requirements, and does not yet fulfill the PEP.
  2648. */
  2649. /* function exit code */
  2650. __pyx_r = 0;
  2651. goto __pyx_L0;
  2652. __pyx_L1_error:;
  2653. __Pyx_XDECREF(__pyx_t_1);
  2654. __Pyx_XDECREF(__pyx_t_4);
  2655. __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2656. __pyx_r = -1;
  2657. if (__pyx_v_info->obj != NULL) {
  2658. __Pyx_GOTREF(__pyx_v_info->obj);
  2659. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  2660. }
  2661. goto __pyx_L2;
  2662. __pyx_L0:;
  2663. if (__pyx_v_info->obj == Py_None) {
  2664. __Pyx_GOTREF(__pyx_v_info->obj);
  2665. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  2666. }
  2667. __pyx_L2:;
  2668. __Pyx_XDECREF(__pyx_v_item_count);
  2669. __Pyx_RefNannyFinishContext();
  2670. return __pyx_r;
  2671. }
  2672. /* "array.pxd":118
  2673. * info.obj = self
  2674. *
  2675. * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
  2676. * PyObject_Free(info.shape)
  2677. *
  2678. */
  2679. /* Python wrapper */
  2680. static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  2681. static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  2682. __Pyx_RefNannyDeclarations
  2683. __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  2684. __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  2685. /* function exit code */
  2686. __Pyx_RefNannyFinishContext();
  2687. }
  2688. static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  2689. __Pyx_RefNannyDeclarations
  2690. __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  2691. /* "array.pxd":119
  2692. *
  2693. * def __releasebuffer__(self, Py_buffer* info):
  2694. * PyObject_Free(info.shape) # <<<<<<<<<<<<<<
  2695. *
  2696. * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
  2697. */
  2698. PyObject_Free(__pyx_v_info->shape);
  2699. /* "array.pxd":118
  2700. * info.obj = self
  2701. *
  2702. * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
  2703. * PyObject_Free(info.shape)
  2704. *
  2705. */
  2706. /* function exit code */
  2707. __Pyx_RefNannyFinishContext();
  2708. }
  2709. /* "array.pxd":130
  2710. *
  2711. *
  2712. * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
  2713. * """ fast creation of a new array, given a template array.
  2714. * type will be same as template.
  2715. */
  2716. static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
  2717. arrayobject *__pyx_v_op = NULL;
  2718. arrayobject *__pyx_r = NULL;
  2719. __Pyx_RefNannyDeclarations
  2720. PyObject *__pyx_t_1 = NULL;
  2721. int __pyx_t_2;
  2722. int __pyx_t_3;
  2723. int __pyx_t_4;
  2724. int __pyx_lineno = 0;
  2725. const char *__pyx_filename = NULL;
  2726. int __pyx_clineno = 0;
  2727. __Pyx_RefNannySetupContext("clone", 0);
  2728. /* "array.pxd":134
  2729. * type will be same as template.
  2730. * if zero is true, new array will be initialized with zeroes."""
  2731. * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
  2732. * if zero and op is not None:
  2733. * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
  2734. */
  2735. __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 134, __pyx_L1_error)
  2736. __Pyx_GOTREF(__pyx_t_1);
  2737. __pyx_v_op = ((arrayobject *)__pyx_t_1);
  2738. __pyx_t_1 = 0;
  2739. /* "array.pxd":135
  2740. * if zero is true, new array will be initialized with zeroes."""
  2741. * op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
  2742. * if zero and op is not None: # <<<<<<<<<<<<<<
  2743. * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
  2744. * return op
  2745. */
  2746. __pyx_t_3 = (__pyx_v_zero != 0);
  2747. if (__pyx_t_3) {
  2748. } else {
  2749. __pyx_t_2 = __pyx_t_3;
  2750. goto __pyx_L4_bool_binop_done;
  2751. }
  2752. __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
  2753. __pyx_t_4 = (__pyx_t_3 != 0);
  2754. __pyx_t_2 = __pyx_t_4;
  2755. __pyx_L4_bool_binop_done:;
  2756. if (__pyx_t_2) {
  2757. /* "array.pxd":136
  2758. * op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
  2759. * if zero and op is not None:
  2760. * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
  2761. * return op
  2762. *
  2763. */
  2764. (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));
  2765. /* "array.pxd":135
  2766. * if zero is true, new array will be initialized with zeroes."""
  2767. * op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
  2768. * if zero and op is not None: # <<<<<<<<<<<<<<
  2769. * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
  2770. * return op
  2771. */
  2772. }
  2773. /* "array.pxd":137
  2774. * if zero and op is not None:
  2775. * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
  2776. * return op # <<<<<<<<<<<<<<
  2777. *
  2778. * cdef inline array copy(array self):
  2779. */
  2780. __Pyx_XDECREF(((PyObject *)__pyx_r));
  2781. __Pyx_INCREF(((PyObject *)__pyx_v_op));
  2782. __pyx_r = __pyx_v_op;
  2783. goto __pyx_L0;
  2784. /* "array.pxd":130
  2785. *
  2786. *
  2787. * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
  2788. * """ fast creation of a new array, given a template array.
  2789. * type will be same as template.
  2790. */
  2791. /* function exit code */
  2792. __pyx_L1_error:;
  2793. __Pyx_XDECREF(__pyx_t_1);
  2794. __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2795. __pyx_r = 0;
  2796. __pyx_L0:;
  2797. __Pyx_XDECREF((PyObject *)__pyx_v_op);
  2798. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  2799. __Pyx_RefNannyFinishContext();
  2800. return __pyx_r;
  2801. }
  2802. /* "array.pxd":139
  2803. * return op
  2804. *
  2805. * cdef inline array copy(array self): # <<<<<<<<<<<<<<
  2806. * """ make a copy of an array. """
  2807. * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
  2808. */
  2809. static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
  2810. arrayobject *__pyx_v_op = NULL;
  2811. arrayobject *__pyx_r = NULL;
  2812. __Pyx_RefNannyDeclarations
  2813. PyObject *__pyx_t_1 = NULL;
  2814. int __pyx_lineno = 0;
  2815. const char *__pyx_filename = NULL;
  2816. int __pyx_clineno = 0;
  2817. __Pyx_RefNannySetupContext("copy", 0);
  2818. /* "array.pxd":141
  2819. * cdef inline array copy(array self):
  2820. * """ make a copy of an array. """
  2821. * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
  2822. * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
  2823. * return op
  2824. */
  2825. __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __pyx_L1_error)
  2826. __Pyx_GOTREF(__pyx_t_1);
  2827. __pyx_v_op = ((arrayobject *)__pyx_t_1);
  2828. __pyx_t_1 = 0;
  2829. /* "array.pxd":142
  2830. * """ make a copy of an array. """
  2831. * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
  2832. * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
  2833. * return op
  2834. *
  2835. */
  2836. (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));
  2837. /* "array.pxd":143
  2838. * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
  2839. * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
  2840. * return op # <<<<<<<<<<<<<<
  2841. *
  2842. * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
  2843. */
  2844. __Pyx_XDECREF(((PyObject *)__pyx_r));
  2845. __Pyx_INCREF(((PyObject *)__pyx_v_op));
  2846. __pyx_r = __pyx_v_op;
  2847. goto __pyx_L0;
  2848. /* "array.pxd":139
  2849. * return op
  2850. *
  2851. * cdef inline array copy(array self): # <<<<<<<<<<<<<<
  2852. * """ make a copy of an array. """
  2853. * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
  2854. */
  2855. /* function exit code */
  2856. __pyx_L1_error:;
  2857. __Pyx_XDECREF(__pyx_t_1);
  2858. __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2859. __pyx_r = 0;
  2860. __pyx_L0:;
  2861. __Pyx_XDECREF((PyObject *)__pyx_v_op);
  2862. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  2863. __Pyx_RefNannyFinishContext();
  2864. return __pyx_r;
  2865. }
  2866. /* "array.pxd":145
  2867. * return op
  2868. *
  2869. * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
  2870. * """ efficient appending of new stuff of same type
  2871. * (e.g. of same array type)
  2872. */
  2873. static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
  2874. Py_ssize_t __pyx_v_itemsize;
  2875. Py_ssize_t __pyx_v_origsize;
  2876. int __pyx_r;
  2877. __Pyx_RefNannyDeclarations
  2878. int __pyx_t_1;
  2879. int __pyx_lineno = 0;
  2880. const char *__pyx_filename = NULL;
  2881. int __pyx_clineno = 0;
  2882. __Pyx_RefNannySetupContext("extend_buffer", 0);
  2883. /* "array.pxd":149
  2884. * (e.g. of same array type)
  2885. * n: number of elements (not number of bytes!) """
  2886. * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
  2887. * cdef Py_ssize_t origsize = Py_SIZE(self)
  2888. * resize_smart(self, origsize + n)
  2889. */
  2890. __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
  2891. __pyx_v_itemsize = __pyx_t_1;
  2892. /* "array.pxd":150
  2893. * n: number of elements (not number of bytes!) """
  2894. * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
  2895. * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
  2896. * resize_smart(self, origsize + n)
  2897. * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
  2898. */
  2899. __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
  2900. /* "array.pxd":151
  2901. * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
  2902. * cdef Py_ssize_t origsize = Py_SIZE(self)
  2903. * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
  2904. * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
  2905. * return 0
  2906. */
  2907. __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 151, __pyx_L1_error)
  2908. /* "array.pxd":152
  2909. * cdef Py_ssize_t origsize = Py_SIZE(self)
  2910. * resize_smart(self, origsize + n)
  2911. * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
  2912. * return 0
  2913. *
  2914. */
  2915. (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));
  2916. /* "array.pxd":153
  2917. * resize_smart(self, origsize + n)
  2918. * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
  2919. * return 0 # <<<<<<<<<<<<<<
  2920. *
  2921. * cdef inline int extend(array self, array other) except -1:
  2922. */
  2923. __pyx_r = 0;
  2924. goto __pyx_L0;
  2925. /* "array.pxd":145
  2926. * return op
  2927. *
  2928. * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
  2929. * """ efficient appending of new stuff of same type
  2930. * (e.g. of same array type)
  2931. */
  2932. /* function exit code */
  2933. __pyx_L1_error:;
  2934. __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2935. __pyx_r = -1;
  2936. __pyx_L0:;
  2937. __Pyx_RefNannyFinishContext();
  2938. return __pyx_r;
  2939. }
  2940. /* "array.pxd":155
  2941. * return 0
  2942. *
  2943. * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
  2944. * """ extend array with data from another array; types must match. """
  2945. * if self.ob_descr.typecode != other.ob_descr.typecode:
  2946. */
  2947. static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
  2948. int __pyx_r;
  2949. __Pyx_RefNannyDeclarations
  2950. int __pyx_t_1;
  2951. int __pyx_t_2;
  2952. int __pyx_lineno = 0;
  2953. const char *__pyx_filename = NULL;
  2954. int __pyx_clineno = 0;
  2955. __Pyx_RefNannySetupContext("extend", 0);
  2956. /* "array.pxd":157
  2957. * cdef inline int extend(array self, array other) except -1:
  2958. * """ extend array with data from another array; types must match. """
  2959. * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
  2960. * PyErr_BadArgument()
  2961. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
  2962. */
  2963. __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0);
  2964. if (__pyx_t_1) {
  2965. /* "array.pxd":158
  2966. * """ extend array with data from another array; types must match. """
  2967. * if self.ob_descr.typecode != other.ob_descr.typecode:
  2968. * PyErr_BadArgument() # <<<<<<<<<<<<<<
  2969. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
  2970. *
  2971. */
  2972. __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 158, __pyx_L1_error)
  2973. /* "array.pxd":157
  2974. * cdef inline int extend(array self, array other) except -1:
  2975. * """ extend array with data from another array; types must match. """
  2976. * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
  2977. * PyErr_BadArgument()
  2978. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
  2979. */
  2980. }
  2981. /* "array.pxd":159
  2982. * if self.ob_descr.typecode != other.ob_descr.typecode:
  2983. * PyErr_BadArgument()
  2984. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
  2985. *
  2986. * cdef inline void zero(array self):
  2987. */
  2988. __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 159, __pyx_L1_error)
  2989. __pyx_r = __pyx_t_2;
  2990. goto __pyx_L0;
  2991. /* "array.pxd":155
  2992. * return 0
  2993. *
  2994. * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
  2995. * """ extend array with data from another array; types must match. """
  2996. * if self.ob_descr.typecode != other.ob_descr.typecode:
  2997. */
  2998. /* function exit code */
  2999. __pyx_L1_error:;
  3000. __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3001. __pyx_r = -1;
  3002. __pyx_L0:;
  3003. __Pyx_RefNannyFinishContext();
  3004. return __pyx_r;
  3005. }
  3006. /* "array.pxd":161
  3007. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
  3008. *
  3009. * cdef inline void zero(array self): # <<<<<<<<<<<<<<
  3010. * """ set all elements of array to zero. """
  3011. * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
  3012. */
  3013. static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
  3014. __Pyx_RefNannyDeclarations
  3015. __Pyx_RefNannySetupContext("zero", 0);
  3016. /* "array.pxd":163
  3017. * cdef inline void zero(array self):
  3018. * """ set all elements of array to zero. """
  3019. * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
  3020. */
  3021. (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));
  3022. /* "array.pxd":161
  3023. * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
  3024. *
  3025. * cdef inline void zero(array self): # <<<<<<<<<<<<<<
  3026. * """ set all elements of array to zero. """
  3027. * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
  3028. */
  3029. /* function exit code */
  3030. __Pyx_RefNannyFinishContext();
  3031. }
  3032. /* "View.MemoryView":122
  3033. * cdef bint dtype_is_object
  3034. *
  3035. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3036. * mode="c", bint allocate_buffer=True):
  3037. *
  3038. */
  3039. /* Python wrapper */
  3040. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3041. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3042. PyObject *__pyx_v_shape = 0;
  3043. Py_ssize_t __pyx_v_itemsize;
  3044. PyObject *__pyx_v_format = 0;
  3045. PyObject *__pyx_v_mode = 0;
  3046. int __pyx_v_allocate_buffer;
  3047. int __pyx_lineno = 0;
  3048. const char *__pyx_filename = NULL;
  3049. int __pyx_clineno = 0;
  3050. int __pyx_r;
  3051. __Pyx_RefNannyDeclarations
  3052. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  3053. {
  3054. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
  3055. PyObject* values[5] = {0,0,0,0,0};
  3056. values[3] = ((PyObject *)__pyx_n_s_c);
  3057. if (unlikely(__pyx_kwds)) {
  3058. Py_ssize_t kw_args;
  3059. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3060. switch (pos_args) {
  3061. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3062. CYTHON_FALLTHROUGH;
  3063. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3064. CYTHON_FALLTHROUGH;
  3065. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3066. CYTHON_FALLTHROUGH;
  3067. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3068. CYTHON_FALLTHROUGH;
  3069. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3070. CYTHON_FALLTHROUGH;
  3071. case 0: break;
  3072. default: goto __pyx_L5_argtuple_error;
  3073. }
  3074. kw_args = PyDict_Size(__pyx_kwds);
  3075. switch (pos_args) {
  3076. case 0:
  3077. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
  3078. else goto __pyx_L5_argtuple_error;
  3079. CYTHON_FALLTHROUGH;
  3080. case 1:
  3081. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
  3082. else {
  3083. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
  3084. }
  3085. CYTHON_FALLTHROUGH;
  3086. case 2:
  3087. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
  3088. else {
  3089. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
  3090. }
  3091. CYTHON_FALLTHROUGH;
  3092. case 3:
  3093. if (kw_args > 0) {
  3094. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
  3095. if (value) { values[3] = value; kw_args--; }
  3096. }
  3097. CYTHON_FALLTHROUGH;
  3098. case 4:
  3099. if (kw_args > 0) {
  3100. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
  3101. if (value) { values[4] = value; kw_args--; }
  3102. }
  3103. }
  3104. if (unlikely(kw_args > 0)) {
  3105. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
  3106. }
  3107. } else {
  3108. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3109. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3110. CYTHON_FALLTHROUGH;
  3111. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3112. CYTHON_FALLTHROUGH;
  3113. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3114. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3115. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3116. break;
  3117. default: goto __pyx_L5_argtuple_error;
  3118. }
  3119. }
  3120. __pyx_v_shape = ((PyObject*)values[0]);
  3121. __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
  3122. __pyx_v_format = values[2];
  3123. __pyx_v_mode = values[3];
  3124. if (values[4]) {
  3125. __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
  3126. } else {
  3127. /* "View.MemoryView":123
  3128. *
  3129. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
  3130. * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
  3131. *
  3132. * cdef int idx
  3133. */
  3134. __pyx_v_allocate_buffer = ((int)1);
  3135. }
  3136. }
  3137. goto __pyx_L4_argument_unpacking_done;
  3138. __pyx_L5_argtuple_error:;
  3139. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
  3140. __pyx_L3_error:;
  3141. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3142. __Pyx_RefNannyFinishContext();
  3143. return -1;
  3144. __pyx_L4_argument_unpacking_done:;
  3145. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
  3146. if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
  3147. PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
  3148. }
  3149. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
  3150. /* "View.MemoryView":122
  3151. * cdef bint dtype_is_object
  3152. *
  3153. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3154. * mode="c", bint allocate_buffer=True):
  3155. *
  3156. */
  3157. /* function exit code */
  3158. goto __pyx_L0;
  3159. __pyx_L1_error:;
  3160. __pyx_r = -1;
  3161. __pyx_L0:;
  3162. __Pyx_RefNannyFinishContext();
  3163. return __pyx_r;
  3164. }
  3165. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  3166. int __pyx_v_idx;
  3167. Py_ssize_t __pyx_v_i;
  3168. Py_ssize_t __pyx_v_dim;
  3169. PyObject **__pyx_v_p;
  3170. char __pyx_v_order;
  3171. int __pyx_r;
  3172. __Pyx_RefNannyDeclarations
  3173. Py_ssize_t __pyx_t_1;
  3174. int __pyx_t_2;
  3175. PyObject *__pyx_t_3 = NULL;
  3176. int __pyx_t_4;
  3177. PyObject *__pyx_t_5 = NULL;
  3178. PyObject *__pyx_t_6 = NULL;
  3179. char *__pyx_t_7;
  3180. int __pyx_t_8;
  3181. Py_ssize_t __pyx_t_9;
  3182. PyObject *__pyx_t_10 = NULL;
  3183. Py_ssize_t __pyx_t_11;
  3184. int __pyx_lineno = 0;
  3185. const char *__pyx_filename = NULL;
  3186. int __pyx_clineno = 0;
  3187. __Pyx_RefNannySetupContext("__cinit__", 0);
  3188. __Pyx_INCREF(__pyx_v_format);
  3189. /* "View.MemoryView":129
  3190. * cdef PyObject **p
  3191. *
  3192. * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
  3193. * self.itemsize = itemsize
  3194. *
  3195. */
  3196. if (unlikely(__pyx_v_shape == Py_None)) {
  3197. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  3198. __PYX_ERR(2, 129, __pyx_L1_error)
  3199. }
  3200. __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
  3201. __pyx_v_self->ndim = ((int)__pyx_t_1);
  3202. /* "View.MemoryView":130
  3203. *
  3204. * self.ndim = <int> len(shape)
  3205. * self.itemsize = itemsize # <<<<<<<<<<<<<<
  3206. *
  3207. * if not self.ndim:
  3208. */
  3209. __pyx_v_self->itemsize = __pyx_v_itemsize;
  3210. /* "View.MemoryView":132
  3211. * self.itemsize = itemsize
  3212. *
  3213. * if not self.ndim: # <<<<<<<<<<<<<<
  3214. * raise ValueError("Empty shape tuple for cython.array")
  3215. *
  3216. */
  3217. __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  3218. if (unlikely(__pyx_t_2)) {
  3219. /* "View.MemoryView":133
  3220. *
  3221. * if not self.ndim:
  3222. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  3223. *
  3224. * if itemsize <= 0:
  3225. */
  3226. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
  3227. __Pyx_GOTREF(__pyx_t_3);
  3228. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3229. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3230. __PYX_ERR(2, 133, __pyx_L1_error)
  3231. /* "View.MemoryView":132
  3232. * self.itemsize = itemsize
  3233. *
  3234. * if not self.ndim: # <<<<<<<<<<<<<<
  3235. * raise ValueError("Empty shape tuple for cython.array")
  3236. *
  3237. */
  3238. }
  3239. /* "View.MemoryView":135
  3240. * raise ValueError("Empty shape tuple for cython.array")
  3241. *
  3242. * if itemsize <= 0: # <<<<<<<<<<<<<<
  3243. * raise ValueError("itemsize <= 0 for cython.array")
  3244. *
  3245. */
  3246. __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  3247. if (unlikely(__pyx_t_2)) {
  3248. /* "View.MemoryView":136
  3249. *
  3250. * if itemsize <= 0:
  3251. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  3252. *
  3253. * if not isinstance(format, bytes):
  3254. */
  3255. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
  3256. __Pyx_GOTREF(__pyx_t_3);
  3257. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3258. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3259. __PYX_ERR(2, 136, __pyx_L1_error)
  3260. /* "View.MemoryView":135
  3261. * raise ValueError("Empty shape tuple for cython.array")
  3262. *
  3263. * if itemsize <= 0: # <<<<<<<<<<<<<<
  3264. * raise ValueError("itemsize <= 0 for cython.array")
  3265. *
  3266. */
  3267. }
  3268. /* "View.MemoryView":138
  3269. * raise ValueError("itemsize <= 0 for cython.array")
  3270. *
  3271. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  3272. * format = format.encode('ASCII')
  3273. * self._format = format # keep a reference to the byte string
  3274. */
  3275. __pyx_t_2 = PyBytes_Check(__pyx_v_format);
  3276. __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  3277. if (__pyx_t_4) {
  3278. /* "View.MemoryView":139
  3279. *
  3280. * if not isinstance(format, bytes):
  3281. * format = format.encode('ASCII') # <<<<<<<<<<<<<<
  3282. * self._format = format # keep a reference to the byte string
  3283. * self.format = self._format
  3284. */
  3285. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
  3286. __Pyx_GOTREF(__pyx_t_5);
  3287. __pyx_t_6 = NULL;
  3288. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  3289. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  3290. if (likely(__pyx_t_6)) {
  3291. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  3292. __Pyx_INCREF(__pyx_t_6);
  3293. __Pyx_INCREF(function);
  3294. __Pyx_DECREF_SET(__pyx_t_5, function);
  3295. }
  3296. }
  3297. __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
  3298. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3299. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
  3300. __Pyx_GOTREF(__pyx_t_3);
  3301. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3302. __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
  3303. __pyx_t_3 = 0;
  3304. /* "View.MemoryView":138
  3305. * raise ValueError("itemsize <= 0 for cython.array")
  3306. *
  3307. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  3308. * format = format.encode('ASCII')
  3309. * self._format = format # keep a reference to the byte string
  3310. */
  3311. }
  3312. /* "View.MemoryView":140
  3313. * if not isinstance(format, bytes):
  3314. * format = format.encode('ASCII')
  3315. * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
  3316. * self.format = self._format
  3317. *
  3318. */
  3319. if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
  3320. __pyx_t_3 = __pyx_v_format;
  3321. __Pyx_INCREF(__pyx_t_3);
  3322. __Pyx_GIVEREF(__pyx_t_3);
  3323. __Pyx_GOTREF(__pyx_v_self->_format);
  3324. __Pyx_DECREF(__pyx_v_self->_format);
  3325. __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  3326. __pyx_t_3 = 0;
  3327. /* "View.MemoryView":141
  3328. * format = format.encode('ASCII')
  3329. * self._format = format # keep a reference to the byte string
  3330. * self.format = self._format # <<<<<<<<<<<<<<
  3331. *
  3332. *
  3333. */
  3334. if (unlikely(__pyx_v_self->_format == Py_None)) {
  3335. PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
  3336. __PYX_ERR(2, 141, __pyx_L1_error)
  3337. }
  3338. __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
  3339. __pyx_v_self->format = __pyx_t_7;
  3340. /* "View.MemoryView":144
  3341. *
  3342. *
  3343. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
  3344. * self._strides = self._shape + self.ndim
  3345. *
  3346. */
  3347. __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
  3348. /* "View.MemoryView":145
  3349. *
  3350. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
  3351. * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
  3352. *
  3353. * if not self._shape:
  3354. */
  3355. __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
  3356. /* "View.MemoryView":147
  3357. * self._strides = self._shape + self.ndim
  3358. *
  3359. * if not self._shape: # <<<<<<<<<<<<<<
  3360. * raise MemoryError("unable to allocate shape and strides.")
  3361. *
  3362. */
  3363. __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  3364. if (unlikely(__pyx_t_4)) {
  3365. /* "View.MemoryView":148
  3366. *
  3367. * if not self._shape:
  3368. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  3369. *
  3370. *
  3371. */
  3372. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
  3373. __Pyx_GOTREF(__pyx_t_3);
  3374. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3375. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3376. __PYX_ERR(2, 148, __pyx_L1_error)
  3377. /* "View.MemoryView":147
  3378. * self._strides = self._shape + self.ndim
  3379. *
  3380. * if not self._shape: # <<<<<<<<<<<<<<
  3381. * raise MemoryError("unable to allocate shape and strides.")
  3382. *
  3383. */
  3384. }
  3385. /* "View.MemoryView":151
  3386. *
  3387. *
  3388. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  3389. * if dim <= 0:
  3390. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3391. */
  3392. __pyx_t_8 = 0;
  3393. __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  3394. for (;;) {
  3395. if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  3396. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3397. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
  3398. #else
  3399. __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
  3400. __Pyx_GOTREF(__pyx_t_5);
  3401. #endif
  3402. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
  3403. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3404. __pyx_v_dim = __pyx_t_9;
  3405. __pyx_v_idx = __pyx_t_8;
  3406. __pyx_t_8 = (__pyx_t_8 + 1);
  3407. /* "View.MemoryView":152
  3408. *
  3409. * for idx, dim in enumerate(shape):
  3410. * if dim <= 0: # <<<<<<<<<<<<<<
  3411. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3412. * self._shape[idx] = dim
  3413. */
  3414. __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
  3415. if (unlikely(__pyx_t_4)) {
  3416. /* "View.MemoryView":153
  3417. * for idx, dim in enumerate(shape):
  3418. * if dim <= 0:
  3419. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
  3420. * self._shape[idx] = dim
  3421. *
  3422. */
  3423. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
  3424. __Pyx_GOTREF(__pyx_t_5);
  3425. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
  3426. __Pyx_GOTREF(__pyx_t_6);
  3427. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
  3428. __Pyx_GOTREF(__pyx_t_10);
  3429. __Pyx_GIVEREF(__pyx_t_5);
  3430. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  3431. __Pyx_GIVEREF(__pyx_t_6);
  3432. PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
  3433. __pyx_t_5 = 0;
  3434. __pyx_t_6 = 0;
  3435. __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
  3436. __Pyx_GOTREF(__pyx_t_6);
  3437. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3438. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
  3439. __Pyx_GOTREF(__pyx_t_10);
  3440. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3441. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3442. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3443. __PYX_ERR(2, 153, __pyx_L1_error)
  3444. /* "View.MemoryView":152
  3445. *
  3446. * for idx, dim in enumerate(shape):
  3447. * if dim <= 0: # <<<<<<<<<<<<<<
  3448. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3449. * self._shape[idx] = dim
  3450. */
  3451. }
  3452. /* "View.MemoryView":154
  3453. * if dim <= 0:
  3454. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3455. * self._shape[idx] = dim # <<<<<<<<<<<<<<
  3456. *
  3457. * cdef char order
  3458. */
  3459. (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
  3460. /* "View.MemoryView":151
  3461. *
  3462. *
  3463. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  3464. * if dim <= 0:
  3465. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3466. */
  3467. }
  3468. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3469. /* "View.MemoryView":157
  3470. *
  3471. * cdef char order
  3472. * if mode == 'fortran': # <<<<<<<<<<<<<<
  3473. * order = b'F'
  3474. * self.mode = u'fortran'
  3475. */
  3476. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
  3477. if (__pyx_t_4) {
  3478. /* "View.MemoryView":158
  3479. * cdef char order
  3480. * if mode == 'fortran':
  3481. * order = b'F' # <<<<<<<<<<<<<<
  3482. * self.mode = u'fortran'
  3483. * elif mode == 'c':
  3484. */
  3485. __pyx_v_order = 'F';
  3486. /* "View.MemoryView":159
  3487. * if mode == 'fortran':
  3488. * order = b'F'
  3489. * self.mode = u'fortran' # <<<<<<<<<<<<<<
  3490. * elif mode == 'c':
  3491. * order = b'C'
  3492. */
  3493. __Pyx_INCREF(__pyx_n_u_fortran);
  3494. __Pyx_GIVEREF(__pyx_n_u_fortran);
  3495. __Pyx_GOTREF(__pyx_v_self->mode);
  3496. __Pyx_DECREF(__pyx_v_self->mode);
  3497. __pyx_v_self->mode = __pyx_n_u_fortran;
  3498. /* "View.MemoryView":157
  3499. *
  3500. * cdef char order
  3501. * if mode == 'fortran': # <<<<<<<<<<<<<<
  3502. * order = b'F'
  3503. * self.mode = u'fortran'
  3504. */
  3505. goto __pyx_L10;
  3506. }
  3507. /* "View.MemoryView":160
  3508. * order = b'F'
  3509. * self.mode = u'fortran'
  3510. * elif mode == 'c': # <<<<<<<<<<<<<<
  3511. * order = b'C'
  3512. * self.mode = u'c'
  3513. */
  3514. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
  3515. if (likely(__pyx_t_4)) {
  3516. /* "View.MemoryView":161
  3517. * self.mode = u'fortran'
  3518. * elif mode == 'c':
  3519. * order = b'C' # <<<<<<<<<<<<<<
  3520. * self.mode = u'c'
  3521. * else:
  3522. */
  3523. __pyx_v_order = 'C';
  3524. /* "View.MemoryView":162
  3525. * elif mode == 'c':
  3526. * order = b'C'
  3527. * self.mode = u'c' # <<<<<<<<<<<<<<
  3528. * else:
  3529. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  3530. */
  3531. __Pyx_INCREF(__pyx_n_u_c);
  3532. __Pyx_GIVEREF(__pyx_n_u_c);
  3533. __Pyx_GOTREF(__pyx_v_self->mode);
  3534. __Pyx_DECREF(__pyx_v_self->mode);
  3535. __pyx_v_self->mode = __pyx_n_u_c;
  3536. /* "View.MemoryView":160
  3537. * order = b'F'
  3538. * self.mode = u'fortran'
  3539. * elif mode == 'c': # <<<<<<<<<<<<<<
  3540. * order = b'C'
  3541. * self.mode = u'c'
  3542. */
  3543. goto __pyx_L10;
  3544. }
  3545. /* "View.MemoryView":164
  3546. * self.mode = u'c'
  3547. * else:
  3548. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
  3549. *
  3550. * self.len = fill_contig_strides_array(self._shape, self._strides,
  3551. */
  3552. /*else*/ {
  3553. __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
  3554. __Pyx_GOTREF(__pyx_t_3);
  3555. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
  3556. __Pyx_GOTREF(__pyx_t_10);
  3557. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3558. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3559. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3560. __PYX_ERR(2, 164, __pyx_L1_error)
  3561. }
  3562. __pyx_L10:;
  3563. /* "View.MemoryView":166
  3564. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  3565. *
  3566. * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
  3567. * itemsize, self.ndim, order)
  3568. *
  3569. */
  3570. __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
  3571. /* "View.MemoryView":169
  3572. * itemsize, self.ndim, order)
  3573. *
  3574. * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
  3575. * self.dtype_is_object = format == b'O'
  3576. * if allocate_buffer:
  3577. */
  3578. __pyx_v_self->free_data = __pyx_v_allocate_buffer;
  3579. /* "View.MemoryView":170
  3580. *
  3581. * self.free_data = allocate_buffer
  3582. * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
  3583. * if allocate_buffer:
  3584. *
  3585. */
  3586. __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
  3587. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
  3588. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3589. __pyx_v_self->dtype_is_object = __pyx_t_4;
  3590. /* "View.MemoryView":171
  3591. * self.free_data = allocate_buffer
  3592. * self.dtype_is_object = format == b'O'
  3593. * if allocate_buffer: # <<<<<<<<<<<<<<
  3594. *
  3595. *
  3596. */
  3597. __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  3598. if (__pyx_t_4) {
  3599. /* "View.MemoryView":174
  3600. *
  3601. *
  3602. * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
  3603. * if not self.data:
  3604. * raise MemoryError("unable to allocate array data.")
  3605. */
  3606. __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
  3607. /* "View.MemoryView":175
  3608. *
  3609. * self.data = <char *>malloc(self.len)
  3610. * if not self.data: # <<<<<<<<<<<<<<
  3611. * raise MemoryError("unable to allocate array data.")
  3612. *
  3613. */
  3614. __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
  3615. if (unlikely(__pyx_t_4)) {
  3616. /* "View.MemoryView":176
  3617. * self.data = <char *>malloc(self.len)
  3618. * if not self.data:
  3619. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  3620. *
  3621. * if self.dtype_is_object:
  3622. */
  3623. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
  3624. __Pyx_GOTREF(__pyx_t_10);
  3625. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3626. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3627. __PYX_ERR(2, 176, __pyx_L1_error)
  3628. /* "View.MemoryView":175
  3629. *
  3630. * self.data = <char *>malloc(self.len)
  3631. * if not self.data: # <<<<<<<<<<<<<<
  3632. * raise MemoryError("unable to allocate array data.")
  3633. *
  3634. */
  3635. }
  3636. /* "View.MemoryView":178
  3637. * raise MemoryError("unable to allocate array data.")
  3638. *
  3639. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  3640. * p = <PyObject **> self.data
  3641. * for i in range(self.len / itemsize):
  3642. */
  3643. __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
  3644. if (__pyx_t_4) {
  3645. /* "View.MemoryView":179
  3646. *
  3647. * if self.dtype_is_object:
  3648. * p = <PyObject **> self.data # <<<<<<<<<<<<<<
  3649. * for i in range(self.len / itemsize):
  3650. * p[i] = Py_None
  3651. */
  3652. __pyx_v_p = ((PyObject **)__pyx_v_self->data);
  3653. /* "View.MemoryView":180
  3654. * if self.dtype_is_object:
  3655. * p = <PyObject **> self.data
  3656. * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
  3657. * p[i] = Py_None
  3658. * Py_INCREF(Py_None)
  3659. */
  3660. if (unlikely(__pyx_v_itemsize == 0)) {
  3661. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  3662. __PYX_ERR(2, 180, __pyx_L1_error)
  3663. }
  3664. else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
  3665. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  3666. __PYX_ERR(2, 180, __pyx_L1_error)
  3667. }
  3668. __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
  3669. __pyx_t_9 = __pyx_t_1;
  3670. for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
  3671. __pyx_v_i = __pyx_t_11;
  3672. /* "View.MemoryView":181
  3673. * p = <PyObject **> self.data
  3674. * for i in range(self.len / itemsize):
  3675. * p[i] = Py_None # <<<<<<<<<<<<<<
  3676. * Py_INCREF(Py_None)
  3677. *
  3678. */
  3679. (__pyx_v_p[__pyx_v_i]) = Py_None;
  3680. /* "View.MemoryView":182
  3681. * for i in range(self.len / itemsize):
  3682. * p[i] = Py_None
  3683. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  3684. *
  3685. * @cname('getbuffer')
  3686. */
  3687. Py_INCREF(Py_None);
  3688. }
  3689. /* "View.MemoryView":178
  3690. * raise MemoryError("unable to allocate array data.")
  3691. *
  3692. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  3693. * p = <PyObject **> self.data
  3694. * for i in range(self.len / itemsize):
  3695. */
  3696. }
  3697. /* "View.MemoryView":171
  3698. * self.free_data = allocate_buffer
  3699. * self.dtype_is_object = format == b'O'
  3700. * if allocate_buffer: # <<<<<<<<<<<<<<
  3701. *
  3702. *
  3703. */
  3704. }
  3705. /* "View.MemoryView":122
  3706. * cdef bint dtype_is_object
  3707. *
  3708. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3709. * mode="c", bint allocate_buffer=True):
  3710. *
  3711. */
  3712. /* function exit code */
  3713. __pyx_r = 0;
  3714. goto __pyx_L0;
  3715. __pyx_L1_error:;
  3716. __Pyx_XDECREF(__pyx_t_3);
  3717. __Pyx_XDECREF(__pyx_t_5);
  3718. __Pyx_XDECREF(__pyx_t_6);
  3719. __Pyx_XDECREF(__pyx_t_10);
  3720. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3721. __pyx_r = -1;
  3722. __pyx_L0:;
  3723. __Pyx_XDECREF(__pyx_v_format);
  3724. __Pyx_RefNannyFinishContext();
  3725. return __pyx_r;
  3726. }
  3727. /* "View.MemoryView":185
  3728. *
  3729. * @cname('getbuffer')
  3730. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  3731. * cdef int bufmode = -1
  3732. * if self.mode == u"c":
  3733. */
  3734. /* Python wrapper */
  3735. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  3736. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3737. int __pyx_r;
  3738. __Pyx_RefNannyDeclarations
  3739. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  3740. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  3741. /* function exit code */
  3742. __Pyx_RefNannyFinishContext();
  3743. return __pyx_r;
  3744. }
  3745. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3746. int __pyx_v_bufmode;
  3747. int __pyx_r;
  3748. __Pyx_RefNannyDeclarations
  3749. int __pyx_t_1;
  3750. int __pyx_t_2;
  3751. PyObject *__pyx_t_3 = NULL;
  3752. char *__pyx_t_4;
  3753. Py_ssize_t __pyx_t_5;
  3754. int __pyx_t_6;
  3755. Py_ssize_t *__pyx_t_7;
  3756. int __pyx_lineno = 0;
  3757. const char *__pyx_filename = NULL;
  3758. int __pyx_clineno = 0;
  3759. if (__pyx_v_info == NULL) {
  3760. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  3761. return -1;
  3762. }
  3763. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  3764. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  3765. __Pyx_GIVEREF(__pyx_v_info->obj);
  3766. /* "View.MemoryView":186
  3767. * @cname('getbuffer')
  3768. * def __getbuffer__(self, Py_buffer *info, int flags):
  3769. * cdef int bufmode = -1 # <<<<<<<<<<<<<<
  3770. * if self.mode == u"c":
  3771. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3772. */
  3773. __pyx_v_bufmode = -1;
  3774. /* "View.MemoryView":187
  3775. * def __getbuffer__(self, Py_buffer *info, int flags):
  3776. * cdef int bufmode = -1
  3777. * if self.mode == u"c": # <<<<<<<<<<<<<<
  3778. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3779. * elif self.mode == u"fortran":
  3780. */
  3781. __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
  3782. __pyx_t_2 = (__pyx_t_1 != 0);
  3783. if (__pyx_t_2) {
  3784. /* "View.MemoryView":188
  3785. * cdef int bufmode = -1
  3786. * if self.mode == u"c":
  3787. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  3788. * elif self.mode == u"fortran":
  3789. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3790. */
  3791. __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  3792. /* "View.MemoryView":187
  3793. * def __getbuffer__(self, Py_buffer *info, int flags):
  3794. * cdef int bufmode = -1
  3795. * if self.mode == u"c": # <<<<<<<<<<<<<<
  3796. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3797. * elif self.mode == u"fortran":
  3798. */
  3799. goto __pyx_L3;
  3800. }
  3801. /* "View.MemoryView":189
  3802. * if self.mode == u"c":
  3803. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3804. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  3805. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3806. * if not (flags & bufmode):
  3807. */
  3808. __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
  3809. __pyx_t_1 = (__pyx_t_2 != 0);
  3810. if (__pyx_t_1) {
  3811. /* "View.MemoryView":190
  3812. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3813. * elif self.mode == u"fortran":
  3814. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  3815. * if not (flags & bufmode):
  3816. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  3817. */
  3818. __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  3819. /* "View.MemoryView":189
  3820. * if self.mode == u"c":
  3821. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3822. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  3823. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3824. * if not (flags & bufmode):
  3825. */
  3826. }
  3827. __pyx_L3:;
  3828. /* "View.MemoryView":191
  3829. * elif self.mode == u"fortran":
  3830. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3831. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  3832. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  3833. * info.buf = self.data
  3834. */
  3835. __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  3836. if (unlikely(__pyx_t_1)) {
  3837. /* "View.MemoryView":192
  3838. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3839. * if not (flags & bufmode):
  3840. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  3841. * info.buf = self.data
  3842. * info.len = self.len
  3843. */
  3844. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
  3845. __Pyx_GOTREF(__pyx_t_3);
  3846. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3847. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3848. __PYX_ERR(2, 192, __pyx_L1_error)
  3849. /* "View.MemoryView":191
  3850. * elif self.mode == u"fortran":
  3851. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  3852. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  3853. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  3854. * info.buf = self.data
  3855. */
  3856. }
  3857. /* "View.MemoryView":193
  3858. * if not (flags & bufmode):
  3859. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  3860. * info.buf = self.data # <<<<<<<<<<<<<<
  3861. * info.len = self.len
  3862. * info.ndim = self.ndim
  3863. */
  3864. __pyx_t_4 = __pyx_v_self->data;
  3865. __pyx_v_info->buf = __pyx_t_4;
  3866. /* "View.MemoryView":194
  3867. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  3868. * info.buf = self.data
  3869. * info.len = self.len # <<<<<<<<<<<<<<
  3870. * info.ndim = self.ndim
  3871. * info.shape = self._shape
  3872. */
  3873. __pyx_t_5 = __pyx_v_self->len;
  3874. __pyx_v_info->len = __pyx_t_5;
  3875. /* "View.MemoryView":195
  3876. * info.buf = self.data
  3877. * info.len = self.len
  3878. * info.ndim = self.ndim # <<<<<<<<<<<<<<
  3879. * info.shape = self._shape
  3880. * info.strides = self._strides
  3881. */
  3882. __pyx_t_6 = __pyx_v_self->ndim;
  3883. __pyx_v_info->ndim = __pyx_t_6;
  3884. /* "View.MemoryView":196
  3885. * info.len = self.len
  3886. * info.ndim = self.ndim
  3887. * info.shape = self._shape # <<<<<<<<<<<<<<
  3888. * info.strides = self._strides
  3889. * info.suboffsets = NULL
  3890. */
  3891. __pyx_t_7 = __pyx_v_self->_shape;
  3892. __pyx_v_info->shape = __pyx_t_7;
  3893. /* "View.MemoryView":197
  3894. * info.ndim = self.ndim
  3895. * info.shape = self._shape
  3896. * info.strides = self._strides # <<<<<<<<<<<<<<
  3897. * info.suboffsets = NULL
  3898. * info.itemsize = self.itemsize
  3899. */
  3900. __pyx_t_7 = __pyx_v_self->_strides;
  3901. __pyx_v_info->strides = __pyx_t_7;
  3902. /* "View.MemoryView":198
  3903. * info.shape = self._shape
  3904. * info.strides = self._strides
  3905. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  3906. * info.itemsize = self.itemsize
  3907. * info.readonly = 0
  3908. */
  3909. __pyx_v_info->suboffsets = NULL;
  3910. /* "View.MemoryView":199
  3911. * info.strides = self._strides
  3912. * info.suboffsets = NULL
  3913. * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
  3914. * info.readonly = 0
  3915. *
  3916. */
  3917. __pyx_t_5 = __pyx_v_self->itemsize;
  3918. __pyx_v_info->itemsize = __pyx_t_5;
  3919. /* "View.MemoryView":200
  3920. * info.suboffsets = NULL
  3921. * info.itemsize = self.itemsize
  3922. * info.readonly = 0 # <<<<<<<<<<<<<<
  3923. *
  3924. * if flags & PyBUF_FORMAT:
  3925. */
  3926. __pyx_v_info->readonly = 0;
  3927. /* "View.MemoryView":202
  3928. * info.readonly = 0
  3929. *
  3930. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  3931. * info.format = self.format
  3932. * else:
  3933. */
  3934. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  3935. if (__pyx_t_1) {
  3936. /* "View.MemoryView":203
  3937. *
  3938. * if flags & PyBUF_FORMAT:
  3939. * info.format = self.format # <<<<<<<<<<<<<<
  3940. * else:
  3941. * info.format = NULL
  3942. */
  3943. __pyx_t_4 = __pyx_v_self->format;
  3944. __pyx_v_info->format = __pyx_t_4;
  3945. /* "View.MemoryView":202
  3946. * info.readonly = 0
  3947. *
  3948. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  3949. * info.format = self.format
  3950. * else:
  3951. */
  3952. goto __pyx_L5;
  3953. }
  3954. /* "View.MemoryView":205
  3955. * info.format = self.format
  3956. * else:
  3957. * info.format = NULL # <<<<<<<<<<<<<<
  3958. *
  3959. * info.obj = self
  3960. */
  3961. /*else*/ {
  3962. __pyx_v_info->format = NULL;
  3963. }
  3964. __pyx_L5:;
  3965. /* "View.MemoryView":207
  3966. * info.format = NULL
  3967. *
  3968. * info.obj = self # <<<<<<<<<<<<<<
  3969. *
  3970. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  3971. */
  3972. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  3973. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  3974. __Pyx_GOTREF(__pyx_v_info->obj);
  3975. __Pyx_DECREF(__pyx_v_info->obj);
  3976. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  3977. /* "View.MemoryView":185
  3978. *
  3979. * @cname('getbuffer')
  3980. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  3981. * cdef int bufmode = -1
  3982. * if self.mode == u"c":
  3983. */
  3984. /* function exit code */
  3985. __pyx_r = 0;
  3986. goto __pyx_L0;
  3987. __pyx_L1_error:;
  3988. __Pyx_XDECREF(__pyx_t_3);
  3989. __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3990. __pyx_r = -1;
  3991. if (__pyx_v_info->obj != NULL) {
  3992. __Pyx_GOTREF(__pyx_v_info->obj);
  3993. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  3994. }
  3995. goto __pyx_L2;
  3996. __pyx_L0:;
  3997. if (__pyx_v_info->obj == Py_None) {
  3998. __Pyx_GOTREF(__pyx_v_info->obj);
  3999. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  4000. }
  4001. __pyx_L2:;
  4002. __Pyx_RefNannyFinishContext();
  4003. return __pyx_r;
  4004. }
  4005. /* "View.MemoryView":211
  4006. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  4007. *
  4008. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  4009. * if self.callback_free_data != NULL:
  4010. * self.callback_free_data(self.data)
  4011. */
  4012. /* Python wrapper */
  4013. static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
  4014. static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  4015. __Pyx_RefNannyDeclarations
  4016. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  4017. __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
  4018. /* function exit code */
  4019. __Pyx_RefNannyFinishContext();
  4020. }
  4021. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  4022. __Pyx_RefNannyDeclarations
  4023. int __pyx_t_1;
  4024. __Pyx_RefNannySetupContext("__dealloc__", 0);
  4025. /* "View.MemoryView":212
  4026. *
  4027. * def __dealloc__(array self):
  4028. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  4029. * self.callback_free_data(self.data)
  4030. * elif self.free_data:
  4031. */
  4032. __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  4033. if (__pyx_t_1) {
  4034. /* "View.MemoryView":213
  4035. * def __dealloc__(array self):
  4036. * if self.callback_free_data != NULL:
  4037. * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
  4038. * elif self.free_data:
  4039. * if self.dtype_is_object:
  4040. */
  4041. __pyx_v_self->callback_free_data(__pyx_v_self->data);
  4042. /* "View.MemoryView":212
  4043. *
  4044. * def __dealloc__(array self):
  4045. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  4046. * self.callback_free_data(self.data)
  4047. * elif self.free_data:
  4048. */
  4049. goto __pyx_L3;
  4050. }
  4051. /* "View.MemoryView":214
  4052. * if self.callback_free_data != NULL:
  4053. * self.callback_free_data(self.data)
  4054. * elif self.free_data: # <<<<<<<<<<<<<<
  4055. * if self.dtype_is_object:
  4056. * refcount_objects_in_slice(self.data, self._shape,
  4057. */
  4058. __pyx_t_1 = (__pyx_v_self->free_data != 0);
  4059. if (__pyx_t_1) {
  4060. /* "View.MemoryView":215
  4061. * self.callback_free_data(self.data)
  4062. * elif self.free_data:
  4063. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  4064. * refcount_objects_in_slice(self.data, self._shape,
  4065. * self._strides, self.ndim, False)
  4066. */
  4067. __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
  4068. if (__pyx_t_1) {
  4069. /* "View.MemoryView":216
  4070. * elif self.free_data:
  4071. * if self.dtype_is_object:
  4072. * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
  4073. * self._strides, self.ndim, False)
  4074. * free(self.data)
  4075. */
  4076. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
  4077. /* "View.MemoryView":215
  4078. * self.callback_free_data(self.data)
  4079. * elif self.free_data:
  4080. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  4081. * refcount_objects_in_slice(self.data, self._shape,
  4082. * self._strides, self.ndim, False)
  4083. */
  4084. }
  4085. /* "View.MemoryView":218
  4086. * refcount_objects_in_slice(self.data, self._shape,
  4087. * self._strides, self.ndim, False)
  4088. * free(self.data) # <<<<<<<<<<<<<<
  4089. * PyObject_Free(self._shape)
  4090. *
  4091. */
  4092. free(__pyx_v_self->data);
  4093. /* "View.MemoryView":214
  4094. * if self.callback_free_data != NULL:
  4095. * self.callback_free_data(self.data)
  4096. * elif self.free_data: # <<<<<<<<<<<<<<
  4097. * if self.dtype_is_object:
  4098. * refcount_objects_in_slice(self.data, self._shape,
  4099. */
  4100. }
  4101. __pyx_L3:;
  4102. /* "View.MemoryView":219
  4103. * self._strides, self.ndim, False)
  4104. * free(self.data)
  4105. * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
  4106. *
  4107. * @property
  4108. */
  4109. PyObject_Free(__pyx_v_self->_shape);
  4110. /* "View.MemoryView":211
  4111. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  4112. *
  4113. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  4114. * if self.callback_free_data != NULL:
  4115. * self.callback_free_data(self.data)
  4116. */
  4117. /* function exit code */
  4118. __Pyx_RefNannyFinishContext();
  4119. }
  4120. /* "View.MemoryView":222
  4121. *
  4122. * @property
  4123. * def memview(self): # <<<<<<<<<<<<<<
  4124. * return self.get_memview()
  4125. *
  4126. */
  4127. /* Python wrapper */
  4128. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
  4129. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  4130. PyObject *__pyx_r = 0;
  4131. __Pyx_RefNannyDeclarations
  4132. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  4133. __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
  4134. /* function exit code */
  4135. __Pyx_RefNannyFinishContext();
  4136. return __pyx_r;
  4137. }
  4138. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  4139. PyObject *__pyx_r = NULL;
  4140. __Pyx_RefNannyDeclarations
  4141. PyObject *__pyx_t_1 = NULL;
  4142. int __pyx_lineno = 0;
  4143. const char *__pyx_filename = NULL;
  4144. int __pyx_clineno = 0;
  4145. __Pyx_RefNannySetupContext("__get__", 0);
  4146. /* "View.MemoryView":223
  4147. * @property
  4148. * def memview(self):
  4149. * return self.get_memview() # <<<<<<<<<<<<<<
  4150. *
  4151. * @cname('get_memview')
  4152. */
  4153. __Pyx_XDECREF(__pyx_r);
  4154. __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
  4155. __Pyx_GOTREF(__pyx_t_1);
  4156. __pyx_r = __pyx_t_1;
  4157. __pyx_t_1 = 0;
  4158. goto __pyx_L0;
  4159. /* "View.MemoryView":222
  4160. *
  4161. * @property
  4162. * def memview(self): # <<<<<<<<<<<<<<
  4163. * return self.get_memview()
  4164. *
  4165. */
  4166. /* function exit code */
  4167. __pyx_L1_error:;
  4168. __Pyx_XDECREF(__pyx_t_1);
  4169. __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4170. __pyx_r = NULL;
  4171. __pyx_L0:;
  4172. __Pyx_XGIVEREF(__pyx_r);
  4173. __Pyx_RefNannyFinishContext();
  4174. return __pyx_r;
  4175. }
  4176. /* "View.MemoryView":226
  4177. *
  4178. * @cname('get_memview')
  4179. * cdef get_memview(self): # <<<<<<<<<<<<<<
  4180. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4181. * return memoryview(self, flags, self.dtype_is_object)
  4182. */
  4183. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  4184. int __pyx_v_flags;
  4185. PyObject *__pyx_r = NULL;
  4186. __Pyx_RefNannyDeclarations
  4187. PyObject *__pyx_t_1 = NULL;
  4188. PyObject *__pyx_t_2 = NULL;
  4189. PyObject *__pyx_t_3 = NULL;
  4190. int __pyx_lineno = 0;
  4191. const char *__pyx_filename = NULL;
  4192. int __pyx_clineno = 0;
  4193. __Pyx_RefNannySetupContext("get_memview", 0);
  4194. /* "View.MemoryView":227
  4195. * @cname('get_memview')
  4196. * cdef get_memview(self):
  4197. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
  4198. * return memoryview(self, flags, self.dtype_is_object)
  4199. *
  4200. */
  4201. __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
  4202. /* "View.MemoryView":228
  4203. * cdef get_memview(self):
  4204. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4205. * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
  4206. *
  4207. * def __len__(self):
  4208. */
  4209. __Pyx_XDECREF(__pyx_r);
  4210. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
  4211. __Pyx_GOTREF(__pyx_t_1);
  4212. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
  4213. __Pyx_GOTREF(__pyx_t_2);
  4214. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
  4215. __Pyx_GOTREF(__pyx_t_3);
  4216. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  4217. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  4218. PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  4219. __Pyx_GIVEREF(__pyx_t_1);
  4220. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  4221. __Pyx_GIVEREF(__pyx_t_2);
  4222. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  4223. __pyx_t_1 = 0;
  4224. __pyx_t_2 = 0;
  4225. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
  4226. __Pyx_GOTREF(__pyx_t_2);
  4227. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4228. __pyx_r = __pyx_t_2;
  4229. __pyx_t_2 = 0;
  4230. goto __pyx_L0;
  4231. /* "View.MemoryView":226
  4232. *
  4233. * @cname('get_memview')
  4234. * cdef get_memview(self): # <<<<<<<<<<<<<<
  4235. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4236. * return memoryview(self, flags, self.dtype_is_object)
  4237. */
  4238. /* function exit code */
  4239. __pyx_L1_error:;
  4240. __Pyx_XDECREF(__pyx_t_1);
  4241. __Pyx_XDECREF(__pyx_t_2);
  4242. __Pyx_XDECREF(__pyx_t_3);
  4243. __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4244. __pyx_r = 0;
  4245. __pyx_L0:;
  4246. __Pyx_XGIVEREF(__pyx_r);
  4247. __Pyx_RefNannyFinishContext();
  4248. return __pyx_r;
  4249. }
  4250. /* "View.MemoryView":230
  4251. * return memoryview(self, flags, self.dtype_is_object)
  4252. *
  4253. * def __len__(self): # <<<<<<<<<<<<<<
  4254. * return self._shape[0]
  4255. *
  4256. */
  4257. /* Python wrapper */
  4258. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
  4259. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  4260. Py_ssize_t __pyx_r;
  4261. __Pyx_RefNannyDeclarations
  4262. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  4263. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
  4264. /* function exit code */
  4265. __Pyx_RefNannyFinishContext();
  4266. return __pyx_r;
  4267. }
  4268. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  4269. Py_ssize_t __pyx_r;
  4270. __Pyx_RefNannyDeclarations
  4271. __Pyx_RefNannySetupContext("__len__", 0);
  4272. /* "View.MemoryView":231
  4273. *
  4274. * def __len__(self):
  4275. * return self._shape[0] # <<<<<<<<<<<<<<
  4276. *
  4277. * def __getattr__(self, attr):
  4278. */
  4279. __pyx_r = (__pyx_v_self->_shape[0]);
  4280. goto __pyx_L0;
  4281. /* "View.MemoryView":230
  4282. * return memoryview(self, flags, self.dtype_is_object)
  4283. *
  4284. * def __len__(self): # <<<<<<<<<<<<<<
  4285. * return self._shape[0]
  4286. *
  4287. */
  4288. /* function exit code */
  4289. __pyx_L0:;
  4290. __Pyx_RefNannyFinishContext();
  4291. return __pyx_r;
  4292. }
  4293. /* "View.MemoryView":233
  4294. * return self._shape[0]
  4295. *
  4296. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  4297. * return getattr(self.memview, attr)
  4298. *
  4299. */
  4300. /* Python wrapper */
  4301. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
  4302. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  4303. PyObject *__pyx_r = 0;
  4304. __Pyx_RefNannyDeclarations
  4305. __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  4306. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
  4307. /* function exit code */
  4308. __Pyx_RefNannyFinishContext();
  4309. return __pyx_r;
  4310. }
  4311. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  4312. PyObject *__pyx_r = NULL;
  4313. __Pyx_RefNannyDeclarations
  4314. PyObject *__pyx_t_1 = NULL;
  4315. PyObject *__pyx_t_2 = NULL;
  4316. int __pyx_lineno = 0;
  4317. const char *__pyx_filename = NULL;
  4318. int __pyx_clineno = 0;
  4319. __Pyx_RefNannySetupContext("__getattr__", 0);
  4320. /* "View.MemoryView":234
  4321. *
  4322. * def __getattr__(self, attr):
  4323. * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
  4324. *
  4325. * def __getitem__(self, item):
  4326. */
  4327. __Pyx_XDECREF(__pyx_r);
  4328. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
  4329. __Pyx_GOTREF(__pyx_t_1);
  4330. __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
  4331. __Pyx_GOTREF(__pyx_t_2);
  4332. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4333. __pyx_r = __pyx_t_2;
  4334. __pyx_t_2 = 0;
  4335. goto __pyx_L0;
  4336. /* "View.MemoryView":233
  4337. * return self._shape[0]
  4338. *
  4339. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  4340. * return getattr(self.memview, attr)
  4341. *
  4342. */
  4343. /* function exit code */
  4344. __pyx_L1_error:;
  4345. __Pyx_XDECREF(__pyx_t_1);
  4346. __Pyx_XDECREF(__pyx_t_2);
  4347. __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4348. __pyx_r = NULL;
  4349. __pyx_L0:;
  4350. __Pyx_XGIVEREF(__pyx_r);
  4351. __Pyx_RefNannyFinishContext();
  4352. return __pyx_r;
  4353. }
  4354. /* "View.MemoryView":236
  4355. * return getattr(self.memview, attr)
  4356. *
  4357. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  4358. * return self.memview[item]
  4359. *
  4360. */
  4361. /* Python wrapper */
  4362. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  4363. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  4364. PyObject *__pyx_r = 0;
  4365. __Pyx_RefNannyDeclarations
  4366. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  4367. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  4368. /* function exit code */
  4369. __Pyx_RefNannyFinishContext();
  4370. return __pyx_r;
  4371. }
  4372. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  4373. PyObject *__pyx_r = NULL;
  4374. __Pyx_RefNannyDeclarations
  4375. PyObject *__pyx_t_1 = NULL;
  4376. PyObject *__pyx_t_2 = NULL;
  4377. int __pyx_lineno = 0;
  4378. const char *__pyx_filename = NULL;
  4379. int __pyx_clineno = 0;
  4380. __Pyx_RefNannySetupContext("__getitem__", 0);
  4381. /* "View.MemoryView":237
  4382. *
  4383. * def __getitem__(self, item):
  4384. * return self.memview[item] # <<<<<<<<<<<<<<
  4385. *
  4386. * def __setitem__(self, item, value):
  4387. */
  4388. __Pyx_XDECREF(__pyx_r);
  4389. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
  4390. __Pyx_GOTREF(__pyx_t_1);
  4391. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
  4392. __Pyx_GOTREF(__pyx_t_2);
  4393. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4394. __pyx_r = __pyx_t_2;
  4395. __pyx_t_2 = 0;
  4396. goto __pyx_L0;
  4397. /* "View.MemoryView":236
  4398. * return getattr(self.memview, attr)
  4399. *
  4400. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  4401. * return self.memview[item]
  4402. *
  4403. */
  4404. /* function exit code */
  4405. __pyx_L1_error:;
  4406. __Pyx_XDECREF(__pyx_t_1);
  4407. __Pyx_XDECREF(__pyx_t_2);
  4408. __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4409. __pyx_r = NULL;
  4410. __pyx_L0:;
  4411. __Pyx_XGIVEREF(__pyx_r);
  4412. __Pyx_RefNannyFinishContext();
  4413. return __pyx_r;
  4414. }
  4415. /* "View.MemoryView":239
  4416. * return self.memview[item]
  4417. *
  4418. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  4419. * self.memview[item] = value
  4420. *
  4421. */
  4422. /* Python wrapper */
  4423. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
  4424. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  4425. int __pyx_r;
  4426. __Pyx_RefNannyDeclarations
  4427. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  4428. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
  4429. /* function exit code */
  4430. __Pyx_RefNannyFinishContext();
  4431. return __pyx_r;
  4432. }
  4433. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  4434. int __pyx_r;
  4435. __Pyx_RefNannyDeclarations
  4436. PyObject *__pyx_t_1 = NULL;
  4437. int __pyx_lineno = 0;
  4438. const char *__pyx_filename = NULL;
  4439. int __pyx_clineno = 0;
  4440. __Pyx_RefNannySetupContext("__setitem__", 0);
  4441. /* "View.MemoryView":240
  4442. *
  4443. * def __setitem__(self, item, value):
  4444. * self.memview[item] = value # <<<<<<<<<<<<<<
  4445. *
  4446. *
  4447. */
  4448. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
  4449. __Pyx_GOTREF(__pyx_t_1);
  4450. if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
  4451. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4452. /* "View.MemoryView":239
  4453. * return self.memview[item]
  4454. *
  4455. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  4456. * self.memview[item] = value
  4457. *
  4458. */
  4459. /* function exit code */
  4460. __pyx_r = 0;
  4461. goto __pyx_L0;
  4462. __pyx_L1_error:;
  4463. __Pyx_XDECREF(__pyx_t_1);
  4464. __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4465. __pyx_r = -1;
  4466. __pyx_L0:;
  4467. __Pyx_RefNannyFinishContext();
  4468. return __pyx_r;
  4469. }
  4470. /* "(tree fragment)":1
  4471. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  4472. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4473. * def __setstate_cython__(self, __pyx_state):
  4474. */
  4475. /* Python wrapper */
  4476. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4477. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4478. PyObject *__pyx_r = 0;
  4479. __Pyx_RefNannyDeclarations
  4480. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  4481. __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
  4482. /* function exit code */
  4483. __Pyx_RefNannyFinishContext();
  4484. return __pyx_r;
  4485. }
  4486. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  4487. PyObject *__pyx_r = NULL;
  4488. __Pyx_RefNannyDeclarations
  4489. PyObject *__pyx_t_1 = NULL;
  4490. int __pyx_lineno = 0;
  4491. const char *__pyx_filename = NULL;
  4492. int __pyx_clineno = 0;
  4493. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  4494. /* "(tree fragment)":2
  4495. * def __reduce_cython__(self):
  4496. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  4497. * def __setstate_cython__(self, __pyx_state):
  4498. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4499. */
  4500. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  4501. __Pyx_GOTREF(__pyx_t_1);
  4502. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4503. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4504. __PYX_ERR(2, 2, __pyx_L1_error)
  4505. /* "(tree fragment)":1
  4506. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  4507. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4508. * def __setstate_cython__(self, __pyx_state):
  4509. */
  4510. /* function exit code */
  4511. __pyx_L1_error:;
  4512. __Pyx_XDECREF(__pyx_t_1);
  4513. __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4514. __pyx_r = NULL;
  4515. __Pyx_XGIVEREF(__pyx_r);
  4516. __Pyx_RefNannyFinishContext();
  4517. return __pyx_r;
  4518. }
  4519. /* "(tree fragment)":3
  4520. * def __reduce_cython__(self):
  4521. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4522. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  4523. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4524. */
  4525. /* Python wrapper */
  4526. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  4527. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  4528. PyObject *__pyx_r = 0;
  4529. __Pyx_RefNannyDeclarations
  4530. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  4531. __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  4532. /* function exit code */
  4533. __Pyx_RefNannyFinishContext();
  4534. return __pyx_r;
  4535. }
  4536. static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  4537. PyObject *__pyx_r = NULL;
  4538. __Pyx_RefNannyDeclarations
  4539. PyObject *__pyx_t_1 = NULL;
  4540. int __pyx_lineno = 0;
  4541. const char *__pyx_filename = NULL;
  4542. int __pyx_clineno = 0;
  4543. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  4544. /* "(tree fragment)":4
  4545. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4546. * def __setstate_cython__(self, __pyx_state):
  4547. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  4548. */
  4549. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  4550. __Pyx_GOTREF(__pyx_t_1);
  4551. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4552. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4553. __PYX_ERR(2, 4, __pyx_L1_error)
  4554. /* "(tree fragment)":3
  4555. * def __reduce_cython__(self):
  4556. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4557. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  4558. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4559. */
  4560. /* function exit code */
  4561. __pyx_L1_error:;
  4562. __Pyx_XDECREF(__pyx_t_1);
  4563. __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4564. __pyx_r = NULL;
  4565. __Pyx_XGIVEREF(__pyx_r);
  4566. __Pyx_RefNannyFinishContext();
  4567. return __pyx_r;
  4568. }
  4569. /* "View.MemoryView":244
  4570. *
  4571. * @cname("__pyx_array_new")
  4572. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  4573. * char *mode, char *buf):
  4574. * cdef array result
  4575. */
  4576. static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
  4577. struct __pyx_array_obj *__pyx_v_result = 0;
  4578. struct __pyx_array_obj *__pyx_r = NULL;
  4579. __Pyx_RefNannyDeclarations
  4580. int __pyx_t_1;
  4581. PyObject *__pyx_t_2 = NULL;
  4582. PyObject *__pyx_t_3 = NULL;
  4583. PyObject *__pyx_t_4 = NULL;
  4584. PyObject *__pyx_t_5 = NULL;
  4585. int __pyx_lineno = 0;
  4586. const char *__pyx_filename = NULL;
  4587. int __pyx_clineno = 0;
  4588. __Pyx_RefNannySetupContext("array_cwrapper", 0);
  4589. /* "View.MemoryView":248
  4590. * cdef array result
  4591. *
  4592. * if buf == NULL: # <<<<<<<<<<<<<<
  4593. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4594. * else:
  4595. */
  4596. __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  4597. if (__pyx_t_1) {
  4598. /* "View.MemoryView":249
  4599. *
  4600. * if buf == NULL:
  4601. * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
  4602. * else:
  4603. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4604. */
  4605. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
  4606. __Pyx_GOTREF(__pyx_t_2);
  4607. __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
  4608. __Pyx_GOTREF(__pyx_t_3);
  4609. __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
  4610. __Pyx_GOTREF(__pyx_t_4);
  4611. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
  4612. __Pyx_GOTREF(__pyx_t_5);
  4613. __Pyx_INCREF(__pyx_v_shape);
  4614. __Pyx_GIVEREF(__pyx_v_shape);
  4615. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
  4616. __Pyx_GIVEREF(__pyx_t_2);
  4617. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  4618. __Pyx_GIVEREF(__pyx_t_3);
  4619. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  4620. __Pyx_GIVEREF(__pyx_t_4);
  4621. PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  4622. __pyx_t_2 = 0;
  4623. __pyx_t_3 = 0;
  4624. __pyx_t_4 = 0;
  4625. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
  4626. __Pyx_GOTREF(__pyx_t_4);
  4627. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4628. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
  4629. __pyx_t_4 = 0;
  4630. /* "View.MemoryView":248
  4631. * cdef array result
  4632. *
  4633. * if buf == NULL: # <<<<<<<<<<<<<<
  4634. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4635. * else:
  4636. */
  4637. goto __pyx_L3;
  4638. }
  4639. /* "View.MemoryView":251
  4640. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4641. * else:
  4642. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  4643. * allocate_buffer=False)
  4644. * result.data = buf
  4645. */
  4646. /*else*/ {
  4647. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
  4648. __Pyx_GOTREF(__pyx_t_4);
  4649. __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
  4650. __Pyx_GOTREF(__pyx_t_5);
  4651. __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
  4652. __Pyx_GOTREF(__pyx_t_3);
  4653. __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
  4654. __Pyx_GOTREF(__pyx_t_2);
  4655. __Pyx_INCREF(__pyx_v_shape);
  4656. __Pyx_GIVEREF(__pyx_v_shape);
  4657. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
  4658. __Pyx_GIVEREF(__pyx_t_4);
  4659. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  4660. __Pyx_GIVEREF(__pyx_t_5);
  4661. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
  4662. __Pyx_GIVEREF(__pyx_t_3);
  4663. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
  4664. __pyx_t_4 = 0;
  4665. __pyx_t_5 = 0;
  4666. __pyx_t_3 = 0;
  4667. /* "View.MemoryView":252
  4668. * else:
  4669. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4670. * allocate_buffer=False) # <<<<<<<<<<<<<<
  4671. * result.data = buf
  4672. *
  4673. */
  4674. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
  4675. __Pyx_GOTREF(__pyx_t_3);
  4676. if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
  4677. /* "View.MemoryView":251
  4678. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4679. * else:
  4680. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  4681. * allocate_buffer=False)
  4682. * result.data = buf
  4683. */
  4684. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
  4685. __Pyx_GOTREF(__pyx_t_5);
  4686. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4687. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4688. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
  4689. __pyx_t_5 = 0;
  4690. /* "View.MemoryView":253
  4691. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4692. * allocate_buffer=False)
  4693. * result.data = buf # <<<<<<<<<<<<<<
  4694. *
  4695. * return result
  4696. */
  4697. __pyx_v_result->data = __pyx_v_buf;
  4698. }
  4699. __pyx_L3:;
  4700. /* "View.MemoryView":255
  4701. * result.data = buf
  4702. *
  4703. * return result # <<<<<<<<<<<<<<
  4704. *
  4705. *
  4706. */
  4707. __Pyx_XDECREF(((PyObject *)__pyx_r));
  4708. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  4709. __pyx_r = __pyx_v_result;
  4710. goto __pyx_L0;
  4711. /* "View.MemoryView":244
  4712. *
  4713. * @cname("__pyx_array_new")
  4714. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  4715. * char *mode, char *buf):
  4716. * cdef array result
  4717. */
  4718. /* function exit code */
  4719. __pyx_L1_error:;
  4720. __Pyx_XDECREF(__pyx_t_2);
  4721. __Pyx_XDECREF(__pyx_t_3);
  4722. __Pyx_XDECREF(__pyx_t_4);
  4723. __Pyx_XDECREF(__pyx_t_5);
  4724. __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4725. __pyx_r = 0;
  4726. __pyx_L0:;
  4727. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  4728. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  4729. __Pyx_RefNannyFinishContext();
  4730. return __pyx_r;
  4731. }
  4732. /* "View.MemoryView":281
  4733. * cdef class Enum(object):
  4734. * cdef object name
  4735. * def __init__(self, name): # <<<<<<<<<<<<<<
  4736. * self.name = name
  4737. * def __repr__(self):
  4738. */
  4739. /* Python wrapper */
  4740. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4741. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4742. PyObject *__pyx_v_name = 0;
  4743. int __pyx_lineno = 0;
  4744. const char *__pyx_filename = NULL;
  4745. int __pyx_clineno = 0;
  4746. int __pyx_r;
  4747. __Pyx_RefNannyDeclarations
  4748. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  4749. {
  4750. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
  4751. PyObject* values[1] = {0};
  4752. if (unlikely(__pyx_kwds)) {
  4753. Py_ssize_t kw_args;
  4754. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  4755. switch (pos_args) {
  4756. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4757. CYTHON_FALLTHROUGH;
  4758. case 0: break;
  4759. default: goto __pyx_L5_argtuple_error;
  4760. }
  4761. kw_args = PyDict_Size(__pyx_kwds);
  4762. switch (pos_args) {
  4763. case 0:
  4764. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
  4765. else goto __pyx_L5_argtuple_error;
  4766. }
  4767. if (unlikely(kw_args > 0)) {
  4768. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
  4769. }
  4770. } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
  4771. goto __pyx_L5_argtuple_error;
  4772. } else {
  4773. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4774. }
  4775. __pyx_v_name = values[0];
  4776. }
  4777. goto __pyx_L4_argument_unpacking_done;
  4778. __pyx_L5_argtuple_error:;
  4779. __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
  4780. __pyx_L3_error:;
  4781. __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4782. __Pyx_RefNannyFinishContext();
  4783. return -1;
  4784. __pyx_L4_argument_unpacking_done:;
  4785. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
  4786. /* function exit code */
  4787. __Pyx_RefNannyFinishContext();
  4788. return __pyx_r;
  4789. }
  4790. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  4791. int __pyx_r;
  4792. __Pyx_RefNannyDeclarations
  4793. __Pyx_RefNannySetupContext("__init__", 0);
  4794. /* "View.MemoryView":282
  4795. * cdef object name
  4796. * def __init__(self, name):
  4797. * self.name = name # <<<<<<<<<<<<<<
  4798. * def __repr__(self):
  4799. * return self.name
  4800. */
  4801. __Pyx_INCREF(__pyx_v_name);
  4802. __Pyx_GIVEREF(__pyx_v_name);
  4803. __Pyx_GOTREF(__pyx_v_self->name);
  4804. __Pyx_DECREF(__pyx_v_self->name);
  4805. __pyx_v_self->name = __pyx_v_name;
  4806. /* "View.MemoryView":281
  4807. * cdef class Enum(object):
  4808. * cdef object name
  4809. * def __init__(self, name): # <<<<<<<<<<<<<<
  4810. * self.name = name
  4811. * def __repr__(self):
  4812. */
  4813. /* function exit code */
  4814. __pyx_r = 0;
  4815. __Pyx_RefNannyFinishContext();
  4816. return __pyx_r;
  4817. }
  4818. /* "View.MemoryView":283
  4819. * def __init__(self, name):
  4820. * self.name = name
  4821. * def __repr__(self): # <<<<<<<<<<<<<<
  4822. * return self.name
  4823. *
  4824. */
  4825. /* Python wrapper */
  4826. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
  4827. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  4828. PyObject *__pyx_r = 0;
  4829. __Pyx_RefNannyDeclarations
  4830. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  4831. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  4832. /* function exit code */
  4833. __Pyx_RefNannyFinishContext();
  4834. return __pyx_r;
  4835. }
  4836. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  4837. PyObject *__pyx_r = NULL;
  4838. __Pyx_RefNannyDeclarations
  4839. __Pyx_RefNannySetupContext("__repr__", 0);
  4840. /* "View.MemoryView":284
  4841. * self.name = name
  4842. * def __repr__(self):
  4843. * return self.name # <<<<<<<<<<<<<<
  4844. *
  4845. * cdef generic = Enum("<strided and direct or indirect>")
  4846. */
  4847. __Pyx_XDECREF(__pyx_r);
  4848. __Pyx_INCREF(__pyx_v_self->name);
  4849. __pyx_r = __pyx_v_self->name;
  4850. goto __pyx_L0;
  4851. /* "View.MemoryView":283
  4852. * def __init__(self, name):
  4853. * self.name = name
  4854. * def __repr__(self): # <<<<<<<<<<<<<<
  4855. * return self.name
  4856. *
  4857. */
  4858. /* function exit code */
  4859. __pyx_L0:;
  4860. __Pyx_XGIVEREF(__pyx_r);
  4861. __Pyx_RefNannyFinishContext();
  4862. return __pyx_r;
  4863. }
  4864. /* "(tree fragment)":1
  4865. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  4866. * cdef tuple state
  4867. * cdef object _dict
  4868. */
  4869. /* Python wrapper */
  4870. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4871. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4872. PyObject *__pyx_r = 0;
  4873. __Pyx_RefNannyDeclarations
  4874. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  4875. __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  4876. /* function exit code */
  4877. __Pyx_RefNannyFinishContext();
  4878. return __pyx_r;
  4879. }
  4880. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  4881. PyObject *__pyx_v_state = 0;
  4882. PyObject *__pyx_v__dict = 0;
  4883. int __pyx_v_use_setstate;
  4884. PyObject *__pyx_r = NULL;
  4885. __Pyx_RefNannyDeclarations
  4886. PyObject *__pyx_t_1 = NULL;
  4887. int __pyx_t_2;
  4888. int __pyx_t_3;
  4889. PyObject *__pyx_t_4 = NULL;
  4890. PyObject *__pyx_t_5 = NULL;
  4891. int __pyx_lineno = 0;
  4892. const char *__pyx_filename = NULL;
  4893. int __pyx_clineno = 0;
  4894. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  4895. /* "(tree fragment)":5
  4896. * cdef object _dict
  4897. * cdef bint use_setstate
  4898. * state = (self.name,) # <<<<<<<<<<<<<<
  4899. * _dict = getattr(self, '__dict__', None)
  4900. * if _dict is not None:
  4901. */
  4902. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
  4903. __Pyx_GOTREF(__pyx_t_1);
  4904. __Pyx_INCREF(__pyx_v_self->name);
  4905. __Pyx_GIVEREF(__pyx_v_self->name);
  4906. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  4907. __pyx_v_state = ((PyObject*)__pyx_t_1);
  4908. __pyx_t_1 = 0;
  4909. /* "(tree fragment)":6
  4910. * cdef bint use_setstate
  4911. * state = (self.name,)
  4912. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  4913. * if _dict is not None:
  4914. * state += (_dict,)
  4915. */
  4916. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
  4917. __Pyx_GOTREF(__pyx_t_1);
  4918. __pyx_v__dict = __pyx_t_1;
  4919. __pyx_t_1 = 0;
  4920. /* "(tree fragment)":7
  4921. * state = (self.name,)
  4922. * _dict = getattr(self, '__dict__', None)
  4923. * if _dict is not None: # <<<<<<<<<<<<<<
  4924. * state += (_dict,)
  4925. * use_setstate = True
  4926. */
  4927. __pyx_t_2 = (__pyx_v__dict != Py_None);
  4928. __pyx_t_3 = (__pyx_t_2 != 0);
  4929. if (__pyx_t_3) {
  4930. /* "(tree fragment)":8
  4931. * _dict = getattr(self, '__dict__', None)
  4932. * if _dict is not None:
  4933. * state += (_dict,) # <<<<<<<<<<<<<<
  4934. * use_setstate = True
  4935. * else:
  4936. */
  4937. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
  4938. __Pyx_GOTREF(__pyx_t_1);
  4939. __Pyx_INCREF(__pyx_v__dict);
  4940. __Pyx_GIVEREF(__pyx_v__dict);
  4941. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  4942. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
  4943. __Pyx_GOTREF(__pyx_t_4);
  4944. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4945. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  4946. __pyx_t_4 = 0;
  4947. /* "(tree fragment)":9
  4948. * if _dict is not None:
  4949. * state += (_dict,)
  4950. * use_setstate = True # <<<<<<<<<<<<<<
  4951. * else:
  4952. * use_setstate = self.name is not None
  4953. */
  4954. __pyx_v_use_setstate = 1;
  4955. /* "(tree fragment)":7
  4956. * state = (self.name,)
  4957. * _dict = getattr(self, '__dict__', None)
  4958. * if _dict is not None: # <<<<<<<<<<<<<<
  4959. * state += (_dict,)
  4960. * use_setstate = True
  4961. */
  4962. goto __pyx_L3;
  4963. }
  4964. /* "(tree fragment)":11
  4965. * use_setstate = True
  4966. * else:
  4967. * use_setstate = self.name is not None # <<<<<<<<<<<<<<
  4968. * if use_setstate:
  4969. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  4970. */
  4971. /*else*/ {
  4972. __pyx_t_3 = (__pyx_v_self->name != Py_None);
  4973. __pyx_v_use_setstate = __pyx_t_3;
  4974. }
  4975. __pyx_L3:;
  4976. /* "(tree fragment)":12
  4977. * else:
  4978. * use_setstate = self.name is not None
  4979. * if use_setstate: # <<<<<<<<<<<<<<
  4980. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  4981. * else:
  4982. */
  4983. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  4984. if (__pyx_t_3) {
  4985. /* "(tree fragment)":13
  4986. * use_setstate = self.name is not None
  4987. * if use_setstate:
  4988. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
  4989. * else:
  4990. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  4991. */
  4992. __Pyx_XDECREF(__pyx_r);
  4993. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
  4994. __Pyx_GOTREF(__pyx_t_4);
  4995. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
  4996. __Pyx_GOTREF(__pyx_t_1);
  4997. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  4998. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  4999. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5000. __Pyx_INCREF(__pyx_int_184977713);
  5001. __Pyx_GIVEREF(__pyx_int_184977713);
  5002. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  5003. __Pyx_INCREF(Py_None);
  5004. __Pyx_GIVEREF(Py_None);
  5005. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  5006. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
  5007. __Pyx_GOTREF(__pyx_t_5);
  5008. __Pyx_GIVEREF(__pyx_t_4);
  5009. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  5010. __Pyx_GIVEREF(__pyx_t_1);
  5011. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  5012. __Pyx_INCREF(__pyx_v_state);
  5013. __Pyx_GIVEREF(__pyx_v_state);
  5014. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
  5015. __pyx_t_4 = 0;
  5016. __pyx_t_1 = 0;
  5017. __pyx_r = __pyx_t_5;
  5018. __pyx_t_5 = 0;
  5019. goto __pyx_L0;
  5020. /* "(tree fragment)":12
  5021. * else:
  5022. * use_setstate = self.name is not None
  5023. * if use_setstate: # <<<<<<<<<<<<<<
  5024. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5025. * else:
  5026. */
  5027. }
  5028. /* "(tree fragment)":15
  5029. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5030. * else:
  5031. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
  5032. * def __setstate_cython__(self, __pyx_state):
  5033. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5034. */
  5035. /*else*/ {
  5036. __Pyx_XDECREF(__pyx_r);
  5037. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
  5038. __Pyx_GOTREF(__pyx_t_5);
  5039. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
  5040. __Pyx_GOTREF(__pyx_t_1);
  5041. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5042. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5043. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5044. __Pyx_INCREF(__pyx_int_184977713);
  5045. __Pyx_GIVEREF(__pyx_int_184977713);
  5046. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  5047. __Pyx_INCREF(__pyx_v_state);
  5048. __Pyx_GIVEREF(__pyx_v_state);
  5049. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  5050. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
  5051. __Pyx_GOTREF(__pyx_t_4);
  5052. __Pyx_GIVEREF(__pyx_t_5);
  5053. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  5054. __Pyx_GIVEREF(__pyx_t_1);
  5055. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  5056. __pyx_t_5 = 0;
  5057. __pyx_t_1 = 0;
  5058. __pyx_r = __pyx_t_4;
  5059. __pyx_t_4 = 0;
  5060. goto __pyx_L0;
  5061. }
  5062. /* "(tree fragment)":1
  5063. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  5064. * cdef tuple state
  5065. * cdef object _dict
  5066. */
  5067. /* function exit code */
  5068. __pyx_L1_error:;
  5069. __Pyx_XDECREF(__pyx_t_1);
  5070. __Pyx_XDECREF(__pyx_t_4);
  5071. __Pyx_XDECREF(__pyx_t_5);
  5072. __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5073. __pyx_r = NULL;
  5074. __pyx_L0:;
  5075. __Pyx_XDECREF(__pyx_v_state);
  5076. __Pyx_XDECREF(__pyx_v__dict);
  5077. __Pyx_XGIVEREF(__pyx_r);
  5078. __Pyx_RefNannyFinishContext();
  5079. return __pyx_r;
  5080. }
  5081. /* "(tree fragment)":16
  5082. * else:
  5083. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5084. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  5085. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5086. */
  5087. /* Python wrapper */
  5088. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  5089. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  5090. PyObject *__pyx_r = 0;
  5091. __Pyx_RefNannyDeclarations
  5092. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  5093. __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  5094. /* function exit code */
  5095. __Pyx_RefNannyFinishContext();
  5096. return __pyx_r;
  5097. }
  5098. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  5099. PyObject *__pyx_r = NULL;
  5100. __Pyx_RefNannyDeclarations
  5101. PyObject *__pyx_t_1 = NULL;
  5102. int __pyx_lineno = 0;
  5103. const char *__pyx_filename = NULL;
  5104. int __pyx_clineno = 0;
  5105. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  5106. /* "(tree fragment)":17
  5107. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5108. * def __setstate_cython__(self, __pyx_state):
  5109. * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  5110. */
  5111. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
  5112. __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
  5113. __Pyx_GOTREF(__pyx_t_1);
  5114. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5115. /* "(tree fragment)":16
  5116. * else:
  5117. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5118. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  5119. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5120. */
  5121. /* function exit code */
  5122. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5123. goto __pyx_L0;
  5124. __pyx_L1_error:;
  5125. __Pyx_XDECREF(__pyx_t_1);
  5126. __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5127. __pyx_r = NULL;
  5128. __pyx_L0:;
  5129. __Pyx_XGIVEREF(__pyx_r);
  5130. __Pyx_RefNannyFinishContext();
  5131. return __pyx_r;
  5132. }
  5133. /* "View.MemoryView":298
  5134. *
  5135. * @cname('__pyx_align_pointer')
  5136. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  5137. * "Align pointer memory on a given boundary"
  5138. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  5139. */
  5140. static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  5141. Py_intptr_t __pyx_v_aligned_p;
  5142. size_t __pyx_v_offset;
  5143. void *__pyx_r;
  5144. int __pyx_t_1;
  5145. /* "View.MemoryView":300
  5146. * cdef void *align_pointer(void *memory, size_t alignment) nogil:
  5147. * "Align pointer memory on a given boundary"
  5148. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
  5149. * cdef size_t offset
  5150. *
  5151. */
  5152. __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
  5153. /* "View.MemoryView":304
  5154. *
  5155. * with cython.cdivision(True):
  5156. * offset = aligned_p % alignment # <<<<<<<<<<<<<<
  5157. *
  5158. * if offset > 0:
  5159. */
  5160. __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
  5161. /* "View.MemoryView":306
  5162. * offset = aligned_p % alignment
  5163. *
  5164. * if offset > 0: # <<<<<<<<<<<<<<
  5165. * aligned_p += alignment - offset
  5166. *
  5167. */
  5168. __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  5169. if (__pyx_t_1) {
  5170. /* "View.MemoryView":307
  5171. *
  5172. * if offset > 0:
  5173. * aligned_p += alignment - offset # <<<<<<<<<<<<<<
  5174. *
  5175. * return <void *> aligned_p
  5176. */
  5177. __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
  5178. /* "View.MemoryView":306
  5179. * offset = aligned_p % alignment
  5180. *
  5181. * if offset > 0: # <<<<<<<<<<<<<<
  5182. * aligned_p += alignment - offset
  5183. *
  5184. */
  5185. }
  5186. /* "View.MemoryView":309
  5187. * aligned_p += alignment - offset
  5188. *
  5189. * return <void *> aligned_p # <<<<<<<<<<<<<<
  5190. *
  5191. *
  5192. */
  5193. __pyx_r = ((void *)__pyx_v_aligned_p);
  5194. goto __pyx_L0;
  5195. /* "View.MemoryView":298
  5196. *
  5197. * @cname('__pyx_align_pointer')
  5198. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  5199. * "Align pointer memory on a given boundary"
  5200. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  5201. */
  5202. /* function exit code */
  5203. __pyx_L0:;
  5204. return __pyx_r;
  5205. }
  5206. /* "View.MemoryView":345
  5207. * cdef __Pyx_TypeInfo *typeinfo
  5208. *
  5209. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  5210. * self.obj = obj
  5211. * self.flags = flags
  5212. */
  5213. /* Python wrapper */
  5214. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5215. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5216. PyObject *__pyx_v_obj = 0;
  5217. int __pyx_v_flags;
  5218. int __pyx_v_dtype_is_object;
  5219. int __pyx_lineno = 0;
  5220. const char *__pyx_filename = NULL;
  5221. int __pyx_clineno = 0;
  5222. int __pyx_r;
  5223. __Pyx_RefNannyDeclarations
  5224. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  5225. {
  5226. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
  5227. PyObject* values[3] = {0,0,0};
  5228. if (unlikely(__pyx_kwds)) {
  5229. Py_ssize_t kw_args;
  5230. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5231. switch (pos_args) {
  5232. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5233. CYTHON_FALLTHROUGH;
  5234. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5235. CYTHON_FALLTHROUGH;
  5236. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5237. CYTHON_FALLTHROUGH;
  5238. case 0: break;
  5239. default: goto __pyx_L5_argtuple_error;
  5240. }
  5241. kw_args = PyDict_Size(__pyx_kwds);
  5242. switch (pos_args) {
  5243. case 0:
  5244. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
  5245. else goto __pyx_L5_argtuple_error;
  5246. CYTHON_FALLTHROUGH;
  5247. case 1:
  5248. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
  5249. else {
  5250. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
  5251. }
  5252. CYTHON_FALLTHROUGH;
  5253. case 2:
  5254. if (kw_args > 0) {
  5255. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
  5256. if (value) { values[2] = value; kw_args--; }
  5257. }
  5258. }
  5259. if (unlikely(kw_args > 0)) {
  5260. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
  5261. }
  5262. } else {
  5263. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5264. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5265. CYTHON_FALLTHROUGH;
  5266. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5267. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5268. break;
  5269. default: goto __pyx_L5_argtuple_error;
  5270. }
  5271. }
  5272. __pyx_v_obj = values[0];
  5273. __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
  5274. if (values[2]) {
  5275. __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
  5276. } else {
  5277. __pyx_v_dtype_is_object = ((int)0);
  5278. }
  5279. }
  5280. goto __pyx_L4_argument_unpacking_done;
  5281. __pyx_L5_argtuple_error:;
  5282. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
  5283. __pyx_L3_error:;
  5284. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5285. __Pyx_RefNannyFinishContext();
  5286. return -1;
  5287. __pyx_L4_argument_unpacking_done:;
  5288. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
  5289. /* function exit code */
  5290. __Pyx_RefNannyFinishContext();
  5291. return __pyx_r;
  5292. }
  5293. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  5294. int __pyx_r;
  5295. __Pyx_RefNannyDeclarations
  5296. int __pyx_t_1;
  5297. int __pyx_t_2;
  5298. int __pyx_t_3;
  5299. int __pyx_t_4;
  5300. int __pyx_lineno = 0;
  5301. const char *__pyx_filename = NULL;
  5302. int __pyx_clineno = 0;
  5303. __Pyx_RefNannySetupContext("__cinit__", 0);
  5304. /* "View.MemoryView":346
  5305. *
  5306. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  5307. * self.obj = obj # <<<<<<<<<<<<<<
  5308. * self.flags = flags
  5309. * if type(self) is memoryview or obj is not None:
  5310. */
  5311. __Pyx_INCREF(__pyx_v_obj);
  5312. __Pyx_GIVEREF(__pyx_v_obj);
  5313. __Pyx_GOTREF(__pyx_v_self->obj);
  5314. __Pyx_DECREF(__pyx_v_self->obj);
  5315. __pyx_v_self->obj = __pyx_v_obj;
  5316. /* "View.MemoryView":347
  5317. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  5318. * self.obj = obj
  5319. * self.flags = flags # <<<<<<<<<<<<<<
  5320. * if type(self) is memoryview or obj is not None:
  5321. * __Pyx_GetBuffer(obj, &self.view, flags)
  5322. */
  5323. __pyx_v_self->flags = __pyx_v_flags;
  5324. /* "View.MemoryView":348
  5325. * self.obj = obj
  5326. * self.flags = flags
  5327. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  5328. * __Pyx_GetBuffer(obj, &self.view, flags)
  5329. * if <PyObject *> self.view.obj == NULL:
  5330. */
  5331. __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  5332. __pyx_t_3 = (__pyx_t_2 != 0);
  5333. if (!__pyx_t_3) {
  5334. } else {
  5335. __pyx_t_1 = __pyx_t_3;
  5336. goto __pyx_L4_bool_binop_done;
  5337. }
  5338. __pyx_t_3 = (__pyx_v_obj != Py_None);
  5339. __pyx_t_2 = (__pyx_t_3 != 0);
  5340. __pyx_t_1 = __pyx_t_2;
  5341. __pyx_L4_bool_binop_done:;
  5342. if (__pyx_t_1) {
  5343. /* "View.MemoryView":349
  5344. * self.flags = flags
  5345. * if type(self) is memoryview or obj is not None:
  5346. * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
  5347. * if <PyObject *> self.view.obj == NULL:
  5348. * (<__pyx_buffer *> &self.view).obj = Py_None
  5349. */
  5350. __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
  5351. /* "View.MemoryView":350
  5352. * if type(self) is memoryview or obj is not None:
  5353. * __Pyx_GetBuffer(obj, &self.view, flags)
  5354. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  5355. * (<__pyx_buffer *> &self.view).obj = Py_None
  5356. * Py_INCREF(Py_None)
  5357. */
  5358. __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
  5359. if (__pyx_t_1) {
  5360. /* "View.MemoryView":351
  5361. * __Pyx_GetBuffer(obj, &self.view, flags)
  5362. * if <PyObject *> self.view.obj == NULL:
  5363. * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
  5364. * Py_INCREF(Py_None)
  5365. *
  5366. */
  5367. ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
  5368. /* "View.MemoryView":352
  5369. * if <PyObject *> self.view.obj == NULL:
  5370. * (<__pyx_buffer *> &self.view).obj = Py_None
  5371. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  5372. *
  5373. * global __pyx_memoryview_thread_locks_used
  5374. */
  5375. Py_INCREF(Py_None);
  5376. /* "View.MemoryView":350
  5377. * if type(self) is memoryview or obj is not None:
  5378. * __Pyx_GetBuffer(obj, &self.view, flags)
  5379. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  5380. * (<__pyx_buffer *> &self.view).obj = Py_None
  5381. * Py_INCREF(Py_None)
  5382. */
  5383. }
  5384. /* "View.MemoryView":348
  5385. * self.obj = obj
  5386. * self.flags = flags
  5387. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  5388. * __Pyx_GetBuffer(obj, &self.view, flags)
  5389. * if <PyObject *> self.view.obj == NULL:
  5390. */
  5391. }
  5392. /* "View.MemoryView":355
  5393. *
  5394. * global __pyx_memoryview_thread_locks_used
  5395. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  5396. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5397. * __pyx_memoryview_thread_locks_used += 1
  5398. */
  5399. __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  5400. if (__pyx_t_1) {
  5401. /* "View.MemoryView":356
  5402. * global __pyx_memoryview_thread_locks_used
  5403. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  5404. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
  5405. * __pyx_memoryview_thread_locks_used += 1
  5406. * if self.lock is NULL:
  5407. */
  5408. __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  5409. /* "View.MemoryView":357
  5410. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  5411. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5412. * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
  5413. * if self.lock is NULL:
  5414. * self.lock = PyThread_allocate_lock()
  5415. */
  5416. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
  5417. /* "View.MemoryView":355
  5418. *
  5419. * global __pyx_memoryview_thread_locks_used
  5420. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  5421. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5422. * __pyx_memoryview_thread_locks_used += 1
  5423. */
  5424. }
  5425. /* "View.MemoryView":358
  5426. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5427. * __pyx_memoryview_thread_locks_used += 1
  5428. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5429. * self.lock = PyThread_allocate_lock()
  5430. * if self.lock is NULL:
  5431. */
  5432. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  5433. if (__pyx_t_1) {
  5434. /* "View.MemoryView":359
  5435. * __pyx_memoryview_thread_locks_used += 1
  5436. * if self.lock is NULL:
  5437. * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
  5438. * if self.lock is NULL:
  5439. * raise MemoryError
  5440. */
  5441. __pyx_v_self->lock = PyThread_allocate_lock();
  5442. /* "View.MemoryView":360
  5443. * if self.lock is NULL:
  5444. * self.lock = PyThread_allocate_lock()
  5445. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5446. * raise MemoryError
  5447. *
  5448. */
  5449. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  5450. if (unlikely(__pyx_t_1)) {
  5451. /* "View.MemoryView":361
  5452. * self.lock = PyThread_allocate_lock()
  5453. * if self.lock is NULL:
  5454. * raise MemoryError # <<<<<<<<<<<<<<
  5455. *
  5456. * if flags & PyBUF_FORMAT:
  5457. */
  5458. PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
  5459. /* "View.MemoryView":360
  5460. * if self.lock is NULL:
  5461. * self.lock = PyThread_allocate_lock()
  5462. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5463. * raise MemoryError
  5464. *
  5465. */
  5466. }
  5467. /* "View.MemoryView":358
  5468. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5469. * __pyx_memoryview_thread_locks_used += 1
  5470. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5471. * self.lock = PyThread_allocate_lock()
  5472. * if self.lock is NULL:
  5473. */
  5474. }
  5475. /* "View.MemoryView":363
  5476. * raise MemoryError
  5477. *
  5478. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  5479. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5480. * else:
  5481. */
  5482. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  5483. if (__pyx_t_1) {
  5484. /* "View.MemoryView":364
  5485. *
  5486. * if flags & PyBUF_FORMAT:
  5487. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
  5488. * else:
  5489. * self.dtype_is_object = dtype_is_object
  5490. */
  5491. __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
  5492. if (__pyx_t_2) {
  5493. } else {
  5494. __pyx_t_1 = __pyx_t_2;
  5495. goto __pyx_L11_bool_binop_done;
  5496. }
  5497. __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
  5498. __pyx_t_1 = __pyx_t_2;
  5499. __pyx_L11_bool_binop_done:;
  5500. __pyx_v_self->dtype_is_object = __pyx_t_1;
  5501. /* "View.MemoryView":363
  5502. * raise MemoryError
  5503. *
  5504. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  5505. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5506. * else:
  5507. */
  5508. goto __pyx_L10;
  5509. }
  5510. /* "View.MemoryView":366
  5511. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5512. * else:
  5513. * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
  5514. *
  5515. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  5516. */
  5517. /*else*/ {
  5518. __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  5519. }
  5520. __pyx_L10:;
  5521. /* "View.MemoryView":368
  5522. * self.dtype_is_object = dtype_is_object
  5523. *
  5524. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
  5525. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  5526. * self.typeinfo = NULL
  5527. */
  5528. __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
  5529. /* "View.MemoryView":370
  5530. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  5531. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  5532. * self.typeinfo = NULL # <<<<<<<<<<<<<<
  5533. *
  5534. * def __dealloc__(memoryview self):
  5535. */
  5536. __pyx_v_self->typeinfo = NULL;
  5537. /* "View.MemoryView":345
  5538. * cdef __Pyx_TypeInfo *typeinfo
  5539. *
  5540. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  5541. * self.obj = obj
  5542. * self.flags = flags
  5543. */
  5544. /* function exit code */
  5545. __pyx_r = 0;
  5546. goto __pyx_L0;
  5547. __pyx_L1_error:;
  5548. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5549. __pyx_r = -1;
  5550. __pyx_L0:;
  5551. __Pyx_RefNannyFinishContext();
  5552. return __pyx_r;
  5553. }
  5554. /* "View.MemoryView":372
  5555. * self.typeinfo = NULL
  5556. *
  5557. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  5558. * if self.obj is not None:
  5559. * __Pyx_ReleaseBuffer(&self.view)
  5560. */
  5561. /* Python wrapper */
  5562. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
  5563. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  5564. __Pyx_RefNannyDeclarations
  5565. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  5566. __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  5567. /* function exit code */
  5568. __Pyx_RefNannyFinishContext();
  5569. }
  5570. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  5571. int __pyx_v_i;
  5572. __Pyx_RefNannyDeclarations
  5573. int __pyx_t_1;
  5574. int __pyx_t_2;
  5575. int __pyx_t_3;
  5576. int __pyx_t_4;
  5577. int __pyx_t_5;
  5578. PyThread_type_lock __pyx_t_6;
  5579. PyThread_type_lock __pyx_t_7;
  5580. __Pyx_RefNannySetupContext("__dealloc__", 0);
  5581. /* "View.MemoryView":373
  5582. *
  5583. * def __dealloc__(memoryview self):
  5584. * if self.obj is not None: # <<<<<<<<<<<<<<
  5585. * __Pyx_ReleaseBuffer(&self.view)
  5586. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5587. */
  5588. __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  5589. __pyx_t_2 = (__pyx_t_1 != 0);
  5590. if (__pyx_t_2) {
  5591. /* "View.MemoryView":374
  5592. * def __dealloc__(memoryview self):
  5593. * if self.obj is not None:
  5594. * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
  5595. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5596. *
  5597. */
  5598. __Pyx_ReleaseBuffer((&__pyx_v_self->view));
  5599. /* "View.MemoryView":373
  5600. *
  5601. * def __dealloc__(memoryview self):
  5602. * if self.obj is not None: # <<<<<<<<<<<<<<
  5603. * __Pyx_ReleaseBuffer(&self.view)
  5604. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5605. */
  5606. goto __pyx_L3;
  5607. }
  5608. /* "View.MemoryView":375
  5609. * if self.obj is not None:
  5610. * __Pyx_ReleaseBuffer(&self.view)
  5611. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  5612. *
  5613. * (<__pyx_buffer *> &self.view).obj = NULL
  5614. */
  5615. __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
  5616. if (__pyx_t_2) {
  5617. /* "View.MemoryView":377
  5618. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5619. *
  5620. * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
  5621. * Py_DECREF(Py_None)
  5622. *
  5623. */
  5624. ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
  5625. /* "View.MemoryView":378
  5626. *
  5627. * (<__pyx_buffer *> &self.view).obj = NULL
  5628. * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
  5629. *
  5630. * cdef int i
  5631. */
  5632. Py_DECREF(Py_None);
  5633. /* "View.MemoryView":375
  5634. * if self.obj is not None:
  5635. * __Pyx_ReleaseBuffer(&self.view)
  5636. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  5637. *
  5638. * (<__pyx_buffer *> &self.view).obj = NULL
  5639. */
  5640. }
  5641. __pyx_L3:;
  5642. /* "View.MemoryView":382
  5643. * cdef int i
  5644. * global __pyx_memoryview_thread_locks_used
  5645. * if self.lock != NULL: # <<<<<<<<<<<<<<
  5646. * for i in range(__pyx_memoryview_thread_locks_used):
  5647. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5648. */
  5649. __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  5650. if (__pyx_t_2) {
  5651. /* "View.MemoryView":383
  5652. * global __pyx_memoryview_thread_locks_used
  5653. * if self.lock != NULL:
  5654. * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
  5655. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5656. * __pyx_memoryview_thread_locks_used -= 1
  5657. */
  5658. __pyx_t_3 = __pyx_memoryview_thread_locks_used;
  5659. __pyx_t_4 = __pyx_t_3;
  5660. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  5661. __pyx_v_i = __pyx_t_5;
  5662. /* "View.MemoryView":384
  5663. * if self.lock != NULL:
  5664. * for i in range(__pyx_memoryview_thread_locks_used):
  5665. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  5666. * __pyx_memoryview_thread_locks_used -= 1
  5667. * if i != __pyx_memoryview_thread_locks_used:
  5668. */
  5669. __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
  5670. if (__pyx_t_2) {
  5671. /* "View.MemoryView":385
  5672. * for i in range(__pyx_memoryview_thread_locks_used):
  5673. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5674. * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
  5675. * if i != __pyx_memoryview_thread_locks_used:
  5676. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5677. */
  5678. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
  5679. /* "View.MemoryView":386
  5680. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5681. * __pyx_memoryview_thread_locks_used -= 1
  5682. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  5683. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5684. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5685. */
  5686. __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
  5687. if (__pyx_t_2) {
  5688. /* "View.MemoryView":388
  5689. * if i != __pyx_memoryview_thread_locks_used:
  5690. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5691. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
  5692. * break
  5693. * else:
  5694. */
  5695. __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  5696. __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
  5697. /* "View.MemoryView":387
  5698. * __pyx_memoryview_thread_locks_used -= 1
  5699. * if i != __pyx_memoryview_thread_locks_used:
  5700. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
  5701. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5702. * break
  5703. */
  5704. (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
  5705. (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
  5706. /* "View.MemoryView":386
  5707. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5708. * __pyx_memoryview_thread_locks_used -= 1
  5709. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  5710. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5711. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5712. */
  5713. }
  5714. /* "View.MemoryView":389
  5715. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5716. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5717. * break # <<<<<<<<<<<<<<
  5718. * else:
  5719. * PyThread_free_lock(self.lock)
  5720. */
  5721. goto __pyx_L6_break;
  5722. /* "View.MemoryView":384
  5723. * if self.lock != NULL:
  5724. * for i in range(__pyx_memoryview_thread_locks_used):
  5725. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  5726. * __pyx_memoryview_thread_locks_used -= 1
  5727. * if i != __pyx_memoryview_thread_locks_used:
  5728. */
  5729. }
  5730. }
  5731. /*else*/ {
  5732. /* "View.MemoryView":391
  5733. * break
  5734. * else:
  5735. * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
  5736. *
  5737. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  5738. */
  5739. PyThread_free_lock(__pyx_v_self->lock);
  5740. }
  5741. __pyx_L6_break:;
  5742. /* "View.MemoryView":382
  5743. * cdef int i
  5744. * global __pyx_memoryview_thread_locks_used
  5745. * if self.lock != NULL: # <<<<<<<<<<<<<<
  5746. * for i in range(__pyx_memoryview_thread_locks_used):
  5747. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5748. */
  5749. }
  5750. /* "View.MemoryView":372
  5751. * self.typeinfo = NULL
  5752. *
  5753. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  5754. * if self.obj is not None:
  5755. * __Pyx_ReleaseBuffer(&self.view)
  5756. */
  5757. /* function exit code */
  5758. __Pyx_RefNannyFinishContext();
  5759. }
  5760. /* "View.MemoryView":393
  5761. * PyThread_free_lock(self.lock)
  5762. *
  5763. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  5764. * cdef Py_ssize_t dim
  5765. * cdef char *itemp = <char *> self.view.buf
  5766. */
  5767. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  5768. Py_ssize_t __pyx_v_dim;
  5769. char *__pyx_v_itemp;
  5770. PyObject *__pyx_v_idx = NULL;
  5771. char *__pyx_r;
  5772. __Pyx_RefNannyDeclarations
  5773. Py_ssize_t __pyx_t_1;
  5774. PyObject *__pyx_t_2 = NULL;
  5775. Py_ssize_t __pyx_t_3;
  5776. PyObject *(*__pyx_t_4)(PyObject *);
  5777. PyObject *__pyx_t_5 = NULL;
  5778. Py_ssize_t __pyx_t_6;
  5779. char *__pyx_t_7;
  5780. int __pyx_lineno = 0;
  5781. const char *__pyx_filename = NULL;
  5782. int __pyx_clineno = 0;
  5783. __Pyx_RefNannySetupContext("get_item_pointer", 0);
  5784. /* "View.MemoryView":395
  5785. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  5786. * cdef Py_ssize_t dim
  5787. * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
  5788. *
  5789. * for dim, idx in enumerate(index):
  5790. */
  5791. __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
  5792. /* "View.MemoryView":397
  5793. * cdef char *itemp = <char *> self.view.buf
  5794. *
  5795. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  5796. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  5797. *
  5798. */
  5799. __pyx_t_1 = 0;
  5800. if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
  5801. __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  5802. __pyx_t_4 = NULL;
  5803. } else {
  5804. __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
  5805. __Pyx_GOTREF(__pyx_t_2);
  5806. __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
  5807. }
  5808. for (;;) {
  5809. if (likely(!__pyx_t_4)) {
  5810. if (likely(PyList_CheckExact(__pyx_t_2))) {
  5811. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
  5812. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5813. __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
  5814. #else
  5815. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
  5816. __Pyx_GOTREF(__pyx_t_5);
  5817. #endif
  5818. } else {
  5819. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  5820. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5821. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
  5822. #else
  5823. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
  5824. __Pyx_GOTREF(__pyx_t_5);
  5825. #endif
  5826. }
  5827. } else {
  5828. __pyx_t_5 = __pyx_t_4(__pyx_t_2);
  5829. if (unlikely(!__pyx_t_5)) {
  5830. PyObject* exc_type = PyErr_Occurred();
  5831. if (exc_type) {
  5832. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5833. else __PYX_ERR(2, 397, __pyx_L1_error)
  5834. }
  5835. break;
  5836. }
  5837. __Pyx_GOTREF(__pyx_t_5);
  5838. }
  5839. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
  5840. __pyx_t_5 = 0;
  5841. __pyx_v_dim = __pyx_t_1;
  5842. __pyx_t_1 = (__pyx_t_1 + 1);
  5843. /* "View.MemoryView":398
  5844. *
  5845. * for dim, idx in enumerate(index):
  5846. * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
  5847. *
  5848. * return itemp
  5849. */
  5850. __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
  5851. __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
  5852. __pyx_v_itemp = __pyx_t_7;
  5853. /* "View.MemoryView":397
  5854. * cdef char *itemp = <char *> self.view.buf
  5855. *
  5856. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  5857. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  5858. *
  5859. */
  5860. }
  5861. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5862. /* "View.MemoryView":400
  5863. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  5864. *
  5865. * return itemp # <<<<<<<<<<<<<<
  5866. *
  5867. *
  5868. */
  5869. __pyx_r = __pyx_v_itemp;
  5870. goto __pyx_L0;
  5871. /* "View.MemoryView":393
  5872. * PyThread_free_lock(self.lock)
  5873. *
  5874. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  5875. * cdef Py_ssize_t dim
  5876. * cdef char *itemp = <char *> self.view.buf
  5877. */
  5878. /* function exit code */
  5879. __pyx_L1_error:;
  5880. __Pyx_XDECREF(__pyx_t_2);
  5881. __Pyx_XDECREF(__pyx_t_5);
  5882. __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5883. __pyx_r = NULL;
  5884. __pyx_L0:;
  5885. __Pyx_XDECREF(__pyx_v_idx);
  5886. __Pyx_RefNannyFinishContext();
  5887. return __pyx_r;
  5888. }
  5889. /* "View.MemoryView":403
  5890. *
  5891. *
  5892. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  5893. * if index is Ellipsis:
  5894. * return self
  5895. */
  5896. /* Python wrapper */
  5897. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
  5898. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  5899. PyObject *__pyx_r = 0;
  5900. __Pyx_RefNannyDeclarations
  5901. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  5902. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
  5903. /* function exit code */
  5904. __Pyx_RefNannyFinishContext();
  5905. return __pyx_r;
  5906. }
  5907. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  5908. PyObject *__pyx_v_have_slices = NULL;
  5909. PyObject *__pyx_v_indices = NULL;
  5910. char *__pyx_v_itemp;
  5911. PyObject *__pyx_r = NULL;
  5912. __Pyx_RefNannyDeclarations
  5913. int __pyx_t_1;
  5914. int __pyx_t_2;
  5915. PyObject *__pyx_t_3 = NULL;
  5916. PyObject *__pyx_t_4 = NULL;
  5917. PyObject *__pyx_t_5 = NULL;
  5918. char *__pyx_t_6;
  5919. int __pyx_lineno = 0;
  5920. const char *__pyx_filename = NULL;
  5921. int __pyx_clineno = 0;
  5922. __Pyx_RefNannySetupContext("__getitem__", 0);
  5923. /* "View.MemoryView":404
  5924. *
  5925. * def __getitem__(memoryview self, object index):
  5926. * if index is Ellipsis: # <<<<<<<<<<<<<<
  5927. * return self
  5928. *
  5929. */
  5930. __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  5931. __pyx_t_2 = (__pyx_t_1 != 0);
  5932. if (__pyx_t_2) {
  5933. /* "View.MemoryView":405
  5934. * def __getitem__(memoryview self, object index):
  5935. * if index is Ellipsis:
  5936. * return self # <<<<<<<<<<<<<<
  5937. *
  5938. * have_slices, indices = _unellipsify(index, self.view.ndim)
  5939. */
  5940. __Pyx_XDECREF(__pyx_r);
  5941. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5942. __pyx_r = ((PyObject *)__pyx_v_self);
  5943. goto __pyx_L0;
  5944. /* "View.MemoryView":404
  5945. *
  5946. * def __getitem__(memoryview self, object index):
  5947. * if index is Ellipsis: # <<<<<<<<<<<<<<
  5948. * return self
  5949. *
  5950. */
  5951. }
  5952. /* "View.MemoryView":407
  5953. * return self
  5954. *
  5955. * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  5956. *
  5957. * cdef char *itemp
  5958. */
  5959. __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
  5960. __Pyx_GOTREF(__pyx_t_3);
  5961. if (likely(__pyx_t_3 != Py_None)) {
  5962. PyObject* sequence = __pyx_t_3;
  5963. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5964. if (unlikely(size != 2)) {
  5965. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5966. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5967. __PYX_ERR(2, 407, __pyx_L1_error)
  5968. }
  5969. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5970. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
  5971. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
  5972. __Pyx_INCREF(__pyx_t_4);
  5973. __Pyx_INCREF(__pyx_t_5);
  5974. #else
  5975. __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
  5976. __Pyx_GOTREF(__pyx_t_4);
  5977. __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
  5978. __Pyx_GOTREF(__pyx_t_5);
  5979. #endif
  5980. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5981. } else {
  5982. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
  5983. }
  5984. __pyx_v_have_slices = __pyx_t_4;
  5985. __pyx_t_4 = 0;
  5986. __pyx_v_indices = __pyx_t_5;
  5987. __pyx_t_5 = 0;
  5988. /* "View.MemoryView":410
  5989. *
  5990. * cdef char *itemp
  5991. * if have_slices: # <<<<<<<<<<<<<<
  5992. * return memview_slice(self, indices)
  5993. * else:
  5994. */
  5995. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
  5996. if (__pyx_t_2) {
  5997. /* "View.MemoryView":411
  5998. * cdef char *itemp
  5999. * if have_slices:
  6000. * return memview_slice(self, indices) # <<<<<<<<<<<<<<
  6001. * else:
  6002. * itemp = self.get_item_pointer(indices)
  6003. */
  6004. __Pyx_XDECREF(__pyx_r);
  6005. __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
  6006. __Pyx_GOTREF(__pyx_t_3);
  6007. __pyx_r = __pyx_t_3;
  6008. __pyx_t_3 = 0;
  6009. goto __pyx_L0;
  6010. /* "View.MemoryView":410
  6011. *
  6012. * cdef char *itemp
  6013. * if have_slices: # <<<<<<<<<<<<<<
  6014. * return memview_slice(self, indices)
  6015. * else:
  6016. */
  6017. }
  6018. /* "View.MemoryView":413
  6019. * return memview_slice(self, indices)
  6020. * else:
  6021. * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
  6022. * return self.convert_item_to_object(itemp)
  6023. *
  6024. */
  6025. /*else*/ {
  6026. __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
  6027. __pyx_v_itemp = __pyx_t_6;
  6028. /* "View.MemoryView":414
  6029. * else:
  6030. * itemp = self.get_item_pointer(indices)
  6031. * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
  6032. *
  6033. * def __setitem__(memoryview self, object index, object value):
  6034. */
  6035. __Pyx_XDECREF(__pyx_r);
  6036. __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
  6037. __Pyx_GOTREF(__pyx_t_3);
  6038. __pyx_r = __pyx_t_3;
  6039. __pyx_t_3 = 0;
  6040. goto __pyx_L0;
  6041. }
  6042. /* "View.MemoryView":403
  6043. *
  6044. *
  6045. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  6046. * if index is Ellipsis:
  6047. * return self
  6048. */
  6049. /* function exit code */
  6050. __pyx_L1_error:;
  6051. __Pyx_XDECREF(__pyx_t_3);
  6052. __Pyx_XDECREF(__pyx_t_4);
  6053. __Pyx_XDECREF(__pyx_t_5);
  6054. __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6055. __pyx_r = NULL;
  6056. __pyx_L0:;
  6057. __Pyx_XDECREF(__pyx_v_have_slices);
  6058. __Pyx_XDECREF(__pyx_v_indices);
  6059. __Pyx_XGIVEREF(__pyx_r);
  6060. __Pyx_RefNannyFinishContext();
  6061. return __pyx_r;
  6062. }
  6063. /* "View.MemoryView":416
  6064. * return self.convert_item_to_object(itemp)
  6065. *
  6066. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  6067. * if self.view.readonly:
  6068. * raise TypeError("Cannot assign to read-only memoryview")
  6069. */
  6070. /* Python wrapper */
  6071. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
  6072. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  6073. int __pyx_r;
  6074. __Pyx_RefNannyDeclarations
  6075. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  6076. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
  6077. /* function exit code */
  6078. __Pyx_RefNannyFinishContext();
  6079. return __pyx_r;
  6080. }
  6081. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  6082. PyObject *__pyx_v_have_slices = NULL;
  6083. PyObject *__pyx_v_obj = NULL;
  6084. int __pyx_r;
  6085. __Pyx_RefNannyDeclarations
  6086. int __pyx_t_1;
  6087. PyObject *__pyx_t_2 = NULL;
  6088. PyObject *__pyx_t_3 = NULL;
  6089. PyObject *__pyx_t_4 = NULL;
  6090. int __pyx_lineno = 0;
  6091. const char *__pyx_filename = NULL;
  6092. int __pyx_clineno = 0;
  6093. __Pyx_RefNannySetupContext("__setitem__", 0);
  6094. __Pyx_INCREF(__pyx_v_index);
  6095. /* "View.MemoryView":417
  6096. *
  6097. * def __setitem__(memoryview self, object index, object value):
  6098. * if self.view.readonly: # <<<<<<<<<<<<<<
  6099. * raise TypeError("Cannot assign to read-only memoryview")
  6100. *
  6101. */
  6102. __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
  6103. if (unlikely(__pyx_t_1)) {
  6104. /* "View.MemoryView":418
  6105. * def __setitem__(memoryview self, object index, object value):
  6106. * if self.view.readonly:
  6107. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  6108. *
  6109. * have_slices, index = _unellipsify(index, self.view.ndim)
  6110. */
  6111. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
  6112. __Pyx_GOTREF(__pyx_t_2);
  6113. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  6114. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6115. __PYX_ERR(2, 418, __pyx_L1_error)
  6116. /* "View.MemoryView":417
  6117. *
  6118. * def __setitem__(memoryview self, object index, object value):
  6119. * if self.view.readonly: # <<<<<<<<<<<<<<
  6120. * raise TypeError("Cannot assign to read-only memoryview")
  6121. *
  6122. */
  6123. }
  6124. /* "View.MemoryView":420
  6125. * raise TypeError("Cannot assign to read-only memoryview")
  6126. *
  6127. * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  6128. *
  6129. * if have_slices:
  6130. */
  6131. __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
  6132. __Pyx_GOTREF(__pyx_t_2);
  6133. if (likely(__pyx_t_2 != Py_None)) {
  6134. PyObject* sequence = __pyx_t_2;
  6135. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6136. if (unlikely(size != 2)) {
  6137. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6138. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6139. __PYX_ERR(2, 420, __pyx_L1_error)
  6140. }
  6141. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6142. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6143. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  6144. __Pyx_INCREF(__pyx_t_3);
  6145. __Pyx_INCREF(__pyx_t_4);
  6146. #else
  6147. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
  6148. __Pyx_GOTREF(__pyx_t_3);
  6149. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
  6150. __Pyx_GOTREF(__pyx_t_4);
  6151. #endif
  6152. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6153. } else {
  6154. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
  6155. }
  6156. __pyx_v_have_slices = __pyx_t_3;
  6157. __pyx_t_3 = 0;
  6158. __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  6159. __pyx_t_4 = 0;
  6160. /* "View.MemoryView":422
  6161. * have_slices, index = _unellipsify(index, self.view.ndim)
  6162. *
  6163. * if have_slices: # <<<<<<<<<<<<<<
  6164. * obj = self.is_slice(value)
  6165. * if obj:
  6166. */
  6167. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
  6168. if (__pyx_t_1) {
  6169. /* "View.MemoryView":423
  6170. *
  6171. * if have_slices:
  6172. * obj = self.is_slice(value) # <<<<<<<<<<<<<<
  6173. * if obj:
  6174. * self.setitem_slice_assignment(self[index], obj)
  6175. */
  6176. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
  6177. __Pyx_GOTREF(__pyx_t_2);
  6178. __pyx_v_obj = __pyx_t_2;
  6179. __pyx_t_2 = 0;
  6180. /* "View.MemoryView":424
  6181. * if have_slices:
  6182. * obj = self.is_slice(value)
  6183. * if obj: # <<<<<<<<<<<<<<
  6184. * self.setitem_slice_assignment(self[index], obj)
  6185. * else:
  6186. */
  6187. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
  6188. if (__pyx_t_1) {
  6189. /* "View.MemoryView":425
  6190. * obj = self.is_slice(value)
  6191. * if obj:
  6192. * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
  6193. * else:
  6194. * self.setitem_slice_assign_scalar(self[index], value)
  6195. */
  6196. __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
  6197. __Pyx_GOTREF(__pyx_t_2);
  6198. __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
  6199. __Pyx_GOTREF(__pyx_t_4);
  6200. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6201. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6202. /* "View.MemoryView":424
  6203. * if have_slices:
  6204. * obj = self.is_slice(value)
  6205. * if obj: # <<<<<<<<<<<<<<
  6206. * self.setitem_slice_assignment(self[index], obj)
  6207. * else:
  6208. */
  6209. goto __pyx_L5;
  6210. }
  6211. /* "View.MemoryView":427
  6212. * self.setitem_slice_assignment(self[index], obj)
  6213. * else:
  6214. * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
  6215. * else:
  6216. * self.setitem_indexed(index, value)
  6217. */
  6218. /*else*/ {
  6219. __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
  6220. __Pyx_GOTREF(__pyx_t_4);
  6221. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
  6222. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
  6223. __Pyx_GOTREF(__pyx_t_2);
  6224. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6225. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6226. }
  6227. __pyx_L5:;
  6228. /* "View.MemoryView":422
  6229. * have_slices, index = _unellipsify(index, self.view.ndim)
  6230. *
  6231. * if have_slices: # <<<<<<<<<<<<<<
  6232. * obj = self.is_slice(value)
  6233. * if obj:
  6234. */
  6235. goto __pyx_L4;
  6236. }
  6237. /* "View.MemoryView":429
  6238. * self.setitem_slice_assign_scalar(self[index], value)
  6239. * else:
  6240. * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
  6241. *
  6242. * cdef is_slice(self, obj):
  6243. */
  6244. /*else*/ {
  6245. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
  6246. __Pyx_GOTREF(__pyx_t_2);
  6247. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6248. }
  6249. __pyx_L4:;
  6250. /* "View.MemoryView":416
  6251. * return self.convert_item_to_object(itemp)
  6252. *
  6253. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  6254. * if self.view.readonly:
  6255. * raise TypeError("Cannot assign to read-only memoryview")
  6256. */
  6257. /* function exit code */
  6258. __pyx_r = 0;
  6259. goto __pyx_L0;
  6260. __pyx_L1_error:;
  6261. __Pyx_XDECREF(__pyx_t_2);
  6262. __Pyx_XDECREF(__pyx_t_3);
  6263. __Pyx_XDECREF(__pyx_t_4);
  6264. __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6265. __pyx_r = -1;
  6266. __pyx_L0:;
  6267. __Pyx_XDECREF(__pyx_v_have_slices);
  6268. __Pyx_XDECREF(__pyx_v_obj);
  6269. __Pyx_XDECREF(__pyx_v_index);
  6270. __Pyx_RefNannyFinishContext();
  6271. return __pyx_r;
  6272. }
  6273. /* "View.MemoryView":431
  6274. * self.setitem_indexed(index, value)
  6275. *
  6276. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  6277. * if not isinstance(obj, memoryview):
  6278. * try:
  6279. */
  6280. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  6281. PyObject *__pyx_r = NULL;
  6282. __Pyx_RefNannyDeclarations
  6283. int __pyx_t_1;
  6284. int __pyx_t_2;
  6285. PyObject *__pyx_t_3 = NULL;
  6286. PyObject *__pyx_t_4 = NULL;
  6287. PyObject *__pyx_t_5 = NULL;
  6288. PyObject *__pyx_t_6 = NULL;
  6289. PyObject *__pyx_t_7 = NULL;
  6290. PyObject *__pyx_t_8 = NULL;
  6291. int __pyx_t_9;
  6292. int __pyx_lineno = 0;
  6293. const char *__pyx_filename = NULL;
  6294. int __pyx_clineno = 0;
  6295. __Pyx_RefNannySetupContext("is_slice", 0);
  6296. __Pyx_INCREF(__pyx_v_obj);
  6297. /* "View.MemoryView":432
  6298. *
  6299. * cdef is_slice(self, obj):
  6300. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  6301. * try:
  6302. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6303. */
  6304. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
  6305. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  6306. if (__pyx_t_2) {
  6307. /* "View.MemoryView":433
  6308. * cdef is_slice(self, obj):
  6309. * if not isinstance(obj, memoryview):
  6310. * try: # <<<<<<<<<<<<<<
  6311. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6312. * self.dtype_is_object)
  6313. */
  6314. {
  6315. __Pyx_PyThreadState_declare
  6316. __Pyx_PyThreadState_assign
  6317. __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
  6318. __Pyx_XGOTREF(__pyx_t_3);
  6319. __Pyx_XGOTREF(__pyx_t_4);
  6320. __Pyx_XGOTREF(__pyx_t_5);
  6321. /*try:*/ {
  6322. /* "View.MemoryView":434
  6323. * if not isinstance(obj, memoryview):
  6324. * try:
  6325. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  6326. * self.dtype_is_object)
  6327. * except TypeError:
  6328. */
  6329. __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
  6330. __Pyx_GOTREF(__pyx_t_6);
  6331. /* "View.MemoryView":435
  6332. * try:
  6333. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6334. * self.dtype_is_object) # <<<<<<<<<<<<<<
  6335. * except TypeError:
  6336. * return None
  6337. */
  6338. __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
  6339. __Pyx_GOTREF(__pyx_t_7);
  6340. /* "View.MemoryView":434
  6341. * if not isinstance(obj, memoryview):
  6342. * try:
  6343. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  6344. * self.dtype_is_object)
  6345. * except TypeError:
  6346. */
  6347. __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
  6348. __Pyx_GOTREF(__pyx_t_8);
  6349. __Pyx_INCREF(__pyx_v_obj);
  6350. __Pyx_GIVEREF(__pyx_v_obj);
  6351. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
  6352. __Pyx_GIVEREF(__pyx_t_6);
  6353. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  6354. __Pyx_GIVEREF(__pyx_t_7);
  6355. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
  6356. __pyx_t_6 = 0;
  6357. __pyx_t_7 = 0;
  6358. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
  6359. __Pyx_GOTREF(__pyx_t_7);
  6360. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6361. __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
  6362. __pyx_t_7 = 0;
  6363. /* "View.MemoryView":433
  6364. * cdef is_slice(self, obj):
  6365. * if not isinstance(obj, memoryview):
  6366. * try: # <<<<<<<<<<<<<<
  6367. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6368. * self.dtype_is_object)
  6369. */
  6370. }
  6371. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6372. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6373. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6374. goto __pyx_L9_try_end;
  6375. __pyx_L4_error:;
  6376. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  6377. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  6378. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  6379. /* "View.MemoryView":436
  6380. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6381. * self.dtype_is_object)
  6382. * except TypeError: # <<<<<<<<<<<<<<
  6383. * return None
  6384. *
  6385. */
  6386. __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
  6387. if (__pyx_t_9) {
  6388. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6389. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
  6390. __Pyx_GOTREF(__pyx_t_7);
  6391. __Pyx_GOTREF(__pyx_t_8);
  6392. __Pyx_GOTREF(__pyx_t_6);
  6393. /* "View.MemoryView":437
  6394. * self.dtype_is_object)
  6395. * except TypeError:
  6396. * return None # <<<<<<<<<<<<<<
  6397. *
  6398. * return obj
  6399. */
  6400. __Pyx_XDECREF(__pyx_r);
  6401. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6402. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6403. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6404. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6405. goto __pyx_L7_except_return;
  6406. }
  6407. goto __pyx_L6_except_error;
  6408. __pyx_L6_except_error:;
  6409. /* "View.MemoryView":433
  6410. * cdef is_slice(self, obj):
  6411. * if not isinstance(obj, memoryview):
  6412. * try: # <<<<<<<<<<<<<<
  6413. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6414. * self.dtype_is_object)
  6415. */
  6416. __Pyx_XGIVEREF(__pyx_t_3);
  6417. __Pyx_XGIVEREF(__pyx_t_4);
  6418. __Pyx_XGIVEREF(__pyx_t_5);
  6419. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  6420. goto __pyx_L1_error;
  6421. __pyx_L7_except_return:;
  6422. __Pyx_XGIVEREF(__pyx_t_3);
  6423. __Pyx_XGIVEREF(__pyx_t_4);
  6424. __Pyx_XGIVEREF(__pyx_t_5);
  6425. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  6426. goto __pyx_L0;
  6427. __pyx_L9_try_end:;
  6428. }
  6429. /* "View.MemoryView":432
  6430. *
  6431. * cdef is_slice(self, obj):
  6432. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  6433. * try:
  6434. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6435. */
  6436. }
  6437. /* "View.MemoryView":439
  6438. * return None
  6439. *
  6440. * return obj # <<<<<<<<<<<<<<
  6441. *
  6442. * cdef setitem_slice_assignment(self, dst, src):
  6443. */
  6444. __Pyx_XDECREF(__pyx_r);
  6445. __Pyx_INCREF(__pyx_v_obj);
  6446. __pyx_r = __pyx_v_obj;
  6447. goto __pyx_L0;
  6448. /* "View.MemoryView":431
  6449. * self.setitem_indexed(index, value)
  6450. *
  6451. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  6452. * if not isinstance(obj, memoryview):
  6453. * try:
  6454. */
  6455. /* function exit code */
  6456. __pyx_L1_error:;
  6457. __Pyx_XDECREF(__pyx_t_6);
  6458. __Pyx_XDECREF(__pyx_t_7);
  6459. __Pyx_XDECREF(__pyx_t_8);
  6460. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6461. __pyx_r = 0;
  6462. __pyx_L0:;
  6463. __Pyx_XDECREF(__pyx_v_obj);
  6464. __Pyx_XGIVEREF(__pyx_r);
  6465. __Pyx_RefNannyFinishContext();
  6466. return __pyx_r;
  6467. }
  6468. /* "View.MemoryView":441
  6469. * return obj
  6470. *
  6471. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  6472. * cdef __Pyx_memviewslice dst_slice
  6473. * cdef __Pyx_memviewslice src_slice
  6474. */
  6475. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  6476. __Pyx_memviewslice __pyx_v_dst_slice;
  6477. __Pyx_memviewslice __pyx_v_src_slice;
  6478. PyObject *__pyx_r = NULL;
  6479. __Pyx_RefNannyDeclarations
  6480. __Pyx_memviewslice *__pyx_t_1;
  6481. __Pyx_memviewslice *__pyx_t_2;
  6482. PyObject *__pyx_t_3 = NULL;
  6483. int __pyx_t_4;
  6484. int __pyx_t_5;
  6485. int __pyx_t_6;
  6486. int __pyx_lineno = 0;
  6487. const char *__pyx_filename = NULL;
  6488. int __pyx_clineno = 0;
  6489. __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
  6490. /* "View.MemoryView":445
  6491. * cdef __Pyx_memviewslice src_slice
  6492. *
  6493. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  6494. * get_slice_from_memview(dst, &dst_slice)[0],
  6495. * src.ndim, dst.ndim, self.dtype_is_object)
  6496. */
  6497. if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
  6498. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
  6499. /* "View.MemoryView":446
  6500. *
  6501. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  6502. * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
  6503. * src.ndim, dst.ndim, self.dtype_is_object)
  6504. *
  6505. */
  6506. if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
  6507. __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
  6508. /* "View.MemoryView":447
  6509. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  6510. * get_slice_from_memview(dst, &dst_slice)[0],
  6511. * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
  6512. *
  6513. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  6514. */
  6515. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
  6516. __Pyx_GOTREF(__pyx_t_3);
  6517. __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
  6518. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6519. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
  6520. __Pyx_GOTREF(__pyx_t_3);
  6521. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
  6522. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6523. /* "View.MemoryView":445
  6524. * cdef __Pyx_memviewslice src_slice
  6525. *
  6526. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  6527. * get_slice_from_memview(dst, &dst_slice)[0],
  6528. * src.ndim, dst.ndim, self.dtype_is_object)
  6529. */
  6530. __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
  6531. /* "View.MemoryView":441
  6532. * return obj
  6533. *
  6534. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  6535. * cdef __Pyx_memviewslice dst_slice
  6536. * cdef __Pyx_memviewslice src_slice
  6537. */
  6538. /* function exit code */
  6539. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6540. goto __pyx_L0;
  6541. __pyx_L1_error:;
  6542. __Pyx_XDECREF(__pyx_t_3);
  6543. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6544. __pyx_r = 0;
  6545. __pyx_L0:;
  6546. __Pyx_XGIVEREF(__pyx_r);
  6547. __Pyx_RefNannyFinishContext();
  6548. return __pyx_r;
  6549. }
  6550. /* "View.MemoryView":449
  6551. * src.ndim, dst.ndim, self.dtype_is_object)
  6552. *
  6553. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  6554. * cdef int array[128]
  6555. * cdef void *tmp = NULL
  6556. */
  6557. static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  6558. int __pyx_v_array[0x80];
  6559. void *__pyx_v_tmp;
  6560. void *__pyx_v_item;
  6561. __Pyx_memviewslice *__pyx_v_dst_slice;
  6562. __Pyx_memviewslice __pyx_v_tmp_slice;
  6563. PyObject *__pyx_r = NULL;
  6564. __Pyx_RefNannyDeclarations
  6565. __Pyx_memviewslice *__pyx_t_1;
  6566. int __pyx_t_2;
  6567. PyObject *__pyx_t_3 = NULL;
  6568. int __pyx_t_4;
  6569. int __pyx_t_5;
  6570. char const *__pyx_t_6;
  6571. PyObject *__pyx_t_7 = NULL;
  6572. PyObject *__pyx_t_8 = NULL;
  6573. PyObject *__pyx_t_9 = NULL;
  6574. PyObject *__pyx_t_10 = NULL;
  6575. PyObject *__pyx_t_11 = NULL;
  6576. PyObject *__pyx_t_12 = NULL;
  6577. int __pyx_lineno = 0;
  6578. const char *__pyx_filename = NULL;
  6579. int __pyx_clineno = 0;
  6580. __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
  6581. /* "View.MemoryView":451
  6582. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  6583. * cdef int array[128]
  6584. * cdef void *tmp = NULL # <<<<<<<<<<<<<<
  6585. * cdef void *item
  6586. *
  6587. */
  6588. __pyx_v_tmp = NULL;
  6589. /* "View.MemoryView":456
  6590. * cdef __Pyx_memviewslice *dst_slice
  6591. * cdef __Pyx_memviewslice tmp_slice
  6592. * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
  6593. *
  6594. * if <size_t>self.view.itemsize > sizeof(array):
  6595. */
  6596. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
  6597. __pyx_v_dst_slice = __pyx_t_1;
  6598. /* "View.MemoryView":458
  6599. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  6600. *
  6601. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  6602. * tmp = PyMem_Malloc(self.view.itemsize)
  6603. * if tmp == NULL:
  6604. */
  6605. __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  6606. if (__pyx_t_2) {
  6607. /* "View.MemoryView":459
  6608. *
  6609. * if <size_t>self.view.itemsize > sizeof(array):
  6610. * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
  6611. * if tmp == NULL:
  6612. * raise MemoryError
  6613. */
  6614. __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
  6615. /* "View.MemoryView":460
  6616. * if <size_t>self.view.itemsize > sizeof(array):
  6617. * tmp = PyMem_Malloc(self.view.itemsize)
  6618. * if tmp == NULL: # <<<<<<<<<<<<<<
  6619. * raise MemoryError
  6620. * item = tmp
  6621. */
  6622. __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
  6623. if (unlikely(__pyx_t_2)) {
  6624. /* "View.MemoryView":461
  6625. * tmp = PyMem_Malloc(self.view.itemsize)
  6626. * if tmp == NULL:
  6627. * raise MemoryError # <<<<<<<<<<<<<<
  6628. * item = tmp
  6629. * else:
  6630. */
  6631. PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
  6632. /* "View.MemoryView":460
  6633. * if <size_t>self.view.itemsize > sizeof(array):
  6634. * tmp = PyMem_Malloc(self.view.itemsize)
  6635. * if tmp == NULL: # <<<<<<<<<<<<<<
  6636. * raise MemoryError
  6637. * item = tmp
  6638. */
  6639. }
  6640. /* "View.MemoryView":462
  6641. * if tmp == NULL:
  6642. * raise MemoryError
  6643. * item = tmp # <<<<<<<<<<<<<<
  6644. * else:
  6645. * item = <void *> array
  6646. */
  6647. __pyx_v_item = __pyx_v_tmp;
  6648. /* "View.MemoryView":458
  6649. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  6650. *
  6651. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  6652. * tmp = PyMem_Malloc(self.view.itemsize)
  6653. * if tmp == NULL:
  6654. */
  6655. goto __pyx_L3;
  6656. }
  6657. /* "View.MemoryView":464
  6658. * item = tmp
  6659. * else:
  6660. * item = <void *> array # <<<<<<<<<<<<<<
  6661. *
  6662. * try:
  6663. */
  6664. /*else*/ {
  6665. __pyx_v_item = ((void *)__pyx_v_array);
  6666. }
  6667. __pyx_L3:;
  6668. /* "View.MemoryView":466
  6669. * item = <void *> array
  6670. *
  6671. * try: # <<<<<<<<<<<<<<
  6672. * if self.dtype_is_object:
  6673. * (<PyObject **> item)[0] = <PyObject *> value
  6674. */
  6675. /*try:*/ {
  6676. /* "View.MemoryView":467
  6677. *
  6678. * try:
  6679. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6680. * (<PyObject **> item)[0] = <PyObject *> value
  6681. * else:
  6682. */
  6683. __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
  6684. if (__pyx_t_2) {
  6685. /* "View.MemoryView":468
  6686. * try:
  6687. * if self.dtype_is_object:
  6688. * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
  6689. * else:
  6690. * self.assign_item_from_object(<char *> item, value)
  6691. */
  6692. (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
  6693. /* "View.MemoryView":467
  6694. *
  6695. * try:
  6696. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6697. * (<PyObject **> item)[0] = <PyObject *> value
  6698. * else:
  6699. */
  6700. goto __pyx_L8;
  6701. }
  6702. /* "View.MemoryView":470
  6703. * (<PyObject **> item)[0] = <PyObject *> value
  6704. * else:
  6705. * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
  6706. *
  6707. *
  6708. */
  6709. /*else*/ {
  6710. __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
  6711. __Pyx_GOTREF(__pyx_t_3);
  6712. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6713. }
  6714. __pyx_L8:;
  6715. /* "View.MemoryView":474
  6716. *
  6717. *
  6718. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  6719. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6720. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6721. */
  6722. __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
  6723. if (__pyx_t_2) {
  6724. /* "View.MemoryView":475
  6725. *
  6726. * if self.view.suboffsets != NULL:
  6727. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
  6728. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6729. * item, self.dtype_is_object)
  6730. */
  6731. __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
  6732. __Pyx_GOTREF(__pyx_t_3);
  6733. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6734. /* "View.MemoryView":474
  6735. *
  6736. *
  6737. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  6738. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6739. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6740. */
  6741. }
  6742. /* "View.MemoryView":476
  6743. * if self.view.suboffsets != NULL:
  6744. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6745. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
  6746. * item, self.dtype_is_object)
  6747. * finally:
  6748. */
  6749. __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  6750. }
  6751. /* "View.MemoryView":479
  6752. * item, self.dtype_is_object)
  6753. * finally:
  6754. * PyMem_Free(tmp) # <<<<<<<<<<<<<<
  6755. *
  6756. * cdef setitem_indexed(self, index, value):
  6757. */
  6758. /*finally:*/ {
  6759. /*normal exit:*/{
  6760. PyMem_Free(__pyx_v_tmp);
  6761. goto __pyx_L7;
  6762. }
  6763. __pyx_L6_error:;
  6764. /*exception exit:*/{
  6765. __Pyx_PyThreadState_declare
  6766. __Pyx_PyThreadState_assign
  6767. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  6768. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6769. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
  6770. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
  6771. __Pyx_XGOTREF(__pyx_t_7);
  6772. __Pyx_XGOTREF(__pyx_t_8);
  6773. __Pyx_XGOTREF(__pyx_t_9);
  6774. __Pyx_XGOTREF(__pyx_t_10);
  6775. __Pyx_XGOTREF(__pyx_t_11);
  6776. __Pyx_XGOTREF(__pyx_t_12);
  6777. __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
  6778. {
  6779. PyMem_Free(__pyx_v_tmp);
  6780. }
  6781. if (PY_MAJOR_VERSION >= 3) {
  6782. __Pyx_XGIVEREF(__pyx_t_10);
  6783. __Pyx_XGIVEREF(__pyx_t_11);
  6784. __Pyx_XGIVEREF(__pyx_t_12);
  6785. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
  6786. }
  6787. __Pyx_XGIVEREF(__pyx_t_7);
  6788. __Pyx_XGIVEREF(__pyx_t_8);
  6789. __Pyx_XGIVEREF(__pyx_t_9);
  6790. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  6791. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  6792. __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
  6793. goto __pyx_L1_error;
  6794. }
  6795. __pyx_L7:;
  6796. }
  6797. /* "View.MemoryView":449
  6798. * src.ndim, dst.ndim, self.dtype_is_object)
  6799. *
  6800. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  6801. * cdef int array[128]
  6802. * cdef void *tmp = NULL
  6803. */
  6804. /* function exit code */
  6805. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6806. goto __pyx_L0;
  6807. __pyx_L1_error:;
  6808. __Pyx_XDECREF(__pyx_t_3);
  6809. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6810. __pyx_r = 0;
  6811. __pyx_L0:;
  6812. __Pyx_XGIVEREF(__pyx_r);
  6813. __Pyx_RefNannyFinishContext();
  6814. return __pyx_r;
  6815. }
  6816. /* "View.MemoryView":481
  6817. * PyMem_Free(tmp)
  6818. *
  6819. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  6820. * cdef char *itemp = self.get_item_pointer(index)
  6821. * self.assign_item_from_object(itemp, value)
  6822. */
  6823. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  6824. char *__pyx_v_itemp;
  6825. PyObject *__pyx_r = NULL;
  6826. __Pyx_RefNannyDeclarations
  6827. char *__pyx_t_1;
  6828. PyObject *__pyx_t_2 = NULL;
  6829. int __pyx_lineno = 0;
  6830. const char *__pyx_filename = NULL;
  6831. int __pyx_clineno = 0;
  6832. __Pyx_RefNannySetupContext("setitem_indexed", 0);
  6833. /* "View.MemoryView":482
  6834. *
  6835. * cdef setitem_indexed(self, index, value):
  6836. * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
  6837. * self.assign_item_from_object(itemp, value)
  6838. *
  6839. */
  6840. __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
  6841. __pyx_v_itemp = __pyx_t_1;
  6842. /* "View.MemoryView":483
  6843. * cdef setitem_indexed(self, index, value):
  6844. * cdef char *itemp = self.get_item_pointer(index)
  6845. * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
  6846. *
  6847. * cdef convert_item_to_object(self, char *itemp):
  6848. */
  6849. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
  6850. __Pyx_GOTREF(__pyx_t_2);
  6851. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6852. /* "View.MemoryView":481
  6853. * PyMem_Free(tmp)
  6854. *
  6855. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  6856. * cdef char *itemp = self.get_item_pointer(index)
  6857. * self.assign_item_from_object(itemp, value)
  6858. */
  6859. /* function exit code */
  6860. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6861. goto __pyx_L0;
  6862. __pyx_L1_error:;
  6863. __Pyx_XDECREF(__pyx_t_2);
  6864. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6865. __pyx_r = 0;
  6866. __pyx_L0:;
  6867. __Pyx_XGIVEREF(__pyx_r);
  6868. __Pyx_RefNannyFinishContext();
  6869. return __pyx_r;
  6870. }
  6871. /* "View.MemoryView":485
  6872. * self.assign_item_from_object(itemp, value)
  6873. *
  6874. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  6875. * """Only used if instantiated manually by the user, or if Cython doesn't
  6876. * know how to convert the type"""
  6877. */
  6878. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  6879. PyObject *__pyx_v_struct = NULL;
  6880. PyObject *__pyx_v_bytesitem = 0;
  6881. PyObject *__pyx_v_result = NULL;
  6882. PyObject *__pyx_r = NULL;
  6883. __Pyx_RefNannyDeclarations
  6884. PyObject *__pyx_t_1 = NULL;
  6885. PyObject *__pyx_t_2 = NULL;
  6886. PyObject *__pyx_t_3 = NULL;
  6887. PyObject *__pyx_t_4 = NULL;
  6888. PyObject *__pyx_t_5 = NULL;
  6889. PyObject *__pyx_t_6 = NULL;
  6890. PyObject *__pyx_t_7 = NULL;
  6891. int __pyx_t_8;
  6892. PyObject *__pyx_t_9 = NULL;
  6893. size_t __pyx_t_10;
  6894. int __pyx_t_11;
  6895. int __pyx_lineno = 0;
  6896. const char *__pyx_filename = NULL;
  6897. int __pyx_clineno = 0;
  6898. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  6899. /* "View.MemoryView":488
  6900. * """Only used if instantiated manually by the user, or if Cython doesn't
  6901. * know how to convert the type"""
  6902. * import struct # <<<<<<<<<<<<<<
  6903. * cdef bytes bytesitem
  6904. *
  6905. */
  6906. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
  6907. __Pyx_GOTREF(__pyx_t_1);
  6908. __pyx_v_struct = __pyx_t_1;
  6909. __pyx_t_1 = 0;
  6910. /* "View.MemoryView":491
  6911. * cdef bytes bytesitem
  6912. *
  6913. * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
  6914. * try:
  6915. * result = struct.unpack(self.view.format, bytesitem)
  6916. */
  6917. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
  6918. __Pyx_GOTREF(__pyx_t_1);
  6919. __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  6920. __pyx_t_1 = 0;
  6921. /* "View.MemoryView":492
  6922. *
  6923. * bytesitem = itemp[:self.view.itemsize]
  6924. * try: # <<<<<<<<<<<<<<
  6925. * result = struct.unpack(self.view.format, bytesitem)
  6926. * except struct.error:
  6927. */
  6928. {
  6929. __Pyx_PyThreadState_declare
  6930. __Pyx_PyThreadState_assign
  6931. __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
  6932. __Pyx_XGOTREF(__pyx_t_2);
  6933. __Pyx_XGOTREF(__pyx_t_3);
  6934. __Pyx_XGOTREF(__pyx_t_4);
  6935. /*try:*/ {
  6936. /* "View.MemoryView":493
  6937. * bytesitem = itemp[:self.view.itemsize]
  6938. * try:
  6939. * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
  6940. * except struct.error:
  6941. * raise ValueError("Unable to convert item to object")
  6942. */
  6943. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
  6944. __Pyx_GOTREF(__pyx_t_5);
  6945. __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
  6946. __Pyx_GOTREF(__pyx_t_6);
  6947. __pyx_t_7 = NULL;
  6948. __pyx_t_8 = 0;
  6949. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  6950. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
  6951. if (likely(__pyx_t_7)) {
  6952. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  6953. __Pyx_INCREF(__pyx_t_7);
  6954. __Pyx_INCREF(function);
  6955. __Pyx_DECREF_SET(__pyx_t_5, function);
  6956. __pyx_t_8 = 1;
  6957. }
  6958. }
  6959. #if CYTHON_FAST_PYCALL
  6960. if (PyFunction_Check(__pyx_t_5)) {
  6961. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  6962. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
  6963. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  6964. __Pyx_GOTREF(__pyx_t_1);
  6965. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6966. } else
  6967. #endif
  6968. #if CYTHON_FAST_PYCCALL
  6969. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  6970. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  6971. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
  6972. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  6973. __Pyx_GOTREF(__pyx_t_1);
  6974. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6975. } else
  6976. #endif
  6977. {
  6978. __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
  6979. __Pyx_GOTREF(__pyx_t_9);
  6980. if (__pyx_t_7) {
  6981. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
  6982. }
  6983. __Pyx_GIVEREF(__pyx_t_6);
  6984. PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
  6985. __Pyx_INCREF(__pyx_v_bytesitem);
  6986. __Pyx_GIVEREF(__pyx_v_bytesitem);
  6987. PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
  6988. __pyx_t_6 = 0;
  6989. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
  6990. __Pyx_GOTREF(__pyx_t_1);
  6991. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6992. }
  6993. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6994. __pyx_v_result = __pyx_t_1;
  6995. __pyx_t_1 = 0;
  6996. /* "View.MemoryView":492
  6997. *
  6998. * bytesitem = itemp[:self.view.itemsize]
  6999. * try: # <<<<<<<<<<<<<<
  7000. * result = struct.unpack(self.view.format, bytesitem)
  7001. * except struct.error:
  7002. */
  7003. }
  7004. /* "View.MemoryView":497
  7005. * raise ValueError("Unable to convert item to object")
  7006. * else:
  7007. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  7008. * return result[0]
  7009. * return result
  7010. */
  7011. /*else:*/ {
  7012. __pyx_t_10 = strlen(__pyx_v_self->view.format);
  7013. __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
  7014. if (__pyx_t_11) {
  7015. /* "View.MemoryView":498
  7016. * else:
  7017. * if len(self.view.format) == 1:
  7018. * return result[0] # <<<<<<<<<<<<<<
  7019. * return result
  7020. *
  7021. */
  7022. __Pyx_XDECREF(__pyx_r);
  7023. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
  7024. __Pyx_GOTREF(__pyx_t_1);
  7025. __pyx_r = __pyx_t_1;
  7026. __pyx_t_1 = 0;
  7027. goto __pyx_L6_except_return;
  7028. /* "View.MemoryView":497
  7029. * raise ValueError("Unable to convert item to object")
  7030. * else:
  7031. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  7032. * return result[0]
  7033. * return result
  7034. */
  7035. }
  7036. /* "View.MemoryView":499
  7037. * if len(self.view.format) == 1:
  7038. * return result[0]
  7039. * return result # <<<<<<<<<<<<<<
  7040. *
  7041. * cdef assign_item_from_object(self, char *itemp, object value):
  7042. */
  7043. __Pyx_XDECREF(__pyx_r);
  7044. __Pyx_INCREF(__pyx_v_result);
  7045. __pyx_r = __pyx_v_result;
  7046. goto __pyx_L6_except_return;
  7047. }
  7048. __pyx_L3_error:;
  7049. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  7050. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7051. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  7052. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7053. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  7054. /* "View.MemoryView":494
  7055. * try:
  7056. * result = struct.unpack(self.view.format, bytesitem)
  7057. * except struct.error: # <<<<<<<<<<<<<<
  7058. * raise ValueError("Unable to convert item to object")
  7059. * else:
  7060. */
  7061. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
  7062. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
  7063. __Pyx_GOTREF(__pyx_t_6);
  7064. __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  7065. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7066. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
  7067. __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
  7068. if (__pyx_t_8) {
  7069. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7070. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
  7071. __Pyx_GOTREF(__pyx_t_9);
  7072. __Pyx_GOTREF(__pyx_t_5);
  7073. __Pyx_GOTREF(__pyx_t_1);
  7074. /* "View.MemoryView":495
  7075. * result = struct.unpack(self.view.format, bytesitem)
  7076. * except struct.error:
  7077. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  7078. * else:
  7079. * if len(self.view.format) == 1:
  7080. */
  7081. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
  7082. __Pyx_GOTREF(__pyx_t_6);
  7083. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  7084. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7085. __PYX_ERR(2, 495, __pyx_L5_except_error)
  7086. }
  7087. goto __pyx_L5_except_error;
  7088. __pyx_L5_except_error:;
  7089. /* "View.MemoryView":492
  7090. *
  7091. * bytesitem = itemp[:self.view.itemsize]
  7092. * try: # <<<<<<<<<<<<<<
  7093. * result = struct.unpack(self.view.format, bytesitem)
  7094. * except struct.error:
  7095. */
  7096. __Pyx_XGIVEREF(__pyx_t_2);
  7097. __Pyx_XGIVEREF(__pyx_t_3);
  7098. __Pyx_XGIVEREF(__pyx_t_4);
  7099. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  7100. goto __pyx_L1_error;
  7101. __pyx_L6_except_return:;
  7102. __Pyx_XGIVEREF(__pyx_t_2);
  7103. __Pyx_XGIVEREF(__pyx_t_3);
  7104. __Pyx_XGIVEREF(__pyx_t_4);
  7105. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  7106. goto __pyx_L0;
  7107. }
  7108. /* "View.MemoryView":485
  7109. * self.assign_item_from_object(itemp, value)
  7110. *
  7111. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  7112. * """Only used if instantiated manually by the user, or if Cython doesn't
  7113. * know how to convert the type"""
  7114. */
  7115. /* function exit code */
  7116. __pyx_L1_error:;
  7117. __Pyx_XDECREF(__pyx_t_1);
  7118. __Pyx_XDECREF(__pyx_t_5);
  7119. __Pyx_XDECREF(__pyx_t_6);
  7120. __Pyx_XDECREF(__pyx_t_7);
  7121. __Pyx_XDECREF(__pyx_t_9);
  7122. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7123. __pyx_r = 0;
  7124. __pyx_L0:;
  7125. __Pyx_XDECREF(__pyx_v_struct);
  7126. __Pyx_XDECREF(__pyx_v_bytesitem);
  7127. __Pyx_XDECREF(__pyx_v_result);
  7128. __Pyx_XGIVEREF(__pyx_r);
  7129. __Pyx_RefNannyFinishContext();
  7130. return __pyx_r;
  7131. }
  7132. /* "View.MemoryView":501
  7133. * return result
  7134. *
  7135. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  7136. * """Only used if instantiated manually by the user, or if Cython doesn't
  7137. * know how to convert the type"""
  7138. */
  7139. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  7140. PyObject *__pyx_v_struct = NULL;
  7141. char __pyx_v_c;
  7142. PyObject *__pyx_v_bytesvalue = 0;
  7143. Py_ssize_t __pyx_v_i;
  7144. PyObject *__pyx_r = NULL;
  7145. __Pyx_RefNannyDeclarations
  7146. PyObject *__pyx_t_1 = NULL;
  7147. int __pyx_t_2;
  7148. int __pyx_t_3;
  7149. PyObject *__pyx_t_4 = NULL;
  7150. PyObject *__pyx_t_5 = NULL;
  7151. PyObject *__pyx_t_6 = NULL;
  7152. int __pyx_t_7;
  7153. PyObject *__pyx_t_8 = NULL;
  7154. Py_ssize_t __pyx_t_9;
  7155. PyObject *__pyx_t_10 = NULL;
  7156. char *__pyx_t_11;
  7157. char *__pyx_t_12;
  7158. char *__pyx_t_13;
  7159. char *__pyx_t_14;
  7160. int __pyx_lineno = 0;
  7161. const char *__pyx_filename = NULL;
  7162. int __pyx_clineno = 0;
  7163. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  7164. /* "View.MemoryView":504
  7165. * """Only used if instantiated manually by the user, or if Cython doesn't
  7166. * know how to convert the type"""
  7167. * import struct # <<<<<<<<<<<<<<
  7168. * cdef char c
  7169. * cdef bytes bytesvalue
  7170. */
  7171. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
  7172. __Pyx_GOTREF(__pyx_t_1);
  7173. __pyx_v_struct = __pyx_t_1;
  7174. __pyx_t_1 = 0;
  7175. /* "View.MemoryView":509
  7176. * cdef Py_ssize_t i
  7177. *
  7178. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  7179. * bytesvalue = struct.pack(self.view.format, *value)
  7180. * else:
  7181. */
  7182. __pyx_t_2 = PyTuple_Check(__pyx_v_value);
  7183. __pyx_t_3 = (__pyx_t_2 != 0);
  7184. if (__pyx_t_3) {
  7185. /* "View.MemoryView":510
  7186. *
  7187. * if isinstance(value, tuple):
  7188. * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
  7189. * else:
  7190. * bytesvalue = struct.pack(self.view.format, value)
  7191. */
  7192. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
  7193. __Pyx_GOTREF(__pyx_t_1);
  7194. __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  7195. __Pyx_GOTREF(__pyx_t_4);
  7196. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
  7197. __Pyx_GOTREF(__pyx_t_5);
  7198. __Pyx_GIVEREF(__pyx_t_4);
  7199. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  7200. __pyx_t_4 = 0;
  7201. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  7202. __Pyx_GOTREF(__pyx_t_4);
  7203. __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
  7204. __Pyx_GOTREF(__pyx_t_6);
  7205. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7206. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7207. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  7208. __Pyx_GOTREF(__pyx_t_4);
  7209. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7210. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7211. if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
  7212. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  7213. __pyx_t_4 = 0;
  7214. /* "View.MemoryView":509
  7215. * cdef Py_ssize_t i
  7216. *
  7217. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  7218. * bytesvalue = struct.pack(self.view.format, *value)
  7219. * else:
  7220. */
  7221. goto __pyx_L3;
  7222. }
  7223. /* "View.MemoryView":512
  7224. * bytesvalue = struct.pack(self.view.format, *value)
  7225. * else:
  7226. * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
  7227. *
  7228. * for i, c in enumerate(bytesvalue):
  7229. */
  7230. /*else*/ {
  7231. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
  7232. __Pyx_GOTREF(__pyx_t_6);
  7233. __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
  7234. __Pyx_GOTREF(__pyx_t_1);
  7235. __pyx_t_5 = NULL;
  7236. __pyx_t_7 = 0;
  7237. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  7238. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
  7239. if (likely(__pyx_t_5)) {
  7240. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  7241. __Pyx_INCREF(__pyx_t_5);
  7242. __Pyx_INCREF(function);
  7243. __Pyx_DECREF_SET(__pyx_t_6, function);
  7244. __pyx_t_7 = 1;
  7245. }
  7246. }
  7247. #if CYTHON_FAST_PYCALL
  7248. if (PyFunction_Check(__pyx_t_6)) {
  7249. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  7250. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
  7251. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7252. __Pyx_GOTREF(__pyx_t_4);
  7253. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7254. } else
  7255. #endif
  7256. #if CYTHON_FAST_PYCCALL
  7257. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  7258. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  7259. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
  7260. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7261. __Pyx_GOTREF(__pyx_t_4);
  7262. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7263. } else
  7264. #endif
  7265. {
  7266. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
  7267. __Pyx_GOTREF(__pyx_t_8);
  7268. if (__pyx_t_5) {
  7269. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  7270. }
  7271. __Pyx_GIVEREF(__pyx_t_1);
  7272. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
  7273. __Pyx_INCREF(__pyx_v_value);
  7274. __Pyx_GIVEREF(__pyx_v_value);
  7275. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
  7276. __pyx_t_1 = 0;
  7277. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
  7278. __Pyx_GOTREF(__pyx_t_4);
  7279. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7280. }
  7281. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7282. if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
  7283. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  7284. __pyx_t_4 = 0;
  7285. }
  7286. __pyx_L3:;
  7287. /* "View.MemoryView":514
  7288. * bytesvalue = struct.pack(self.view.format, value)
  7289. *
  7290. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  7291. * itemp[i] = c
  7292. *
  7293. */
  7294. __pyx_t_9 = 0;
  7295. if (unlikely(__pyx_v_bytesvalue == Py_None)) {
  7296. PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
  7297. __PYX_ERR(2, 514, __pyx_L1_error)
  7298. }
  7299. __Pyx_INCREF(__pyx_v_bytesvalue);
  7300. __pyx_t_10 = __pyx_v_bytesvalue;
  7301. __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  7302. __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  7303. for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
  7304. __pyx_t_11 = __pyx_t_14;
  7305. __pyx_v_c = (__pyx_t_11[0]);
  7306. /* "View.MemoryView":515
  7307. *
  7308. * for i, c in enumerate(bytesvalue):
  7309. * itemp[i] = c # <<<<<<<<<<<<<<
  7310. *
  7311. * @cname('getbuffer')
  7312. */
  7313. __pyx_v_i = __pyx_t_9;
  7314. /* "View.MemoryView":514
  7315. * bytesvalue = struct.pack(self.view.format, value)
  7316. *
  7317. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  7318. * itemp[i] = c
  7319. *
  7320. */
  7321. __pyx_t_9 = (__pyx_t_9 + 1);
  7322. /* "View.MemoryView":515
  7323. *
  7324. * for i, c in enumerate(bytesvalue):
  7325. * itemp[i] = c # <<<<<<<<<<<<<<
  7326. *
  7327. * @cname('getbuffer')
  7328. */
  7329. (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  7330. }
  7331. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7332. /* "View.MemoryView":501
  7333. * return result
  7334. *
  7335. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  7336. * """Only used if instantiated manually by the user, or if Cython doesn't
  7337. * know how to convert the type"""
  7338. */
  7339. /* function exit code */
  7340. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7341. goto __pyx_L0;
  7342. __pyx_L1_error:;
  7343. __Pyx_XDECREF(__pyx_t_1);
  7344. __Pyx_XDECREF(__pyx_t_4);
  7345. __Pyx_XDECREF(__pyx_t_5);
  7346. __Pyx_XDECREF(__pyx_t_6);
  7347. __Pyx_XDECREF(__pyx_t_8);
  7348. __Pyx_XDECREF(__pyx_t_10);
  7349. __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7350. __pyx_r = 0;
  7351. __pyx_L0:;
  7352. __Pyx_XDECREF(__pyx_v_struct);
  7353. __Pyx_XDECREF(__pyx_v_bytesvalue);
  7354. __Pyx_XGIVEREF(__pyx_r);
  7355. __Pyx_RefNannyFinishContext();
  7356. return __pyx_r;
  7357. }
  7358. /* "View.MemoryView":518
  7359. *
  7360. * @cname('getbuffer')
  7361. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  7362. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7363. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7364. */
  7365. /* Python wrapper */
  7366. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  7367. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  7368. int __pyx_r;
  7369. __Pyx_RefNannyDeclarations
  7370. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  7371. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  7372. /* function exit code */
  7373. __Pyx_RefNannyFinishContext();
  7374. return __pyx_r;
  7375. }
  7376. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  7377. int __pyx_r;
  7378. __Pyx_RefNannyDeclarations
  7379. int __pyx_t_1;
  7380. int __pyx_t_2;
  7381. PyObject *__pyx_t_3 = NULL;
  7382. Py_ssize_t *__pyx_t_4;
  7383. char *__pyx_t_5;
  7384. void *__pyx_t_6;
  7385. int __pyx_t_7;
  7386. Py_ssize_t __pyx_t_8;
  7387. int __pyx_lineno = 0;
  7388. const char *__pyx_filename = NULL;
  7389. int __pyx_clineno = 0;
  7390. if (__pyx_v_info == NULL) {
  7391. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  7392. return -1;
  7393. }
  7394. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  7395. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  7396. __Pyx_GIVEREF(__pyx_v_info->obj);
  7397. /* "View.MemoryView":519
  7398. * @cname('getbuffer')
  7399. * def __getbuffer__(self, Py_buffer *info, int flags):
  7400. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  7401. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7402. *
  7403. */
  7404. __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  7405. if (__pyx_t_2) {
  7406. } else {
  7407. __pyx_t_1 = __pyx_t_2;
  7408. goto __pyx_L4_bool_binop_done;
  7409. }
  7410. __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  7411. __pyx_t_1 = __pyx_t_2;
  7412. __pyx_L4_bool_binop_done:;
  7413. if (unlikely(__pyx_t_1)) {
  7414. /* "View.MemoryView":520
  7415. * def __getbuffer__(self, Py_buffer *info, int flags):
  7416. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7417. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  7418. *
  7419. * if flags & PyBUF_ND:
  7420. */
  7421. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
  7422. __Pyx_GOTREF(__pyx_t_3);
  7423. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  7424. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7425. __PYX_ERR(2, 520, __pyx_L1_error)
  7426. /* "View.MemoryView":519
  7427. * @cname('getbuffer')
  7428. * def __getbuffer__(self, Py_buffer *info, int flags):
  7429. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  7430. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7431. *
  7432. */
  7433. }
  7434. /* "View.MemoryView":522
  7435. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7436. *
  7437. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  7438. * info.shape = self.view.shape
  7439. * else:
  7440. */
  7441. __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  7442. if (__pyx_t_1) {
  7443. /* "View.MemoryView":523
  7444. *
  7445. * if flags & PyBUF_ND:
  7446. * info.shape = self.view.shape # <<<<<<<<<<<<<<
  7447. * else:
  7448. * info.shape = NULL
  7449. */
  7450. __pyx_t_4 = __pyx_v_self->view.shape;
  7451. __pyx_v_info->shape = __pyx_t_4;
  7452. /* "View.MemoryView":522
  7453. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7454. *
  7455. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  7456. * info.shape = self.view.shape
  7457. * else:
  7458. */
  7459. goto __pyx_L6;
  7460. }
  7461. /* "View.MemoryView":525
  7462. * info.shape = self.view.shape
  7463. * else:
  7464. * info.shape = NULL # <<<<<<<<<<<<<<
  7465. *
  7466. * if flags & PyBUF_STRIDES:
  7467. */
  7468. /*else*/ {
  7469. __pyx_v_info->shape = NULL;
  7470. }
  7471. __pyx_L6:;
  7472. /* "View.MemoryView":527
  7473. * info.shape = NULL
  7474. *
  7475. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  7476. * info.strides = self.view.strides
  7477. * else:
  7478. */
  7479. __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  7480. if (__pyx_t_1) {
  7481. /* "View.MemoryView":528
  7482. *
  7483. * if flags & PyBUF_STRIDES:
  7484. * info.strides = self.view.strides # <<<<<<<<<<<<<<
  7485. * else:
  7486. * info.strides = NULL
  7487. */
  7488. __pyx_t_4 = __pyx_v_self->view.strides;
  7489. __pyx_v_info->strides = __pyx_t_4;
  7490. /* "View.MemoryView":527
  7491. * info.shape = NULL
  7492. *
  7493. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  7494. * info.strides = self.view.strides
  7495. * else:
  7496. */
  7497. goto __pyx_L7;
  7498. }
  7499. /* "View.MemoryView":530
  7500. * info.strides = self.view.strides
  7501. * else:
  7502. * info.strides = NULL # <<<<<<<<<<<<<<
  7503. *
  7504. * if flags & PyBUF_INDIRECT:
  7505. */
  7506. /*else*/ {
  7507. __pyx_v_info->strides = NULL;
  7508. }
  7509. __pyx_L7:;
  7510. /* "View.MemoryView":532
  7511. * info.strides = NULL
  7512. *
  7513. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  7514. * info.suboffsets = self.view.suboffsets
  7515. * else:
  7516. */
  7517. __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  7518. if (__pyx_t_1) {
  7519. /* "View.MemoryView":533
  7520. *
  7521. * if flags & PyBUF_INDIRECT:
  7522. * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
  7523. * else:
  7524. * info.suboffsets = NULL
  7525. */
  7526. __pyx_t_4 = __pyx_v_self->view.suboffsets;
  7527. __pyx_v_info->suboffsets = __pyx_t_4;
  7528. /* "View.MemoryView":532
  7529. * info.strides = NULL
  7530. *
  7531. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  7532. * info.suboffsets = self.view.suboffsets
  7533. * else:
  7534. */
  7535. goto __pyx_L8;
  7536. }
  7537. /* "View.MemoryView":535
  7538. * info.suboffsets = self.view.suboffsets
  7539. * else:
  7540. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  7541. *
  7542. * if flags & PyBUF_FORMAT:
  7543. */
  7544. /*else*/ {
  7545. __pyx_v_info->suboffsets = NULL;
  7546. }
  7547. __pyx_L8:;
  7548. /* "View.MemoryView":537
  7549. * info.suboffsets = NULL
  7550. *
  7551. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  7552. * info.format = self.view.format
  7553. * else:
  7554. */
  7555. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  7556. if (__pyx_t_1) {
  7557. /* "View.MemoryView":538
  7558. *
  7559. * if flags & PyBUF_FORMAT:
  7560. * info.format = self.view.format # <<<<<<<<<<<<<<
  7561. * else:
  7562. * info.format = NULL
  7563. */
  7564. __pyx_t_5 = __pyx_v_self->view.format;
  7565. __pyx_v_info->format = __pyx_t_5;
  7566. /* "View.MemoryView":537
  7567. * info.suboffsets = NULL
  7568. *
  7569. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  7570. * info.format = self.view.format
  7571. * else:
  7572. */
  7573. goto __pyx_L9;
  7574. }
  7575. /* "View.MemoryView":540
  7576. * info.format = self.view.format
  7577. * else:
  7578. * info.format = NULL # <<<<<<<<<<<<<<
  7579. *
  7580. * info.buf = self.view.buf
  7581. */
  7582. /*else*/ {
  7583. __pyx_v_info->format = NULL;
  7584. }
  7585. __pyx_L9:;
  7586. /* "View.MemoryView":542
  7587. * info.format = NULL
  7588. *
  7589. * info.buf = self.view.buf # <<<<<<<<<<<<<<
  7590. * info.ndim = self.view.ndim
  7591. * info.itemsize = self.view.itemsize
  7592. */
  7593. __pyx_t_6 = __pyx_v_self->view.buf;
  7594. __pyx_v_info->buf = __pyx_t_6;
  7595. /* "View.MemoryView":543
  7596. *
  7597. * info.buf = self.view.buf
  7598. * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
  7599. * info.itemsize = self.view.itemsize
  7600. * info.len = self.view.len
  7601. */
  7602. __pyx_t_7 = __pyx_v_self->view.ndim;
  7603. __pyx_v_info->ndim = __pyx_t_7;
  7604. /* "View.MemoryView":544
  7605. * info.buf = self.view.buf
  7606. * info.ndim = self.view.ndim
  7607. * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
  7608. * info.len = self.view.len
  7609. * info.readonly = self.view.readonly
  7610. */
  7611. __pyx_t_8 = __pyx_v_self->view.itemsize;
  7612. __pyx_v_info->itemsize = __pyx_t_8;
  7613. /* "View.MemoryView":545
  7614. * info.ndim = self.view.ndim
  7615. * info.itemsize = self.view.itemsize
  7616. * info.len = self.view.len # <<<<<<<<<<<<<<
  7617. * info.readonly = self.view.readonly
  7618. * info.obj = self
  7619. */
  7620. __pyx_t_8 = __pyx_v_self->view.len;
  7621. __pyx_v_info->len = __pyx_t_8;
  7622. /* "View.MemoryView":546
  7623. * info.itemsize = self.view.itemsize
  7624. * info.len = self.view.len
  7625. * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
  7626. * info.obj = self
  7627. *
  7628. */
  7629. __pyx_t_1 = __pyx_v_self->view.readonly;
  7630. __pyx_v_info->readonly = __pyx_t_1;
  7631. /* "View.MemoryView":547
  7632. * info.len = self.view.len
  7633. * info.readonly = self.view.readonly
  7634. * info.obj = self # <<<<<<<<<<<<<<
  7635. *
  7636. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  7637. */
  7638. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  7639. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  7640. __Pyx_GOTREF(__pyx_v_info->obj);
  7641. __Pyx_DECREF(__pyx_v_info->obj);
  7642. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  7643. /* "View.MemoryView":518
  7644. *
  7645. * @cname('getbuffer')
  7646. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  7647. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7648. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7649. */
  7650. /* function exit code */
  7651. __pyx_r = 0;
  7652. goto __pyx_L0;
  7653. __pyx_L1_error:;
  7654. __Pyx_XDECREF(__pyx_t_3);
  7655. __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7656. __pyx_r = -1;
  7657. if (__pyx_v_info->obj != NULL) {
  7658. __Pyx_GOTREF(__pyx_v_info->obj);
  7659. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7660. }
  7661. goto __pyx_L2;
  7662. __pyx_L0:;
  7663. if (__pyx_v_info->obj == Py_None) {
  7664. __Pyx_GOTREF(__pyx_v_info->obj);
  7665. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7666. }
  7667. __pyx_L2:;
  7668. __Pyx_RefNannyFinishContext();
  7669. return __pyx_r;
  7670. }
  7671. /* "View.MemoryView":553
  7672. *
  7673. * @property
  7674. * def T(self): # <<<<<<<<<<<<<<
  7675. * cdef _memoryviewslice result = memoryview_copy(self)
  7676. * transpose_memslice(&result.from_slice)
  7677. */
  7678. /* Python wrapper */
  7679. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
  7680. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  7681. PyObject *__pyx_r = 0;
  7682. __Pyx_RefNannyDeclarations
  7683. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7684. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7685. /* function exit code */
  7686. __Pyx_RefNannyFinishContext();
  7687. return __pyx_r;
  7688. }
  7689. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7690. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  7691. PyObject *__pyx_r = NULL;
  7692. __Pyx_RefNannyDeclarations
  7693. PyObject *__pyx_t_1 = NULL;
  7694. int __pyx_t_2;
  7695. int __pyx_lineno = 0;
  7696. const char *__pyx_filename = NULL;
  7697. int __pyx_clineno = 0;
  7698. __Pyx_RefNannySetupContext("__get__", 0);
  7699. /* "View.MemoryView":554
  7700. * @property
  7701. * def T(self):
  7702. * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
  7703. * transpose_memslice(&result.from_slice)
  7704. * return result
  7705. */
  7706. __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
  7707. __Pyx_GOTREF(__pyx_t_1);
  7708. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
  7709. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  7710. __pyx_t_1 = 0;
  7711. /* "View.MemoryView":555
  7712. * def T(self):
  7713. * cdef _memoryviewslice result = memoryview_copy(self)
  7714. * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
  7715. * return result
  7716. *
  7717. */
  7718. __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
  7719. /* "View.MemoryView":556
  7720. * cdef _memoryviewslice result = memoryview_copy(self)
  7721. * transpose_memslice(&result.from_slice)
  7722. * return result # <<<<<<<<<<<<<<
  7723. *
  7724. * @property
  7725. */
  7726. __Pyx_XDECREF(__pyx_r);
  7727. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  7728. __pyx_r = ((PyObject *)__pyx_v_result);
  7729. goto __pyx_L0;
  7730. /* "View.MemoryView":553
  7731. *
  7732. * @property
  7733. * def T(self): # <<<<<<<<<<<<<<
  7734. * cdef _memoryviewslice result = memoryview_copy(self)
  7735. * transpose_memslice(&result.from_slice)
  7736. */
  7737. /* function exit code */
  7738. __pyx_L1_error:;
  7739. __Pyx_XDECREF(__pyx_t_1);
  7740. __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7741. __pyx_r = NULL;
  7742. __pyx_L0:;
  7743. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  7744. __Pyx_XGIVEREF(__pyx_r);
  7745. __Pyx_RefNannyFinishContext();
  7746. return __pyx_r;
  7747. }
  7748. /* "View.MemoryView":559
  7749. *
  7750. * @property
  7751. * def base(self): # <<<<<<<<<<<<<<
  7752. * return self.obj
  7753. *
  7754. */
  7755. /* Python wrapper */
  7756. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  7757. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  7758. PyObject *__pyx_r = 0;
  7759. __Pyx_RefNannyDeclarations
  7760. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7761. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7762. /* function exit code */
  7763. __Pyx_RefNannyFinishContext();
  7764. return __pyx_r;
  7765. }
  7766. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7767. PyObject *__pyx_r = NULL;
  7768. __Pyx_RefNannyDeclarations
  7769. __Pyx_RefNannySetupContext("__get__", 0);
  7770. /* "View.MemoryView":560
  7771. * @property
  7772. * def base(self):
  7773. * return self.obj # <<<<<<<<<<<<<<
  7774. *
  7775. * @property
  7776. */
  7777. __Pyx_XDECREF(__pyx_r);
  7778. __Pyx_INCREF(__pyx_v_self->obj);
  7779. __pyx_r = __pyx_v_self->obj;
  7780. goto __pyx_L0;
  7781. /* "View.MemoryView":559
  7782. *
  7783. * @property
  7784. * def base(self): # <<<<<<<<<<<<<<
  7785. * return self.obj
  7786. *
  7787. */
  7788. /* function exit code */
  7789. __pyx_L0:;
  7790. __Pyx_XGIVEREF(__pyx_r);
  7791. __Pyx_RefNannyFinishContext();
  7792. return __pyx_r;
  7793. }
  7794. /* "View.MemoryView":563
  7795. *
  7796. * @property
  7797. * def shape(self): # <<<<<<<<<<<<<<
  7798. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  7799. *
  7800. */
  7801. /* Python wrapper */
  7802. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
  7803. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  7804. PyObject *__pyx_r = 0;
  7805. __Pyx_RefNannyDeclarations
  7806. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7807. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7808. /* function exit code */
  7809. __Pyx_RefNannyFinishContext();
  7810. return __pyx_r;
  7811. }
  7812. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7813. Py_ssize_t __pyx_v_length;
  7814. PyObject *__pyx_r = NULL;
  7815. __Pyx_RefNannyDeclarations
  7816. PyObject *__pyx_t_1 = NULL;
  7817. Py_ssize_t *__pyx_t_2;
  7818. Py_ssize_t *__pyx_t_3;
  7819. Py_ssize_t *__pyx_t_4;
  7820. PyObject *__pyx_t_5 = NULL;
  7821. int __pyx_lineno = 0;
  7822. const char *__pyx_filename = NULL;
  7823. int __pyx_clineno = 0;
  7824. __Pyx_RefNannySetupContext("__get__", 0);
  7825. /* "View.MemoryView":564
  7826. * @property
  7827. * def shape(self):
  7828. * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
  7829. *
  7830. * @property
  7831. */
  7832. __Pyx_XDECREF(__pyx_r);
  7833. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
  7834. __Pyx_GOTREF(__pyx_t_1);
  7835. __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  7836. for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  7837. __pyx_t_2 = __pyx_t_4;
  7838. __pyx_v_length = (__pyx_t_2[0]);
  7839. __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
  7840. __Pyx_GOTREF(__pyx_t_5);
  7841. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
  7842. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7843. }
  7844. __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
  7845. __Pyx_GOTREF(__pyx_t_5);
  7846. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7847. __pyx_r = __pyx_t_5;
  7848. __pyx_t_5 = 0;
  7849. goto __pyx_L0;
  7850. /* "View.MemoryView":563
  7851. *
  7852. * @property
  7853. * def shape(self): # <<<<<<<<<<<<<<
  7854. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  7855. *
  7856. */
  7857. /* function exit code */
  7858. __pyx_L1_error:;
  7859. __Pyx_XDECREF(__pyx_t_1);
  7860. __Pyx_XDECREF(__pyx_t_5);
  7861. __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7862. __pyx_r = NULL;
  7863. __pyx_L0:;
  7864. __Pyx_XGIVEREF(__pyx_r);
  7865. __Pyx_RefNannyFinishContext();
  7866. return __pyx_r;
  7867. }
  7868. /* "View.MemoryView":567
  7869. *
  7870. * @property
  7871. * def strides(self): # <<<<<<<<<<<<<<
  7872. * if self.view.strides == NULL:
  7873. *
  7874. */
  7875. /* Python wrapper */
  7876. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
  7877. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  7878. PyObject *__pyx_r = 0;
  7879. __Pyx_RefNannyDeclarations
  7880. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7881. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7882. /* function exit code */
  7883. __Pyx_RefNannyFinishContext();
  7884. return __pyx_r;
  7885. }
  7886. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7887. Py_ssize_t __pyx_v_stride;
  7888. PyObject *__pyx_r = NULL;
  7889. __Pyx_RefNannyDeclarations
  7890. int __pyx_t_1;
  7891. PyObject *__pyx_t_2 = NULL;
  7892. Py_ssize_t *__pyx_t_3;
  7893. Py_ssize_t *__pyx_t_4;
  7894. Py_ssize_t *__pyx_t_5;
  7895. PyObject *__pyx_t_6 = NULL;
  7896. int __pyx_lineno = 0;
  7897. const char *__pyx_filename = NULL;
  7898. int __pyx_clineno = 0;
  7899. __Pyx_RefNannySetupContext("__get__", 0);
  7900. /* "View.MemoryView":568
  7901. * @property
  7902. * def strides(self):
  7903. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  7904. *
  7905. * raise ValueError("Buffer view does not expose strides")
  7906. */
  7907. __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  7908. if (unlikely(__pyx_t_1)) {
  7909. /* "View.MemoryView":570
  7910. * if self.view.strides == NULL:
  7911. *
  7912. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  7913. *
  7914. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  7915. */
  7916. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
  7917. __Pyx_GOTREF(__pyx_t_2);
  7918. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  7919. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7920. __PYX_ERR(2, 570, __pyx_L1_error)
  7921. /* "View.MemoryView":568
  7922. * @property
  7923. * def strides(self):
  7924. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  7925. *
  7926. * raise ValueError("Buffer view does not expose strides")
  7927. */
  7928. }
  7929. /* "View.MemoryView":572
  7930. * raise ValueError("Buffer view does not expose strides")
  7931. *
  7932. * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
  7933. *
  7934. * @property
  7935. */
  7936. __Pyx_XDECREF(__pyx_r);
  7937. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
  7938. __Pyx_GOTREF(__pyx_t_2);
  7939. __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  7940. for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  7941. __pyx_t_3 = __pyx_t_5;
  7942. __pyx_v_stride = (__pyx_t_3[0]);
  7943. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
  7944. __Pyx_GOTREF(__pyx_t_6);
  7945. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
  7946. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7947. }
  7948. __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
  7949. __Pyx_GOTREF(__pyx_t_6);
  7950. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7951. __pyx_r = __pyx_t_6;
  7952. __pyx_t_6 = 0;
  7953. goto __pyx_L0;
  7954. /* "View.MemoryView":567
  7955. *
  7956. * @property
  7957. * def strides(self): # <<<<<<<<<<<<<<
  7958. * if self.view.strides == NULL:
  7959. *
  7960. */
  7961. /* function exit code */
  7962. __pyx_L1_error:;
  7963. __Pyx_XDECREF(__pyx_t_2);
  7964. __Pyx_XDECREF(__pyx_t_6);
  7965. __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7966. __pyx_r = NULL;
  7967. __pyx_L0:;
  7968. __Pyx_XGIVEREF(__pyx_r);
  7969. __Pyx_RefNannyFinishContext();
  7970. return __pyx_r;
  7971. }
  7972. /* "View.MemoryView":575
  7973. *
  7974. * @property
  7975. * def suboffsets(self): # <<<<<<<<<<<<<<
  7976. * if self.view.suboffsets == NULL:
  7977. * return (-1,) * self.view.ndim
  7978. */
  7979. /* Python wrapper */
  7980. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
  7981. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  7982. PyObject *__pyx_r = 0;
  7983. __Pyx_RefNannyDeclarations
  7984. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7985. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7986. /* function exit code */
  7987. __Pyx_RefNannyFinishContext();
  7988. return __pyx_r;
  7989. }
  7990. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7991. Py_ssize_t __pyx_v_suboffset;
  7992. PyObject *__pyx_r = NULL;
  7993. __Pyx_RefNannyDeclarations
  7994. int __pyx_t_1;
  7995. PyObject *__pyx_t_2 = NULL;
  7996. PyObject *__pyx_t_3 = NULL;
  7997. Py_ssize_t *__pyx_t_4;
  7998. Py_ssize_t *__pyx_t_5;
  7999. Py_ssize_t *__pyx_t_6;
  8000. int __pyx_lineno = 0;
  8001. const char *__pyx_filename = NULL;
  8002. int __pyx_clineno = 0;
  8003. __Pyx_RefNannySetupContext("__get__", 0);
  8004. /* "View.MemoryView":576
  8005. * @property
  8006. * def suboffsets(self):
  8007. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  8008. * return (-1,) * self.view.ndim
  8009. *
  8010. */
  8011. __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  8012. if (__pyx_t_1) {
  8013. /* "View.MemoryView":577
  8014. * def suboffsets(self):
  8015. * if self.view.suboffsets == NULL:
  8016. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  8017. *
  8018. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  8019. */
  8020. __Pyx_XDECREF(__pyx_r);
  8021. __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
  8022. __Pyx_GOTREF(__pyx_t_2);
  8023. __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__12, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
  8024. __Pyx_GOTREF(__pyx_t_3);
  8025. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8026. __pyx_r = __pyx_t_3;
  8027. __pyx_t_3 = 0;
  8028. goto __pyx_L0;
  8029. /* "View.MemoryView":576
  8030. * @property
  8031. * def suboffsets(self):
  8032. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  8033. * return (-1,) * self.view.ndim
  8034. *
  8035. */
  8036. }
  8037. /* "View.MemoryView":579
  8038. * return (-1,) * self.view.ndim
  8039. *
  8040. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
  8041. *
  8042. * @property
  8043. */
  8044. __Pyx_XDECREF(__pyx_r);
  8045. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
  8046. __Pyx_GOTREF(__pyx_t_3);
  8047. __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  8048. for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
  8049. __pyx_t_4 = __pyx_t_6;
  8050. __pyx_v_suboffset = (__pyx_t_4[0]);
  8051. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
  8052. __Pyx_GOTREF(__pyx_t_2);
  8053. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
  8054. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8055. }
  8056. __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
  8057. __Pyx_GOTREF(__pyx_t_2);
  8058. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8059. __pyx_r = __pyx_t_2;
  8060. __pyx_t_2 = 0;
  8061. goto __pyx_L0;
  8062. /* "View.MemoryView":575
  8063. *
  8064. * @property
  8065. * def suboffsets(self): # <<<<<<<<<<<<<<
  8066. * if self.view.suboffsets == NULL:
  8067. * return (-1,) * self.view.ndim
  8068. */
  8069. /* function exit code */
  8070. __pyx_L1_error:;
  8071. __Pyx_XDECREF(__pyx_t_2);
  8072. __Pyx_XDECREF(__pyx_t_3);
  8073. __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8074. __pyx_r = NULL;
  8075. __pyx_L0:;
  8076. __Pyx_XGIVEREF(__pyx_r);
  8077. __Pyx_RefNannyFinishContext();
  8078. return __pyx_r;
  8079. }
  8080. /* "View.MemoryView":582
  8081. *
  8082. * @property
  8083. * def ndim(self): # <<<<<<<<<<<<<<
  8084. * return self.view.ndim
  8085. *
  8086. */
  8087. /* Python wrapper */
  8088. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
  8089. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  8090. PyObject *__pyx_r = 0;
  8091. __Pyx_RefNannyDeclarations
  8092. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8093. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8094. /* function exit code */
  8095. __Pyx_RefNannyFinishContext();
  8096. return __pyx_r;
  8097. }
  8098. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8099. PyObject *__pyx_r = NULL;
  8100. __Pyx_RefNannyDeclarations
  8101. PyObject *__pyx_t_1 = NULL;
  8102. int __pyx_lineno = 0;
  8103. const char *__pyx_filename = NULL;
  8104. int __pyx_clineno = 0;
  8105. __Pyx_RefNannySetupContext("__get__", 0);
  8106. /* "View.MemoryView":583
  8107. * @property
  8108. * def ndim(self):
  8109. * return self.view.ndim # <<<<<<<<<<<<<<
  8110. *
  8111. * @property
  8112. */
  8113. __Pyx_XDECREF(__pyx_r);
  8114. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
  8115. __Pyx_GOTREF(__pyx_t_1);
  8116. __pyx_r = __pyx_t_1;
  8117. __pyx_t_1 = 0;
  8118. goto __pyx_L0;
  8119. /* "View.MemoryView":582
  8120. *
  8121. * @property
  8122. * def ndim(self): # <<<<<<<<<<<<<<
  8123. * return self.view.ndim
  8124. *
  8125. */
  8126. /* function exit code */
  8127. __pyx_L1_error:;
  8128. __Pyx_XDECREF(__pyx_t_1);
  8129. __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8130. __pyx_r = NULL;
  8131. __pyx_L0:;
  8132. __Pyx_XGIVEREF(__pyx_r);
  8133. __Pyx_RefNannyFinishContext();
  8134. return __pyx_r;
  8135. }
  8136. /* "View.MemoryView":586
  8137. *
  8138. * @property
  8139. * def itemsize(self): # <<<<<<<<<<<<<<
  8140. * return self.view.itemsize
  8141. *
  8142. */
  8143. /* Python wrapper */
  8144. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
  8145. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  8146. PyObject *__pyx_r = 0;
  8147. __Pyx_RefNannyDeclarations
  8148. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8149. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8150. /* function exit code */
  8151. __Pyx_RefNannyFinishContext();
  8152. return __pyx_r;
  8153. }
  8154. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8155. PyObject *__pyx_r = NULL;
  8156. __Pyx_RefNannyDeclarations
  8157. PyObject *__pyx_t_1 = NULL;
  8158. int __pyx_lineno = 0;
  8159. const char *__pyx_filename = NULL;
  8160. int __pyx_clineno = 0;
  8161. __Pyx_RefNannySetupContext("__get__", 0);
  8162. /* "View.MemoryView":587
  8163. * @property
  8164. * def itemsize(self):
  8165. * return self.view.itemsize # <<<<<<<<<<<<<<
  8166. *
  8167. * @property
  8168. */
  8169. __Pyx_XDECREF(__pyx_r);
  8170. __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
  8171. __Pyx_GOTREF(__pyx_t_1);
  8172. __pyx_r = __pyx_t_1;
  8173. __pyx_t_1 = 0;
  8174. goto __pyx_L0;
  8175. /* "View.MemoryView":586
  8176. *
  8177. * @property
  8178. * def itemsize(self): # <<<<<<<<<<<<<<
  8179. * return self.view.itemsize
  8180. *
  8181. */
  8182. /* function exit code */
  8183. __pyx_L1_error:;
  8184. __Pyx_XDECREF(__pyx_t_1);
  8185. __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8186. __pyx_r = NULL;
  8187. __pyx_L0:;
  8188. __Pyx_XGIVEREF(__pyx_r);
  8189. __Pyx_RefNannyFinishContext();
  8190. return __pyx_r;
  8191. }
  8192. /* "View.MemoryView":590
  8193. *
  8194. * @property
  8195. * def nbytes(self): # <<<<<<<<<<<<<<
  8196. * return self.size * self.view.itemsize
  8197. *
  8198. */
  8199. /* Python wrapper */
  8200. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
  8201. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  8202. PyObject *__pyx_r = 0;
  8203. __Pyx_RefNannyDeclarations
  8204. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8205. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8206. /* function exit code */
  8207. __Pyx_RefNannyFinishContext();
  8208. return __pyx_r;
  8209. }
  8210. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8211. PyObject *__pyx_r = NULL;
  8212. __Pyx_RefNannyDeclarations
  8213. PyObject *__pyx_t_1 = NULL;
  8214. PyObject *__pyx_t_2 = NULL;
  8215. PyObject *__pyx_t_3 = NULL;
  8216. int __pyx_lineno = 0;
  8217. const char *__pyx_filename = NULL;
  8218. int __pyx_clineno = 0;
  8219. __Pyx_RefNannySetupContext("__get__", 0);
  8220. /* "View.MemoryView":591
  8221. * @property
  8222. * def nbytes(self):
  8223. * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
  8224. *
  8225. * @property
  8226. */
  8227. __Pyx_XDECREF(__pyx_r);
  8228. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
  8229. __Pyx_GOTREF(__pyx_t_1);
  8230. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
  8231. __Pyx_GOTREF(__pyx_t_2);
  8232. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
  8233. __Pyx_GOTREF(__pyx_t_3);
  8234. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8235. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8236. __pyx_r = __pyx_t_3;
  8237. __pyx_t_3 = 0;
  8238. goto __pyx_L0;
  8239. /* "View.MemoryView":590
  8240. *
  8241. * @property
  8242. * def nbytes(self): # <<<<<<<<<<<<<<
  8243. * return self.size * self.view.itemsize
  8244. *
  8245. */
  8246. /* function exit code */
  8247. __pyx_L1_error:;
  8248. __Pyx_XDECREF(__pyx_t_1);
  8249. __Pyx_XDECREF(__pyx_t_2);
  8250. __Pyx_XDECREF(__pyx_t_3);
  8251. __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8252. __pyx_r = NULL;
  8253. __pyx_L0:;
  8254. __Pyx_XGIVEREF(__pyx_r);
  8255. __Pyx_RefNannyFinishContext();
  8256. return __pyx_r;
  8257. }
  8258. /* "View.MemoryView":594
  8259. *
  8260. * @property
  8261. * def size(self): # <<<<<<<<<<<<<<
  8262. * if self._size is None:
  8263. * result = 1
  8264. */
  8265. /* Python wrapper */
  8266. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
  8267. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  8268. PyObject *__pyx_r = 0;
  8269. __Pyx_RefNannyDeclarations
  8270. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8271. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8272. /* function exit code */
  8273. __Pyx_RefNannyFinishContext();
  8274. return __pyx_r;
  8275. }
  8276. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8277. PyObject *__pyx_v_result = NULL;
  8278. PyObject *__pyx_v_length = NULL;
  8279. PyObject *__pyx_r = NULL;
  8280. __Pyx_RefNannyDeclarations
  8281. int __pyx_t_1;
  8282. int __pyx_t_2;
  8283. Py_ssize_t *__pyx_t_3;
  8284. Py_ssize_t *__pyx_t_4;
  8285. Py_ssize_t *__pyx_t_5;
  8286. PyObject *__pyx_t_6 = NULL;
  8287. int __pyx_lineno = 0;
  8288. const char *__pyx_filename = NULL;
  8289. int __pyx_clineno = 0;
  8290. __Pyx_RefNannySetupContext("__get__", 0);
  8291. /* "View.MemoryView":595
  8292. * @property
  8293. * def size(self):
  8294. * if self._size is None: # <<<<<<<<<<<<<<
  8295. * result = 1
  8296. *
  8297. */
  8298. __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  8299. __pyx_t_2 = (__pyx_t_1 != 0);
  8300. if (__pyx_t_2) {
  8301. /* "View.MemoryView":596
  8302. * def size(self):
  8303. * if self._size is None:
  8304. * result = 1 # <<<<<<<<<<<<<<
  8305. *
  8306. * for length in self.view.shape[:self.view.ndim]:
  8307. */
  8308. __Pyx_INCREF(__pyx_int_1);
  8309. __pyx_v_result = __pyx_int_1;
  8310. /* "View.MemoryView":598
  8311. * result = 1
  8312. *
  8313. * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
  8314. * result *= length
  8315. *
  8316. */
  8317. __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  8318. for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  8319. __pyx_t_3 = __pyx_t_5;
  8320. __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
  8321. __Pyx_GOTREF(__pyx_t_6);
  8322. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
  8323. __pyx_t_6 = 0;
  8324. /* "View.MemoryView":599
  8325. *
  8326. * for length in self.view.shape[:self.view.ndim]:
  8327. * result *= length # <<<<<<<<<<<<<<
  8328. *
  8329. * self._size = result
  8330. */
  8331. __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
  8332. __Pyx_GOTREF(__pyx_t_6);
  8333. __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
  8334. __pyx_t_6 = 0;
  8335. }
  8336. /* "View.MemoryView":601
  8337. * result *= length
  8338. *
  8339. * self._size = result # <<<<<<<<<<<<<<
  8340. *
  8341. * return self._size
  8342. */
  8343. __Pyx_INCREF(__pyx_v_result);
  8344. __Pyx_GIVEREF(__pyx_v_result);
  8345. __Pyx_GOTREF(__pyx_v_self->_size);
  8346. __Pyx_DECREF(__pyx_v_self->_size);
  8347. __pyx_v_self->_size = __pyx_v_result;
  8348. /* "View.MemoryView":595
  8349. * @property
  8350. * def size(self):
  8351. * if self._size is None: # <<<<<<<<<<<<<<
  8352. * result = 1
  8353. *
  8354. */
  8355. }
  8356. /* "View.MemoryView":603
  8357. * self._size = result
  8358. *
  8359. * return self._size # <<<<<<<<<<<<<<
  8360. *
  8361. * def __len__(self):
  8362. */
  8363. __Pyx_XDECREF(__pyx_r);
  8364. __Pyx_INCREF(__pyx_v_self->_size);
  8365. __pyx_r = __pyx_v_self->_size;
  8366. goto __pyx_L0;
  8367. /* "View.MemoryView":594
  8368. *
  8369. * @property
  8370. * def size(self): # <<<<<<<<<<<<<<
  8371. * if self._size is None:
  8372. * result = 1
  8373. */
  8374. /* function exit code */
  8375. __pyx_L1_error:;
  8376. __Pyx_XDECREF(__pyx_t_6);
  8377. __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8378. __pyx_r = NULL;
  8379. __pyx_L0:;
  8380. __Pyx_XDECREF(__pyx_v_result);
  8381. __Pyx_XDECREF(__pyx_v_length);
  8382. __Pyx_XGIVEREF(__pyx_r);
  8383. __Pyx_RefNannyFinishContext();
  8384. return __pyx_r;
  8385. }
  8386. /* "View.MemoryView":605
  8387. * return self._size
  8388. *
  8389. * def __len__(self): # <<<<<<<<<<<<<<
  8390. * if self.view.ndim >= 1:
  8391. * return self.view.shape[0]
  8392. */
  8393. /* Python wrapper */
  8394. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
  8395. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  8396. Py_ssize_t __pyx_r;
  8397. __Pyx_RefNannyDeclarations
  8398. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  8399. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8400. /* function exit code */
  8401. __Pyx_RefNannyFinishContext();
  8402. return __pyx_r;
  8403. }
  8404. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8405. Py_ssize_t __pyx_r;
  8406. __Pyx_RefNannyDeclarations
  8407. int __pyx_t_1;
  8408. __Pyx_RefNannySetupContext("__len__", 0);
  8409. /* "View.MemoryView":606
  8410. *
  8411. * def __len__(self):
  8412. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  8413. * return self.view.shape[0]
  8414. *
  8415. */
  8416. __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  8417. if (__pyx_t_1) {
  8418. /* "View.MemoryView":607
  8419. * def __len__(self):
  8420. * if self.view.ndim >= 1:
  8421. * return self.view.shape[0] # <<<<<<<<<<<<<<
  8422. *
  8423. * return 0
  8424. */
  8425. __pyx_r = (__pyx_v_self->view.shape[0]);
  8426. goto __pyx_L0;
  8427. /* "View.MemoryView":606
  8428. *
  8429. * def __len__(self):
  8430. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  8431. * return self.view.shape[0]
  8432. *
  8433. */
  8434. }
  8435. /* "View.MemoryView":609
  8436. * return self.view.shape[0]
  8437. *
  8438. * return 0 # <<<<<<<<<<<<<<
  8439. *
  8440. * def __repr__(self):
  8441. */
  8442. __pyx_r = 0;
  8443. goto __pyx_L0;
  8444. /* "View.MemoryView":605
  8445. * return self._size
  8446. *
  8447. * def __len__(self): # <<<<<<<<<<<<<<
  8448. * if self.view.ndim >= 1:
  8449. * return self.view.shape[0]
  8450. */
  8451. /* function exit code */
  8452. __pyx_L0:;
  8453. __Pyx_RefNannyFinishContext();
  8454. return __pyx_r;
  8455. }
  8456. /* "View.MemoryView":611
  8457. * return 0
  8458. *
  8459. * def __repr__(self): # <<<<<<<<<<<<<<
  8460. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8461. * id(self))
  8462. */
  8463. /* Python wrapper */
  8464. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
  8465. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  8466. PyObject *__pyx_r = 0;
  8467. __Pyx_RefNannyDeclarations
  8468. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  8469. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8470. /* function exit code */
  8471. __Pyx_RefNannyFinishContext();
  8472. return __pyx_r;
  8473. }
  8474. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8475. PyObject *__pyx_r = NULL;
  8476. __Pyx_RefNannyDeclarations
  8477. PyObject *__pyx_t_1 = NULL;
  8478. PyObject *__pyx_t_2 = NULL;
  8479. PyObject *__pyx_t_3 = NULL;
  8480. int __pyx_lineno = 0;
  8481. const char *__pyx_filename = NULL;
  8482. int __pyx_clineno = 0;
  8483. __Pyx_RefNannySetupContext("__repr__", 0);
  8484. /* "View.MemoryView":612
  8485. *
  8486. * def __repr__(self):
  8487. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  8488. * id(self))
  8489. *
  8490. */
  8491. __Pyx_XDECREF(__pyx_r);
  8492. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
  8493. __Pyx_GOTREF(__pyx_t_1);
  8494. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
  8495. __Pyx_GOTREF(__pyx_t_2);
  8496. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8497. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
  8498. __Pyx_GOTREF(__pyx_t_1);
  8499. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8500. /* "View.MemoryView":613
  8501. * def __repr__(self):
  8502. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8503. * id(self)) # <<<<<<<<<<<<<<
  8504. *
  8505. * def __str__(self):
  8506. */
  8507. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
  8508. __Pyx_GOTREF(__pyx_t_2);
  8509. /* "View.MemoryView":612
  8510. *
  8511. * def __repr__(self):
  8512. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  8513. * id(self))
  8514. *
  8515. */
  8516. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
  8517. __Pyx_GOTREF(__pyx_t_3);
  8518. __Pyx_GIVEREF(__pyx_t_1);
  8519. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  8520. __Pyx_GIVEREF(__pyx_t_2);
  8521. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  8522. __pyx_t_1 = 0;
  8523. __pyx_t_2 = 0;
  8524. __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
  8525. __Pyx_GOTREF(__pyx_t_2);
  8526. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8527. __pyx_r = __pyx_t_2;
  8528. __pyx_t_2 = 0;
  8529. goto __pyx_L0;
  8530. /* "View.MemoryView":611
  8531. * return 0
  8532. *
  8533. * def __repr__(self): # <<<<<<<<<<<<<<
  8534. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8535. * id(self))
  8536. */
  8537. /* function exit code */
  8538. __pyx_L1_error:;
  8539. __Pyx_XDECREF(__pyx_t_1);
  8540. __Pyx_XDECREF(__pyx_t_2);
  8541. __Pyx_XDECREF(__pyx_t_3);
  8542. __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8543. __pyx_r = NULL;
  8544. __pyx_L0:;
  8545. __Pyx_XGIVEREF(__pyx_r);
  8546. __Pyx_RefNannyFinishContext();
  8547. return __pyx_r;
  8548. }
  8549. /* "View.MemoryView":615
  8550. * id(self))
  8551. *
  8552. * def __str__(self): # <<<<<<<<<<<<<<
  8553. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  8554. *
  8555. */
  8556. /* Python wrapper */
  8557. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
  8558. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  8559. PyObject *__pyx_r = 0;
  8560. __Pyx_RefNannyDeclarations
  8561. __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  8562. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8563. /* function exit code */
  8564. __Pyx_RefNannyFinishContext();
  8565. return __pyx_r;
  8566. }
  8567. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8568. PyObject *__pyx_r = NULL;
  8569. __Pyx_RefNannyDeclarations
  8570. PyObject *__pyx_t_1 = NULL;
  8571. PyObject *__pyx_t_2 = NULL;
  8572. int __pyx_lineno = 0;
  8573. const char *__pyx_filename = NULL;
  8574. int __pyx_clineno = 0;
  8575. __Pyx_RefNannySetupContext("__str__", 0);
  8576. /* "View.MemoryView":616
  8577. *
  8578. * def __str__(self):
  8579. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
  8580. *
  8581. *
  8582. */
  8583. __Pyx_XDECREF(__pyx_r);
  8584. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  8585. __Pyx_GOTREF(__pyx_t_1);
  8586. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
  8587. __Pyx_GOTREF(__pyx_t_2);
  8588. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8589. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  8590. __Pyx_GOTREF(__pyx_t_1);
  8591. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8592. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
  8593. __Pyx_GOTREF(__pyx_t_2);
  8594. __Pyx_GIVEREF(__pyx_t_1);
  8595. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  8596. __pyx_t_1 = 0;
  8597. __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  8598. __Pyx_GOTREF(__pyx_t_1);
  8599. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8600. __pyx_r = __pyx_t_1;
  8601. __pyx_t_1 = 0;
  8602. goto __pyx_L0;
  8603. /* "View.MemoryView":615
  8604. * id(self))
  8605. *
  8606. * def __str__(self): # <<<<<<<<<<<<<<
  8607. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  8608. *
  8609. */
  8610. /* function exit code */
  8611. __pyx_L1_error:;
  8612. __Pyx_XDECREF(__pyx_t_1);
  8613. __Pyx_XDECREF(__pyx_t_2);
  8614. __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8615. __pyx_r = NULL;
  8616. __pyx_L0:;
  8617. __Pyx_XGIVEREF(__pyx_r);
  8618. __Pyx_RefNannyFinishContext();
  8619. return __pyx_r;
  8620. }
  8621. /* "View.MemoryView":619
  8622. *
  8623. *
  8624. * def is_c_contig(self): # <<<<<<<<<<<<<<
  8625. * cdef __Pyx_memviewslice *mslice
  8626. * cdef __Pyx_memviewslice tmp
  8627. */
  8628. /* Python wrapper */
  8629. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8630. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8631. PyObject *__pyx_r = 0;
  8632. __Pyx_RefNannyDeclarations
  8633. __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  8634. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8635. /* function exit code */
  8636. __Pyx_RefNannyFinishContext();
  8637. return __pyx_r;
  8638. }
  8639. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  8640. __Pyx_memviewslice *__pyx_v_mslice;
  8641. __Pyx_memviewslice __pyx_v_tmp;
  8642. PyObject *__pyx_r = NULL;
  8643. __Pyx_RefNannyDeclarations
  8644. __Pyx_memviewslice *__pyx_t_1;
  8645. PyObject *__pyx_t_2 = NULL;
  8646. int __pyx_lineno = 0;
  8647. const char *__pyx_filename = NULL;
  8648. int __pyx_clineno = 0;
  8649. __Pyx_RefNannySetupContext("is_c_contig", 0);
  8650. /* "View.MemoryView":622
  8651. * cdef __Pyx_memviewslice *mslice
  8652. * cdef __Pyx_memviewslice tmp
  8653. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  8654. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8655. *
  8656. */
  8657. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
  8658. __pyx_v_mslice = __pyx_t_1;
  8659. /* "View.MemoryView":623
  8660. * cdef __Pyx_memviewslice tmp
  8661. * mslice = get_slice_from_memview(self, &tmp)
  8662. * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
  8663. *
  8664. * def is_f_contig(self):
  8665. */
  8666. __Pyx_XDECREF(__pyx_r);
  8667. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
  8668. __Pyx_GOTREF(__pyx_t_2);
  8669. __pyx_r = __pyx_t_2;
  8670. __pyx_t_2 = 0;
  8671. goto __pyx_L0;
  8672. /* "View.MemoryView":619
  8673. *
  8674. *
  8675. * def is_c_contig(self): # <<<<<<<<<<<<<<
  8676. * cdef __Pyx_memviewslice *mslice
  8677. * cdef __Pyx_memviewslice tmp
  8678. */
  8679. /* function exit code */
  8680. __pyx_L1_error:;
  8681. __Pyx_XDECREF(__pyx_t_2);
  8682. __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8683. __pyx_r = NULL;
  8684. __pyx_L0:;
  8685. __Pyx_XGIVEREF(__pyx_r);
  8686. __Pyx_RefNannyFinishContext();
  8687. return __pyx_r;
  8688. }
  8689. /* "View.MemoryView":625
  8690. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8691. *
  8692. * def is_f_contig(self): # <<<<<<<<<<<<<<
  8693. * cdef __Pyx_memviewslice *mslice
  8694. * cdef __Pyx_memviewslice tmp
  8695. */
  8696. /* Python wrapper */
  8697. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8698. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8699. PyObject *__pyx_r = 0;
  8700. __Pyx_RefNannyDeclarations
  8701. __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  8702. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8703. /* function exit code */
  8704. __Pyx_RefNannyFinishContext();
  8705. return __pyx_r;
  8706. }
  8707. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  8708. __Pyx_memviewslice *__pyx_v_mslice;
  8709. __Pyx_memviewslice __pyx_v_tmp;
  8710. PyObject *__pyx_r = NULL;
  8711. __Pyx_RefNannyDeclarations
  8712. __Pyx_memviewslice *__pyx_t_1;
  8713. PyObject *__pyx_t_2 = NULL;
  8714. int __pyx_lineno = 0;
  8715. const char *__pyx_filename = NULL;
  8716. int __pyx_clineno = 0;
  8717. __Pyx_RefNannySetupContext("is_f_contig", 0);
  8718. /* "View.MemoryView":628
  8719. * cdef __Pyx_memviewslice *mslice
  8720. * cdef __Pyx_memviewslice tmp
  8721. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  8722. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8723. *
  8724. */
  8725. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
  8726. __pyx_v_mslice = __pyx_t_1;
  8727. /* "View.MemoryView":629
  8728. * cdef __Pyx_memviewslice tmp
  8729. * mslice = get_slice_from_memview(self, &tmp)
  8730. * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
  8731. *
  8732. * def copy(self):
  8733. */
  8734. __Pyx_XDECREF(__pyx_r);
  8735. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
  8736. __Pyx_GOTREF(__pyx_t_2);
  8737. __pyx_r = __pyx_t_2;
  8738. __pyx_t_2 = 0;
  8739. goto __pyx_L0;
  8740. /* "View.MemoryView":625
  8741. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8742. *
  8743. * def is_f_contig(self): # <<<<<<<<<<<<<<
  8744. * cdef __Pyx_memviewslice *mslice
  8745. * cdef __Pyx_memviewslice tmp
  8746. */
  8747. /* function exit code */
  8748. __pyx_L1_error:;
  8749. __Pyx_XDECREF(__pyx_t_2);
  8750. __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8751. __pyx_r = NULL;
  8752. __pyx_L0:;
  8753. __Pyx_XGIVEREF(__pyx_r);
  8754. __Pyx_RefNannyFinishContext();
  8755. return __pyx_r;
  8756. }
  8757. /* "View.MemoryView":631
  8758. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8759. *
  8760. * def copy(self): # <<<<<<<<<<<<<<
  8761. * cdef __Pyx_memviewslice mslice
  8762. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8763. */
  8764. /* Python wrapper */
  8765. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8766. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8767. PyObject *__pyx_r = 0;
  8768. __Pyx_RefNannyDeclarations
  8769. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  8770. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8771. /* function exit code */
  8772. __Pyx_RefNannyFinishContext();
  8773. return __pyx_r;
  8774. }
  8775. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  8776. __Pyx_memviewslice __pyx_v_mslice;
  8777. int __pyx_v_flags;
  8778. PyObject *__pyx_r = NULL;
  8779. __Pyx_RefNannyDeclarations
  8780. __Pyx_memviewslice __pyx_t_1;
  8781. PyObject *__pyx_t_2 = NULL;
  8782. int __pyx_lineno = 0;
  8783. const char *__pyx_filename = NULL;
  8784. int __pyx_clineno = 0;
  8785. __Pyx_RefNannySetupContext("copy", 0);
  8786. /* "View.MemoryView":633
  8787. * def copy(self):
  8788. * cdef __Pyx_memviewslice mslice
  8789. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
  8790. *
  8791. * slice_copy(self, &mslice)
  8792. */
  8793. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
  8794. /* "View.MemoryView":635
  8795. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8796. *
  8797. * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
  8798. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
  8799. * self.view.itemsize,
  8800. */
  8801. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
  8802. /* "View.MemoryView":636
  8803. *
  8804. * slice_copy(self, &mslice)
  8805. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
  8806. * self.view.itemsize,
  8807. * flags|PyBUF_C_CONTIGUOUS,
  8808. */
  8809. __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
  8810. __pyx_v_mslice = __pyx_t_1;
  8811. /* "View.MemoryView":641
  8812. * self.dtype_is_object)
  8813. *
  8814. * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
  8815. *
  8816. * def copy_fortran(self):
  8817. */
  8818. __Pyx_XDECREF(__pyx_r);
  8819. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
  8820. __Pyx_GOTREF(__pyx_t_2);
  8821. __pyx_r = __pyx_t_2;
  8822. __pyx_t_2 = 0;
  8823. goto __pyx_L0;
  8824. /* "View.MemoryView":631
  8825. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8826. *
  8827. * def copy(self): # <<<<<<<<<<<<<<
  8828. * cdef __Pyx_memviewslice mslice
  8829. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8830. */
  8831. /* function exit code */
  8832. __pyx_L1_error:;
  8833. __Pyx_XDECREF(__pyx_t_2);
  8834. __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8835. __pyx_r = NULL;
  8836. __pyx_L0:;
  8837. __Pyx_XGIVEREF(__pyx_r);
  8838. __Pyx_RefNannyFinishContext();
  8839. return __pyx_r;
  8840. }
  8841. /* "View.MemoryView":643
  8842. * return memoryview_copy_from_slice(self, &mslice)
  8843. *
  8844. * def copy_fortran(self): # <<<<<<<<<<<<<<
  8845. * cdef __Pyx_memviewslice src, dst
  8846. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  8847. */
  8848. /* Python wrapper */
  8849. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8850. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8851. PyObject *__pyx_r = 0;
  8852. __Pyx_RefNannyDeclarations
  8853. __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  8854. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8855. /* function exit code */
  8856. __Pyx_RefNannyFinishContext();
  8857. return __pyx_r;
  8858. }
  8859. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  8860. __Pyx_memviewslice __pyx_v_src;
  8861. __Pyx_memviewslice __pyx_v_dst;
  8862. int __pyx_v_flags;
  8863. PyObject *__pyx_r = NULL;
  8864. __Pyx_RefNannyDeclarations
  8865. __Pyx_memviewslice __pyx_t_1;
  8866. PyObject *__pyx_t_2 = NULL;
  8867. int __pyx_lineno = 0;
  8868. const char *__pyx_filename = NULL;
  8869. int __pyx_clineno = 0;
  8870. __Pyx_RefNannySetupContext("copy_fortran", 0);
  8871. /* "View.MemoryView":645
  8872. * def copy_fortran(self):
  8873. * cdef __Pyx_memviewslice src, dst
  8874. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
  8875. *
  8876. * slice_copy(self, &src)
  8877. */
  8878. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
  8879. /* "View.MemoryView":647
  8880. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  8881. *
  8882. * slice_copy(self, &src) # <<<<<<<<<<<<<<
  8883. * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
  8884. * self.view.itemsize,
  8885. */
  8886. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
  8887. /* "View.MemoryView":648
  8888. *
  8889. * slice_copy(self, &src)
  8890. * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
  8891. * self.view.itemsize,
  8892. * flags|PyBUF_F_CONTIGUOUS,
  8893. */
  8894. __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
  8895. __pyx_v_dst = __pyx_t_1;
  8896. /* "View.MemoryView":653
  8897. * self.dtype_is_object)
  8898. *
  8899. * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
  8900. *
  8901. *
  8902. */
  8903. __Pyx_XDECREF(__pyx_r);
  8904. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
  8905. __Pyx_GOTREF(__pyx_t_2);
  8906. __pyx_r = __pyx_t_2;
  8907. __pyx_t_2 = 0;
  8908. goto __pyx_L0;
  8909. /* "View.MemoryView":643
  8910. * return memoryview_copy_from_slice(self, &mslice)
  8911. *
  8912. * def copy_fortran(self): # <<<<<<<<<<<<<<
  8913. * cdef __Pyx_memviewslice src, dst
  8914. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  8915. */
  8916. /* function exit code */
  8917. __pyx_L1_error:;
  8918. __Pyx_XDECREF(__pyx_t_2);
  8919. __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8920. __pyx_r = NULL;
  8921. __pyx_L0:;
  8922. __Pyx_XGIVEREF(__pyx_r);
  8923. __Pyx_RefNannyFinishContext();
  8924. return __pyx_r;
  8925. }
  8926. /* "(tree fragment)":1
  8927. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  8928. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  8929. * def __setstate_cython__(self, __pyx_state):
  8930. */
  8931. /* Python wrapper */
  8932. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8933. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8934. PyObject *__pyx_r = 0;
  8935. __Pyx_RefNannyDeclarations
  8936. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  8937. __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8938. /* function exit code */
  8939. __Pyx_RefNannyFinishContext();
  8940. return __pyx_r;
  8941. }
  8942. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  8943. PyObject *__pyx_r = NULL;
  8944. __Pyx_RefNannyDeclarations
  8945. PyObject *__pyx_t_1 = NULL;
  8946. int __pyx_lineno = 0;
  8947. const char *__pyx_filename = NULL;
  8948. int __pyx_clineno = 0;
  8949. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  8950. /* "(tree fragment)":2
  8951. * def __reduce_cython__(self):
  8952. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  8953. * def __setstate_cython__(self, __pyx_state):
  8954. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  8955. */
  8956. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  8957. __Pyx_GOTREF(__pyx_t_1);
  8958. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  8959. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8960. __PYX_ERR(2, 2, __pyx_L1_error)
  8961. /* "(tree fragment)":1
  8962. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  8963. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  8964. * def __setstate_cython__(self, __pyx_state):
  8965. */
  8966. /* function exit code */
  8967. __pyx_L1_error:;
  8968. __Pyx_XDECREF(__pyx_t_1);
  8969. __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8970. __pyx_r = NULL;
  8971. __Pyx_XGIVEREF(__pyx_r);
  8972. __Pyx_RefNannyFinishContext();
  8973. return __pyx_r;
  8974. }
  8975. /* "(tree fragment)":3
  8976. * def __reduce_cython__(self):
  8977. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  8978. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  8979. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  8980. */
  8981. /* Python wrapper */
  8982. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  8983. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  8984. PyObject *__pyx_r = 0;
  8985. __Pyx_RefNannyDeclarations
  8986. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  8987. __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  8988. /* function exit code */
  8989. __Pyx_RefNannyFinishContext();
  8990. return __pyx_r;
  8991. }
  8992. static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  8993. PyObject *__pyx_r = NULL;
  8994. __Pyx_RefNannyDeclarations
  8995. PyObject *__pyx_t_1 = NULL;
  8996. int __pyx_lineno = 0;
  8997. const char *__pyx_filename = NULL;
  8998. int __pyx_clineno = 0;
  8999. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  9000. /* "(tree fragment)":4
  9001. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9002. * def __setstate_cython__(self, __pyx_state):
  9003. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  9004. */
  9005. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  9006. __Pyx_GOTREF(__pyx_t_1);
  9007. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  9008. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9009. __PYX_ERR(2, 4, __pyx_L1_error)
  9010. /* "(tree fragment)":3
  9011. * def __reduce_cython__(self):
  9012. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9013. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  9014. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9015. */
  9016. /* function exit code */
  9017. __pyx_L1_error:;
  9018. __Pyx_XDECREF(__pyx_t_1);
  9019. __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9020. __pyx_r = NULL;
  9021. __Pyx_XGIVEREF(__pyx_r);
  9022. __Pyx_RefNannyFinishContext();
  9023. return __pyx_r;
  9024. }
  9025. /* "View.MemoryView":657
  9026. *
  9027. * @cname('__pyx_memoryview_new')
  9028. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  9029. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9030. * result.typeinfo = typeinfo
  9031. */
  9032. static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  9033. struct __pyx_memoryview_obj *__pyx_v_result = 0;
  9034. PyObject *__pyx_r = NULL;
  9035. __Pyx_RefNannyDeclarations
  9036. PyObject *__pyx_t_1 = NULL;
  9037. PyObject *__pyx_t_2 = NULL;
  9038. PyObject *__pyx_t_3 = NULL;
  9039. int __pyx_lineno = 0;
  9040. const char *__pyx_filename = NULL;
  9041. int __pyx_clineno = 0;
  9042. __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
  9043. /* "View.MemoryView":658
  9044. * @cname('__pyx_memoryview_new')
  9045. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  9046. * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
  9047. * result.typeinfo = typeinfo
  9048. * return result
  9049. */
  9050. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
  9051. __Pyx_GOTREF(__pyx_t_1);
  9052. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
  9053. __Pyx_GOTREF(__pyx_t_2);
  9054. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
  9055. __Pyx_GOTREF(__pyx_t_3);
  9056. __Pyx_INCREF(__pyx_v_o);
  9057. __Pyx_GIVEREF(__pyx_v_o);
  9058. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  9059. __Pyx_GIVEREF(__pyx_t_1);
  9060. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  9061. __Pyx_GIVEREF(__pyx_t_2);
  9062. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  9063. __pyx_t_1 = 0;
  9064. __pyx_t_2 = 0;
  9065. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
  9066. __Pyx_GOTREF(__pyx_t_2);
  9067. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9068. __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  9069. __pyx_t_2 = 0;
  9070. /* "View.MemoryView":659
  9071. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  9072. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9073. * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
  9074. * return result
  9075. *
  9076. */
  9077. __pyx_v_result->typeinfo = __pyx_v_typeinfo;
  9078. /* "View.MemoryView":660
  9079. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9080. * result.typeinfo = typeinfo
  9081. * return result # <<<<<<<<<<<<<<
  9082. *
  9083. * @cname('__pyx_memoryview_check')
  9084. */
  9085. __Pyx_XDECREF(__pyx_r);
  9086. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  9087. __pyx_r = ((PyObject *)__pyx_v_result);
  9088. goto __pyx_L0;
  9089. /* "View.MemoryView":657
  9090. *
  9091. * @cname('__pyx_memoryview_new')
  9092. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  9093. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9094. * result.typeinfo = typeinfo
  9095. */
  9096. /* function exit code */
  9097. __pyx_L1_error:;
  9098. __Pyx_XDECREF(__pyx_t_1);
  9099. __Pyx_XDECREF(__pyx_t_2);
  9100. __Pyx_XDECREF(__pyx_t_3);
  9101. __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9102. __pyx_r = 0;
  9103. __pyx_L0:;
  9104. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  9105. __Pyx_XGIVEREF(__pyx_r);
  9106. __Pyx_RefNannyFinishContext();
  9107. return __pyx_r;
  9108. }
  9109. /* "View.MemoryView":663
  9110. *
  9111. * @cname('__pyx_memoryview_check')
  9112. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  9113. * return isinstance(o, memoryview)
  9114. *
  9115. */
  9116. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  9117. int __pyx_r;
  9118. __Pyx_RefNannyDeclarations
  9119. int __pyx_t_1;
  9120. __Pyx_RefNannySetupContext("memoryview_check", 0);
  9121. /* "View.MemoryView":664
  9122. * @cname('__pyx_memoryview_check')
  9123. * cdef inline bint memoryview_check(object o):
  9124. * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
  9125. *
  9126. * cdef tuple _unellipsify(object index, int ndim):
  9127. */
  9128. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
  9129. __pyx_r = __pyx_t_1;
  9130. goto __pyx_L0;
  9131. /* "View.MemoryView":663
  9132. *
  9133. * @cname('__pyx_memoryview_check')
  9134. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  9135. * return isinstance(o, memoryview)
  9136. *
  9137. */
  9138. /* function exit code */
  9139. __pyx_L0:;
  9140. __Pyx_RefNannyFinishContext();
  9141. return __pyx_r;
  9142. }
  9143. /* "View.MemoryView":666
  9144. * return isinstance(o, memoryview)
  9145. *
  9146. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  9147. * """
  9148. * Replace all ellipses with full slices and fill incomplete indices with
  9149. */
  9150. static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  9151. PyObject *__pyx_v_tup = NULL;
  9152. PyObject *__pyx_v_result = NULL;
  9153. int __pyx_v_have_slices;
  9154. int __pyx_v_seen_ellipsis;
  9155. CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  9156. PyObject *__pyx_v_item = NULL;
  9157. Py_ssize_t __pyx_v_nslices;
  9158. PyObject *__pyx_r = NULL;
  9159. __Pyx_RefNannyDeclarations
  9160. int __pyx_t_1;
  9161. int __pyx_t_2;
  9162. PyObject *__pyx_t_3 = NULL;
  9163. PyObject *__pyx_t_4 = NULL;
  9164. Py_ssize_t __pyx_t_5;
  9165. PyObject *(*__pyx_t_6)(PyObject *);
  9166. PyObject *__pyx_t_7 = NULL;
  9167. Py_ssize_t __pyx_t_8;
  9168. int __pyx_t_9;
  9169. int __pyx_t_10;
  9170. PyObject *__pyx_t_11 = NULL;
  9171. int __pyx_lineno = 0;
  9172. const char *__pyx_filename = NULL;
  9173. int __pyx_clineno = 0;
  9174. __Pyx_RefNannySetupContext("_unellipsify", 0);
  9175. /* "View.MemoryView":671
  9176. * full slices.
  9177. * """
  9178. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  9179. * tup = (index,)
  9180. * else:
  9181. */
  9182. __pyx_t_1 = PyTuple_Check(__pyx_v_index);
  9183. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  9184. if (__pyx_t_2) {
  9185. /* "View.MemoryView":672
  9186. * """
  9187. * if not isinstance(index, tuple):
  9188. * tup = (index,) # <<<<<<<<<<<<<<
  9189. * else:
  9190. * tup = index
  9191. */
  9192. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
  9193. __Pyx_GOTREF(__pyx_t_3);
  9194. __Pyx_INCREF(__pyx_v_index);
  9195. __Pyx_GIVEREF(__pyx_v_index);
  9196. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
  9197. __pyx_v_tup = __pyx_t_3;
  9198. __pyx_t_3 = 0;
  9199. /* "View.MemoryView":671
  9200. * full slices.
  9201. * """
  9202. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  9203. * tup = (index,)
  9204. * else:
  9205. */
  9206. goto __pyx_L3;
  9207. }
  9208. /* "View.MemoryView":674
  9209. * tup = (index,)
  9210. * else:
  9211. * tup = index # <<<<<<<<<<<<<<
  9212. *
  9213. * result = []
  9214. */
  9215. /*else*/ {
  9216. __Pyx_INCREF(__pyx_v_index);
  9217. __pyx_v_tup = __pyx_v_index;
  9218. }
  9219. __pyx_L3:;
  9220. /* "View.MemoryView":676
  9221. * tup = index
  9222. *
  9223. * result = [] # <<<<<<<<<<<<<<
  9224. * have_slices = False
  9225. * seen_ellipsis = False
  9226. */
  9227. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
  9228. __Pyx_GOTREF(__pyx_t_3);
  9229. __pyx_v_result = ((PyObject*)__pyx_t_3);
  9230. __pyx_t_3 = 0;
  9231. /* "View.MemoryView":677
  9232. *
  9233. * result = []
  9234. * have_slices = False # <<<<<<<<<<<<<<
  9235. * seen_ellipsis = False
  9236. * for idx, item in enumerate(tup):
  9237. */
  9238. __pyx_v_have_slices = 0;
  9239. /* "View.MemoryView":678
  9240. * result = []
  9241. * have_slices = False
  9242. * seen_ellipsis = False # <<<<<<<<<<<<<<
  9243. * for idx, item in enumerate(tup):
  9244. * if item is Ellipsis:
  9245. */
  9246. __pyx_v_seen_ellipsis = 0;
  9247. /* "View.MemoryView":679
  9248. * have_slices = False
  9249. * seen_ellipsis = False
  9250. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  9251. * if item is Ellipsis:
  9252. * if not seen_ellipsis:
  9253. */
  9254. __Pyx_INCREF(__pyx_int_0);
  9255. __pyx_t_3 = __pyx_int_0;
  9256. if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
  9257. __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  9258. __pyx_t_6 = NULL;
  9259. } else {
  9260. __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
  9261. __Pyx_GOTREF(__pyx_t_4);
  9262. __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
  9263. }
  9264. for (;;) {
  9265. if (likely(!__pyx_t_6)) {
  9266. if (likely(PyList_CheckExact(__pyx_t_4))) {
  9267. if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
  9268. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9269. __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
  9270. #else
  9271. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  9272. __Pyx_GOTREF(__pyx_t_7);
  9273. #endif
  9274. } else {
  9275. if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
  9276. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9277. __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
  9278. #else
  9279. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  9280. __Pyx_GOTREF(__pyx_t_7);
  9281. #endif
  9282. }
  9283. } else {
  9284. __pyx_t_7 = __pyx_t_6(__pyx_t_4);
  9285. if (unlikely(!__pyx_t_7)) {
  9286. PyObject* exc_type = PyErr_Occurred();
  9287. if (exc_type) {
  9288. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9289. else __PYX_ERR(2, 679, __pyx_L1_error)
  9290. }
  9291. break;
  9292. }
  9293. __Pyx_GOTREF(__pyx_t_7);
  9294. }
  9295. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
  9296. __pyx_t_7 = 0;
  9297. __Pyx_INCREF(__pyx_t_3);
  9298. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
  9299. __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  9300. __Pyx_GOTREF(__pyx_t_7);
  9301. __Pyx_DECREF(__pyx_t_3);
  9302. __pyx_t_3 = __pyx_t_7;
  9303. __pyx_t_7 = 0;
  9304. /* "View.MemoryView":680
  9305. * seen_ellipsis = False
  9306. * for idx, item in enumerate(tup):
  9307. * if item is Ellipsis: # <<<<<<<<<<<<<<
  9308. * if not seen_ellipsis:
  9309. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9310. */
  9311. __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
  9312. __pyx_t_1 = (__pyx_t_2 != 0);
  9313. if (__pyx_t_1) {
  9314. /* "View.MemoryView":681
  9315. * for idx, item in enumerate(tup):
  9316. * if item is Ellipsis:
  9317. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  9318. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9319. * seen_ellipsis = True
  9320. */
  9321. __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
  9322. if (__pyx_t_1) {
  9323. /* "View.MemoryView":682
  9324. * if item is Ellipsis:
  9325. * if not seen_ellipsis:
  9326. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  9327. * seen_ellipsis = True
  9328. * else:
  9329. */
  9330. __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
  9331. __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
  9332. __Pyx_GOTREF(__pyx_t_7);
  9333. { Py_ssize_t __pyx_temp;
  9334. for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
  9335. __Pyx_INCREF(__pyx_slice__15);
  9336. __Pyx_GIVEREF(__pyx_slice__15);
  9337. PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__15);
  9338. }
  9339. }
  9340. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
  9341. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9342. /* "View.MemoryView":683
  9343. * if not seen_ellipsis:
  9344. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9345. * seen_ellipsis = True # <<<<<<<<<<<<<<
  9346. * else:
  9347. * result.append(slice(None))
  9348. */
  9349. __pyx_v_seen_ellipsis = 1;
  9350. /* "View.MemoryView":681
  9351. * for idx, item in enumerate(tup):
  9352. * if item is Ellipsis:
  9353. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  9354. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9355. * seen_ellipsis = True
  9356. */
  9357. goto __pyx_L7;
  9358. }
  9359. /* "View.MemoryView":685
  9360. * seen_ellipsis = True
  9361. * else:
  9362. * result.append(slice(None)) # <<<<<<<<<<<<<<
  9363. * have_slices = True
  9364. * else:
  9365. */
  9366. /*else*/ {
  9367. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__15); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
  9368. }
  9369. __pyx_L7:;
  9370. /* "View.MemoryView":686
  9371. * else:
  9372. * result.append(slice(None))
  9373. * have_slices = True # <<<<<<<<<<<<<<
  9374. * else:
  9375. * if not isinstance(item, slice) and not PyIndex_Check(item):
  9376. */
  9377. __pyx_v_have_slices = 1;
  9378. /* "View.MemoryView":680
  9379. * seen_ellipsis = False
  9380. * for idx, item in enumerate(tup):
  9381. * if item is Ellipsis: # <<<<<<<<<<<<<<
  9382. * if not seen_ellipsis:
  9383. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9384. */
  9385. goto __pyx_L6;
  9386. }
  9387. /* "View.MemoryView":688
  9388. * have_slices = True
  9389. * else:
  9390. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  9391. * raise TypeError("Cannot index with type '%s'" % type(item))
  9392. *
  9393. */
  9394. /*else*/ {
  9395. __pyx_t_2 = PySlice_Check(__pyx_v_item);
  9396. __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
  9397. if (__pyx_t_10) {
  9398. } else {
  9399. __pyx_t_1 = __pyx_t_10;
  9400. goto __pyx_L9_bool_binop_done;
  9401. }
  9402. __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
  9403. __pyx_t_1 = __pyx_t_10;
  9404. __pyx_L9_bool_binop_done:;
  9405. if (unlikely(__pyx_t_1)) {
  9406. /* "View.MemoryView":689
  9407. * else:
  9408. * if not isinstance(item, slice) and not PyIndex_Check(item):
  9409. * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
  9410. *
  9411. * have_slices = have_slices or isinstance(item, slice)
  9412. */
  9413. __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
  9414. __Pyx_GOTREF(__pyx_t_7);
  9415. __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
  9416. __Pyx_GOTREF(__pyx_t_11);
  9417. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9418. __Pyx_Raise(__pyx_t_11, 0, 0, 0);
  9419. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9420. __PYX_ERR(2, 689, __pyx_L1_error)
  9421. /* "View.MemoryView":688
  9422. * have_slices = True
  9423. * else:
  9424. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  9425. * raise TypeError("Cannot index with type '%s'" % type(item))
  9426. *
  9427. */
  9428. }
  9429. /* "View.MemoryView":691
  9430. * raise TypeError("Cannot index with type '%s'" % type(item))
  9431. *
  9432. * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
  9433. * result.append(item)
  9434. *
  9435. */
  9436. __pyx_t_10 = (__pyx_v_have_slices != 0);
  9437. if (!__pyx_t_10) {
  9438. } else {
  9439. __pyx_t_1 = __pyx_t_10;
  9440. goto __pyx_L11_bool_binop_done;
  9441. }
  9442. __pyx_t_10 = PySlice_Check(__pyx_v_item);
  9443. __pyx_t_2 = (__pyx_t_10 != 0);
  9444. __pyx_t_1 = __pyx_t_2;
  9445. __pyx_L11_bool_binop_done:;
  9446. __pyx_v_have_slices = __pyx_t_1;
  9447. /* "View.MemoryView":692
  9448. *
  9449. * have_slices = have_slices or isinstance(item, slice)
  9450. * result.append(item) # <<<<<<<<<<<<<<
  9451. *
  9452. * nslices = ndim - len(result)
  9453. */
  9454. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
  9455. }
  9456. __pyx_L6:;
  9457. /* "View.MemoryView":679
  9458. * have_slices = False
  9459. * seen_ellipsis = False
  9460. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  9461. * if item is Ellipsis:
  9462. * if not seen_ellipsis:
  9463. */
  9464. }
  9465. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9466. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9467. /* "View.MemoryView":694
  9468. * result.append(item)
  9469. *
  9470. * nslices = ndim - len(result) # <<<<<<<<<<<<<<
  9471. * if nslices:
  9472. * result.extend([slice(None)] * nslices)
  9473. */
  9474. __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
  9475. __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
  9476. /* "View.MemoryView":695
  9477. *
  9478. * nslices = ndim - len(result)
  9479. * if nslices: # <<<<<<<<<<<<<<
  9480. * result.extend([slice(None)] * nslices)
  9481. *
  9482. */
  9483. __pyx_t_1 = (__pyx_v_nslices != 0);
  9484. if (__pyx_t_1) {
  9485. /* "View.MemoryView":696
  9486. * nslices = ndim - len(result)
  9487. * if nslices:
  9488. * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
  9489. *
  9490. * return have_slices or nslices, tuple(result)
  9491. */
  9492. __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
  9493. __Pyx_GOTREF(__pyx_t_3);
  9494. { Py_ssize_t __pyx_temp;
  9495. for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
  9496. __Pyx_INCREF(__pyx_slice__15);
  9497. __Pyx_GIVEREF(__pyx_slice__15);
  9498. PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__15);
  9499. }
  9500. }
  9501. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
  9502. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9503. /* "View.MemoryView":695
  9504. *
  9505. * nslices = ndim - len(result)
  9506. * if nslices: # <<<<<<<<<<<<<<
  9507. * result.extend([slice(None)] * nslices)
  9508. *
  9509. */
  9510. }
  9511. /* "View.MemoryView":698
  9512. * result.extend([slice(None)] * nslices)
  9513. *
  9514. * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
  9515. *
  9516. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9517. */
  9518. __Pyx_XDECREF(__pyx_r);
  9519. if (!__pyx_v_have_slices) {
  9520. } else {
  9521. __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  9522. __Pyx_GOTREF(__pyx_t_4);
  9523. __pyx_t_3 = __pyx_t_4;
  9524. __pyx_t_4 = 0;
  9525. goto __pyx_L14_bool_binop_done;
  9526. }
  9527. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  9528. __Pyx_GOTREF(__pyx_t_4);
  9529. __pyx_t_3 = __pyx_t_4;
  9530. __pyx_t_4 = 0;
  9531. __pyx_L14_bool_binop_done:;
  9532. __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  9533. __Pyx_GOTREF(__pyx_t_4);
  9534. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
  9535. __Pyx_GOTREF(__pyx_t_11);
  9536. __Pyx_GIVEREF(__pyx_t_3);
  9537. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  9538. __Pyx_GIVEREF(__pyx_t_4);
  9539. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  9540. __pyx_t_3 = 0;
  9541. __pyx_t_4 = 0;
  9542. __pyx_r = ((PyObject*)__pyx_t_11);
  9543. __pyx_t_11 = 0;
  9544. goto __pyx_L0;
  9545. /* "View.MemoryView":666
  9546. * return isinstance(o, memoryview)
  9547. *
  9548. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  9549. * """
  9550. * Replace all ellipses with full slices and fill incomplete indices with
  9551. */
  9552. /* function exit code */
  9553. __pyx_L1_error:;
  9554. __Pyx_XDECREF(__pyx_t_3);
  9555. __Pyx_XDECREF(__pyx_t_4);
  9556. __Pyx_XDECREF(__pyx_t_7);
  9557. __Pyx_XDECREF(__pyx_t_11);
  9558. __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9559. __pyx_r = 0;
  9560. __pyx_L0:;
  9561. __Pyx_XDECREF(__pyx_v_tup);
  9562. __Pyx_XDECREF(__pyx_v_result);
  9563. __Pyx_XDECREF(__pyx_v_idx);
  9564. __Pyx_XDECREF(__pyx_v_item);
  9565. __Pyx_XGIVEREF(__pyx_r);
  9566. __Pyx_RefNannyFinishContext();
  9567. return __pyx_r;
  9568. }
  9569. /* "View.MemoryView":700
  9570. * return have_slices or nslices, tuple(result)
  9571. *
  9572. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  9573. * for suboffset in suboffsets[:ndim]:
  9574. * if suboffset >= 0:
  9575. */
  9576. static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  9577. Py_ssize_t __pyx_v_suboffset;
  9578. PyObject *__pyx_r = NULL;
  9579. __Pyx_RefNannyDeclarations
  9580. Py_ssize_t *__pyx_t_1;
  9581. Py_ssize_t *__pyx_t_2;
  9582. Py_ssize_t *__pyx_t_3;
  9583. int __pyx_t_4;
  9584. PyObject *__pyx_t_5 = NULL;
  9585. int __pyx_lineno = 0;
  9586. const char *__pyx_filename = NULL;
  9587. int __pyx_clineno = 0;
  9588. __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
  9589. /* "View.MemoryView":701
  9590. *
  9591. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9592. * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
  9593. * if suboffset >= 0:
  9594. * raise ValueError("Indirect dimensions not supported")
  9595. */
  9596. __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  9597. for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
  9598. __pyx_t_1 = __pyx_t_3;
  9599. __pyx_v_suboffset = (__pyx_t_1[0]);
  9600. /* "View.MemoryView":702
  9601. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9602. * for suboffset in suboffsets[:ndim]:
  9603. * if suboffset >= 0: # <<<<<<<<<<<<<<
  9604. * raise ValueError("Indirect dimensions not supported")
  9605. *
  9606. */
  9607. __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
  9608. if (unlikely(__pyx_t_4)) {
  9609. /* "View.MemoryView":703
  9610. * for suboffset in suboffsets[:ndim]:
  9611. * if suboffset >= 0:
  9612. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  9613. *
  9614. *
  9615. */
  9616. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
  9617. __Pyx_GOTREF(__pyx_t_5);
  9618. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  9619. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9620. __PYX_ERR(2, 703, __pyx_L1_error)
  9621. /* "View.MemoryView":702
  9622. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9623. * for suboffset in suboffsets[:ndim]:
  9624. * if suboffset >= 0: # <<<<<<<<<<<<<<
  9625. * raise ValueError("Indirect dimensions not supported")
  9626. *
  9627. */
  9628. }
  9629. }
  9630. /* "View.MemoryView":700
  9631. * return have_slices or nslices, tuple(result)
  9632. *
  9633. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  9634. * for suboffset in suboffsets[:ndim]:
  9635. * if suboffset >= 0:
  9636. */
  9637. /* function exit code */
  9638. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9639. goto __pyx_L0;
  9640. __pyx_L1_error:;
  9641. __Pyx_XDECREF(__pyx_t_5);
  9642. __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9643. __pyx_r = 0;
  9644. __pyx_L0:;
  9645. __Pyx_XGIVEREF(__pyx_r);
  9646. __Pyx_RefNannyFinishContext();
  9647. return __pyx_r;
  9648. }
  9649. /* "View.MemoryView":710
  9650. *
  9651. * @cname('__pyx_memview_slice')
  9652. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  9653. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  9654. * cdef bint negative_step
  9655. */
  9656. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  9657. int __pyx_v_new_ndim;
  9658. int __pyx_v_suboffset_dim;
  9659. int __pyx_v_dim;
  9660. __Pyx_memviewslice __pyx_v_src;
  9661. __Pyx_memviewslice __pyx_v_dst;
  9662. __Pyx_memviewslice *__pyx_v_p_src;
  9663. struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  9664. __Pyx_memviewslice *__pyx_v_p_dst;
  9665. int *__pyx_v_p_suboffset_dim;
  9666. Py_ssize_t __pyx_v_start;
  9667. Py_ssize_t __pyx_v_stop;
  9668. Py_ssize_t __pyx_v_step;
  9669. int __pyx_v_have_start;
  9670. int __pyx_v_have_stop;
  9671. int __pyx_v_have_step;
  9672. PyObject *__pyx_v_index = NULL;
  9673. struct __pyx_memoryview_obj *__pyx_r = NULL;
  9674. __Pyx_RefNannyDeclarations
  9675. int __pyx_t_1;
  9676. int __pyx_t_2;
  9677. PyObject *__pyx_t_3 = NULL;
  9678. struct __pyx_memoryview_obj *__pyx_t_4;
  9679. char *__pyx_t_5;
  9680. int __pyx_t_6;
  9681. Py_ssize_t __pyx_t_7;
  9682. PyObject *(*__pyx_t_8)(PyObject *);
  9683. PyObject *__pyx_t_9 = NULL;
  9684. Py_ssize_t __pyx_t_10;
  9685. int __pyx_t_11;
  9686. Py_ssize_t __pyx_t_12;
  9687. int __pyx_lineno = 0;
  9688. const char *__pyx_filename = NULL;
  9689. int __pyx_clineno = 0;
  9690. __Pyx_RefNannySetupContext("memview_slice", 0);
  9691. /* "View.MemoryView":711
  9692. * @cname('__pyx_memview_slice')
  9693. * cdef memoryview memview_slice(memoryview memview, object indices):
  9694. * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
  9695. * cdef bint negative_step
  9696. * cdef __Pyx_memviewslice src, dst
  9697. */
  9698. __pyx_v_new_ndim = 0;
  9699. __pyx_v_suboffset_dim = -1;
  9700. /* "View.MemoryView":718
  9701. *
  9702. *
  9703. * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
  9704. *
  9705. * cdef _memoryviewslice memviewsliceobj
  9706. */
  9707. (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
  9708. /* "View.MemoryView":722
  9709. * cdef _memoryviewslice memviewsliceobj
  9710. *
  9711. * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
  9712. *
  9713. * if isinstance(memview, _memoryviewslice):
  9714. */
  9715. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9716. if (unlikely(!Py_OptimizeFlag)) {
  9717. if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
  9718. PyErr_SetNone(PyExc_AssertionError);
  9719. __PYX_ERR(2, 722, __pyx_L1_error)
  9720. }
  9721. }
  9722. #endif
  9723. /* "View.MemoryView":724
  9724. * assert memview.view.ndim > 0
  9725. *
  9726. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  9727. * memviewsliceobj = memview
  9728. * p_src = &memviewsliceobj.from_slice
  9729. */
  9730. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  9731. __pyx_t_2 = (__pyx_t_1 != 0);
  9732. if (__pyx_t_2) {
  9733. /* "View.MemoryView":725
  9734. *
  9735. * if isinstance(memview, _memoryviewslice):
  9736. * memviewsliceobj = memview # <<<<<<<<<<<<<<
  9737. * p_src = &memviewsliceobj.from_slice
  9738. * else:
  9739. */
  9740. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
  9741. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  9742. __Pyx_INCREF(__pyx_t_3);
  9743. __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  9744. __pyx_t_3 = 0;
  9745. /* "View.MemoryView":726
  9746. * if isinstance(memview, _memoryviewslice):
  9747. * memviewsliceobj = memview
  9748. * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
  9749. * else:
  9750. * slice_copy(memview, &src)
  9751. */
  9752. __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
  9753. /* "View.MemoryView":724
  9754. * assert memview.view.ndim > 0
  9755. *
  9756. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  9757. * memviewsliceobj = memview
  9758. * p_src = &memviewsliceobj.from_slice
  9759. */
  9760. goto __pyx_L3;
  9761. }
  9762. /* "View.MemoryView":728
  9763. * p_src = &memviewsliceobj.from_slice
  9764. * else:
  9765. * slice_copy(memview, &src) # <<<<<<<<<<<<<<
  9766. * p_src = &src
  9767. *
  9768. */
  9769. /*else*/ {
  9770. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
  9771. /* "View.MemoryView":729
  9772. * else:
  9773. * slice_copy(memview, &src)
  9774. * p_src = &src # <<<<<<<<<<<<<<
  9775. *
  9776. *
  9777. */
  9778. __pyx_v_p_src = (&__pyx_v_src);
  9779. }
  9780. __pyx_L3:;
  9781. /* "View.MemoryView":735
  9782. *
  9783. *
  9784. * dst.memview = p_src.memview # <<<<<<<<<<<<<<
  9785. * dst.data = p_src.data
  9786. *
  9787. */
  9788. __pyx_t_4 = __pyx_v_p_src->memview;
  9789. __pyx_v_dst.memview = __pyx_t_4;
  9790. /* "View.MemoryView":736
  9791. *
  9792. * dst.memview = p_src.memview
  9793. * dst.data = p_src.data # <<<<<<<<<<<<<<
  9794. *
  9795. *
  9796. */
  9797. __pyx_t_5 = __pyx_v_p_src->data;
  9798. __pyx_v_dst.data = __pyx_t_5;
  9799. /* "View.MemoryView":741
  9800. *
  9801. *
  9802. * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
  9803. * cdef int *p_suboffset_dim = &suboffset_dim
  9804. * cdef Py_ssize_t start, stop, step
  9805. */
  9806. __pyx_v_p_dst = (&__pyx_v_dst);
  9807. /* "View.MemoryView":742
  9808. *
  9809. * cdef __Pyx_memviewslice *p_dst = &dst
  9810. * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
  9811. * cdef Py_ssize_t start, stop, step
  9812. * cdef bint have_start, have_stop, have_step
  9813. */
  9814. __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
  9815. /* "View.MemoryView":746
  9816. * cdef bint have_start, have_stop, have_step
  9817. *
  9818. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  9819. * if PyIndex_Check(index):
  9820. * slice_memviewslice(
  9821. */
  9822. __pyx_t_6 = 0;
  9823. if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
  9824. __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
  9825. __pyx_t_8 = NULL;
  9826. } else {
  9827. __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
  9828. __Pyx_GOTREF(__pyx_t_3);
  9829. __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
  9830. }
  9831. for (;;) {
  9832. if (likely(!__pyx_t_8)) {
  9833. if (likely(PyList_CheckExact(__pyx_t_3))) {
  9834. if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
  9835. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9836. __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
  9837. #else
  9838. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
  9839. __Pyx_GOTREF(__pyx_t_9);
  9840. #endif
  9841. } else {
  9842. if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  9843. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9844. __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
  9845. #else
  9846. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
  9847. __Pyx_GOTREF(__pyx_t_9);
  9848. #endif
  9849. }
  9850. } else {
  9851. __pyx_t_9 = __pyx_t_8(__pyx_t_3);
  9852. if (unlikely(!__pyx_t_9)) {
  9853. PyObject* exc_type = PyErr_Occurred();
  9854. if (exc_type) {
  9855. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9856. else __PYX_ERR(2, 746, __pyx_L1_error)
  9857. }
  9858. break;
  9859. }
  9860. __Pyx_GOTREF(__pyx_t_9);
  9861. }
  9862. __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
  9863. __pyx_t_9 = 0;
  9864. __pyx_v_dim = __pyx_t_6;
  9865. __pyx_t_6 = (__pyx_t_6 + 1);
  9866. /* "View.MemoryView":747
  9867. *
  9868. * for dim, index in enumerate(indices):
  9869. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  9870. * slice_memviewslice(
  9871. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9872. */
  9873. __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
  9874. if (__pyx_t_2) {
  9875. /* "View.MemoryView":751
  9876. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9877. * dim, new_ndim, p_suboffset_dim,
  9878. * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
  9879. * 0, 0, 0, # have_{start,stop,step}
  9880. * False)
  9881. */
  9882. __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
  9883. /* "View.MemoryView":748
  9884. * for dim, index in enumerate(indices):
  9885. * if PyIndex_Check(index):
  9886. * slice_memviewslice( # <<<<<<<<<<<<<<
  9887. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9888. * dim, new_ndim, p_suboffset_dim,
  9889. */
  9890. __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
  9891. /* "View.MemoryView":747
  9892. *
  9893. * for dim, index in enumerate(indices):
  9894. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  9895. * slice_memviewslice(
  9896. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9897. */
  9898. goto __pyx_L6;
  9899. }
  9900. /* "View.MemoryView":754
  9901. * 0, 0, 0, # have_{start,stop,step}
  9902. * False)
  9903. * elif index is None: # <<<<<<<<<<<<<<
  9904. * p_dst.shape[new_ndim] = 1
  9905. * p_dst.strides[new_ndim] = 0
  9906. */
  9907. __pyx_t_2 = (__pyx_v_index == Py_None);
  9908. __pyx_t_1 = (__pyx_t_2 != 0);
  9909. if (__pyx_t_1) {
  9910. /* "View.MemoryView":755
  9911. * False)
  9912. * elif index is None:
  9913. * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
  9914. * p_dst.strides[new_ndim] = 0
  9915. * p_dst.suboffsets[new_ndim] = -1
  9916. */
  9917. (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
  9918. /* "View.MemoryView":756
  9919. * elif index is None:
  9920. * p_dst.shape[new_ndim] = 1
  9921. * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
  9922. * p_dst.suboffsets[new_ndim] = -1
  9923. * new_ndim += 1
  9924. */
  9925. (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
  9926. /* "View.MemoryView":757
  9927. * p_dst.shape[new_ndim] = 1
  9928. * p_dst.strides[new_ndim] = 0
  9929. * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
  9930. * new_ndim += 1
  9931. * else:
  9932. */
  9933. (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
  9934. /* "View.MemoryView":758
  9935. * p_dst.strides[new_ndim] = 0
  9936. * p_dst.suboffsets[new_ndim] = -1
  9937. * new_ndim += 1 # <<<<<<<<<<<<<<
  9938. * else:
  9939. * start = index.start or 0
  9940. */
  9941. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  9942. /* "View.MemoryView":754
  9943. * 0, 0, 0, # have_{start,stop,step}
  9944. * False)
  9945. * elif index is None: # <<<<<<<<<<<<<<
  9946. * p_dst.shape[new_ndim] = 1
  9947. * p_dst.strides[new_ndim] = 0
  9948. */
  9949. goto __pyx_L6;
  9950. }
  9951. /* "View.MemoryView":760
  9952. * new_ndim += 1
  9953. * else:
  9954. * start = index.start or 0 # <<<<<<<<<<<<<<
  9955. * stop = index.stop or 0
  9956. * step = index.step or 0
  9957. */
  9958. /*else*/ {
  9959. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
  9960. __Pyx_GOTREF(__pyx_t_9);
  9961. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
  9962. if (!__pyx_t_1) {
  9963. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9964. } else {
  9965. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
  9966. __pyx_t_10 = __pyx_t_12;
  9967. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9968. goto __pyx_L7_bool_binop_done;
  9969. }
  9970. __pyx_t_10 = 0;
  9971. __pyx_L7_bool_binop_done:;
  9972. __pyx_v_start = __pyx_t_10;
  9973. /* "View.MemoryView":761
  9974. * else:
  9975. * start = index.start or 0
  9976. * stop = index.stop or 0 # <<<<<<<<<<<<<<
  9977. * step = index.step or 0
  9978. *
  9979. */
  9980. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
  9981. __Pyx_GOTREF(__pyx_t_9);
  9982. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
  9983. if (!__pyx_t_1) {
  9984. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9985. } else {
  9986. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
  9987. __pyx_t_10 = __pyx_t_12;
  9988. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9989. goto __pyx_L9_bool_binop_done;
  9990. }
  9991. __pyx_t_10 = 0;
  9992. __pyx_L9_bool_binop_done:;
  9993. __pyx_v_stop = __pyx_t_10;
  9994. /* "View.MemoryView":762
  9995. * start = index.start or 0
  9996. * stop = index.stop or 0
  9997. * step = index.step or 0 # <<<<<<<<<<<<<<
  9998. *
  9999. * have_start = index.start is not None
  10000. */
  10001. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
  10002. __Pyx_GOTREF(__pyx_t_9);
  10003. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
  10004. if (!__pyx_t_1) {
  10005. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10006. } else {
  10007. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
  10008. __pyx_t_10 = __pyx_t_12;
  10009. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10010. goto __pyx_L11_bool_binop_done;
  10011. }
  10012. __pyx_t_10 = 0;
  10013. __pyx_L11_bool_binop_done:;
  10014. __pyx_v_step = __pyx_t_10;
  10015. /* "View.MemoryView":764
  10016. * step = index.step or 0
  10017. *
  10018. * have_start = index.start is not None # <<<<<<<<<<<<<<
  10019. * have_stop = index.stop is not None
  10020. * have_step = index.step is not None
  10021. */
  10022. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
  10023. __Pyx_GOTREF(__pyx_t_9);
  10024. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10025. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10026. __pyx_v_have_start = __pyx_t_1;
  10027. /* "View.MemoryView":765
  10028. *
  10029. * have_start = index.start is not None
  10030. * have_stop = index.stop is not None # <<<<<<<<<<<<<<
  10031. * have_step = index.step is not None
  10032. *
  10033. */
  10034. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
  10035. __Pyx_GOTREF(__pyx_t_9);
  10036. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10037. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10038. __pyx_v_have_stop = __pyx_t_1;
  10039. /* "View.MemoryView":766
  10040. * have_start = index.start is not None
  10041. * have_stop = index.stop is not None
  10042. * have_step = index.step is not None # <<<<<<<<<<<<<<
  10043. *
  10044. * slice_memviewslice(
  10045. */
  10046. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
  10047. __Pyx_GOTREF(__pyx_t_9);
  10048. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10049. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10050. __pyx_v_have_step = __pyx_t_1;
  10051. /* "View.MemoryView":768
  10052. * have_step = index.step is not None
  10053. *
  10054. * slice_memviewslice( # <<<<<<<<<<<<<<
  10055. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  10056. * dim, new_ndim, p_suboffset_dim,
  10057. */
  10058. __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
  10059. /* "View.MemoryView":774
  10060. * have_start, have_stop, have_step,
  10061. * True)
  10062. * new_ndim += 1 # <<<<<<<<<<<<<<
  10063. *
  10064. * if isinstance(memview, _memoryviewslice):
  10065. */
  10066. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  10067. }
  10068. __pyx_L6:;
  10069. /* "View.MemoryView":746
  10070. * cdef bint have_start, have_stop, have_step
  10071. *
  10072. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  10073. * if PyIndex_Check(index):
  10074. * slice_memviewslice(
  10075. */
  10076. }
  10077. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10078. /* "View.MemoryView":776
  10079. * new_ndim += 1
  10080. *
  10081. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  10082. * return memoryview_fromslice(dst, new_ndim,
  10083. * memviewsliceobj.to_object_func,
  10084. */
  10085. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  10086. __pyx_t_2 = (__pyx_t_1 != 0);
  10087. if (__pyx_t_2) {
  10088. /* "View.MemoryView":777
  10089. *
  10090. * if isinstance(memview, _memoryviewslice):
  10091. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  10092. * memviewsliceobj.to_object_func,
  10093. * memviewsliceobj.to_dtype_func,
  10094. */
  10095. __Pyx_XDECREF(((PyObject *)__pyx_r));
  10096. /* "View.MemoryView":778
  10097. * if isinstance(memview, _memoryviewslice):
  10098. * return memoryview_fromslice(dst, new_ndim,
  10099. * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
  10100. * memviewsliceobj.to_dtype_func,
  10101. * memview.dtype_is_object)
  10102. */
  10103. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
  10104. /* "View.MemoryView":779
  10105. * return memoryview_fromslice(dst, new_ndim,
  10106. * memviewsliceobj.to_object_func,
  10107. * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
  10108. * memview.dtype_is_object)
  10109. * else:
  10110. */
  10111. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
  10112. /* "View.MemoryView":777
  10113. *
  10114. * if isinstance(memview, _memoryviewslice):
  10115. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  10116. * memviewsliceobj.to_object_func,
  10117. * memviewsliceobj.to_dtype_func,
  10118. */
  10119. __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
  10120. __Pyx_GOTREF(__pyx_t_3);
  10121. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
  10122. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  10123. __pyx_t_3 = 0;
  10124. goto __pyx_L0;
  10125. /* "View.MemoryView":776
  10126. * new_ndim += 1
  10127. *
  10128. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  10129. * return memoryview_fromslice(dst, new_ndim,
  10130. * memviewsliceobj.to_object_func,
  10131. */
  10132. }
  10133. /* "View.MemoryView":782
  10134. * memview.dtype_is_object)
  10135. * else:
  10136. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  10137. * memview.dtype_is_object)
  10138. *
  10139. */
  10140. /*else*/ {
  10141. __Pyx_XDECREF(((PyObject *)__pyx_r));
  10142. /* "View.MemoryView":783
  10143. * else:
  10144. * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  10145. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  10146. *
  10147. *
  10148. */
  10149. __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
  10150. __Pyx_GOTREF(__pyx_t_3);
  10151. /* "View.MemoryView":782
  10152. * memview.dtype_is_object)
  10153. * else:
  10154. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  10155. * memview.dtype_is_object)
  10156. *
  10157. */
  10158. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
  10159. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  10160. __pyx_t_3 = 0;
  10161. goto __pyx_L0;
  10162. }
  10163. /* "View.MemoryView":710
  10164. *
  10165. * @cname('__pyx_memview_slice')
  10166. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  10167. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  10168. * cdef bint negative_step
  10169. */
  10170. /* function exit code */
  10171. __pyx_L1_error:;
  10172. __Pyx_XDECREF(__pyx_t_3);
  10173. __Pyx_XDECREF(__pyx_t_9);
  10174. __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10175. __pyx_r = 0;
  10176. __pyx_L0:;
  10177. __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  10178. __Pyx_XDECREF(__pyx_v_index);
  10179. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  10180. __Pyx_RefNannyFinishContext();
  10181. return __pyx_r;
  10182. }
  10183. /* "View.MemoryView":807
  10184. *
  10185. * @cname('__pyx_memoryview_slice_memviewslice')
  10186. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  10187. * __Pyx_memviewslice *dst,
  10188. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  10189. */
  10190. static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  10191. Py_ssize_t __pyx_v_new_shape;
  10192. int __pyx_v_negative_step;
  10193. int __pyx_r;
  10194. int __pyx_t_1;
  10195. int __pyx_t_2;
  10196. int __pyx_t_3;
  10197. int __pyx_lineno = 0;
  10198. const char *__pyx_filename = NULL;
  10199. int __pyx_clineno = 0;
  10200. /* "View.MemoryView":827
  10201. * cdef bint negative_step
  10202. *
  10203. * if not is_slice: # <<<<<<<<<<<<<<
  10204. *
  10205. * if start < 0:
  10206. */
  10207. __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  10208. if (__pyx_t_1) {
  10209. /* "View.MemoryView":829
  10210. * if not is_slice:
  10211. *
  10212. * if start < 0: # <<<<<<<<<<<<<<
  10213. * start += shape
  10214. * if not 0 <= start < shape:
  10215. */
  10216. __pyx_t_1 = ((__pyx_v_start < 0) != 0);
  10217. if (__pyx_t_1) {
  10218. /* "View.MemoryView":830
  10219. *
  10220. * if start < 0:
  10221. * start += shape # <<<<<<<<<<<<<<
  10222. * if not 0 <= start < shape:
  10223. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10224. */
  10225. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  10226. /* "View.MemoryView":829
  10227. * if not is_slice:
  10228. *
  10229. * if start < 0: # <<<<<<<<<<<<<<
  10230. * start += shape
  10231. * if not 0 <= start < shape:
  10232. */
  10233. }
  10234. /* "View.MemoryView":831
  10235. * if start < 0:
  10236. * start += shape
  10237. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  10238. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10239. * else:
  10240. */
  10241. __pyx_t_1 = (0 <= __pyx_v_start);
  10242. if (__pyx_t_1) {
  10243. __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
  10244. }
  10245. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  10246. if (__pyx_t_2) {
  10247. /* "View.MemoryView":832
  10248. * start += shape
  10249. * if not 0 <= start < shape:
  10250. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
  10251. * else:
  10252. *
  10253. */
  10254. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
  10255. /* "View.MemoryView":831
  10256. * if start < 0:
  10257. * start += shape
  10258. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  10259. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10260. * else:
  10261. */
  10262. }
  10263. /* "View.MemoryView":827
  10264. * cdef bint negative_step
  10265. *
  10266. * if not is_slice: # <<<<<<<<<<<<<<
  10267. *
  10268. * if start < 0:
  10269. */
  10270. goto __pyx_L3;
  10271. }
  10272. /* "View.MemoryView":835
  10273. * else:
  10274. *
  10275. * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
  10276. *
  10277. * if have_step and step == 0:
  10278. */
  10279. /*else*/ {
  10280. __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
  10281. if (__pyx_t_1) {
  10282. } else {
  10283. __pyx_t_2 = __pyx_t_1;
  10284. goto __pyx_L6_bool_binop_done;
  10285. }
  10286. __pyx_t_1 = ((__pyx_v_step < 0) != 0);
  10287. __pyx_t_2 = __pyx_t_1;
  10288. __pyx_L6_bool_binop_done:;
  10289. __pyx_v_negative_step = __pyx_t_2;
  10290. /* "View.MemoryView":837
  10291. * negative_step = have_step != 0 and step < 0
  10292. *
  10293. * if have_step and step == 0: # <<<<<<<<<<<<<<
  10294. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  10295. *
  10296. */
  10297. __pyx_t_1 = (__pyx_v_have_step != 0);
  10298. if (__pyx_t_1) {
  10299. } else {
  10300. __pyx_t_2 = __pyx_t_1;
  10301. goto __pyx_L9_bool_binop_done;
  10302. }
  10303. __pyx_t_1 = ((__pyx_v_step == 0) != 0);
  10304. __pyx_t_2 = __pyx_t_1;
  10305. __pyx_L9_bool_binop_done:;
  10306. if (__pyx_t_2) {
  10307. /* "View.MemoryView":838
  10308. *
  10309. * if have_step and step == 0:
  10310. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
  10311. *
  10312. *
  10313. */
  10314. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
  10315. /* "View.MemoryView":837
  10316. * negative_step = have_step != 0 and step < 0
  10317. *
  10318. * if have_step and step == 0: # <<<<<<<<<<<<<<
  10319. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  10320. *
  10321. */
  10322. }
  10323. /* "View.MemoryView":841
  10324. *
  10325. *
  10326. * if have_start: # <<<<<<<<<<<<<<
  10327. * if start < 0:
  10328. * start += shape
  10329. */
  10330. __pyx_t_2 = (__pyx_v_have_start != 0);
  10331. if (__pyx_t_2) {
  10332. /* "View.MemoryView":842
  10333. *
  10334. * if have_start:
  10335. * if start < 0: # <<<<<<<<<<<<<<
  10336. * start += shape
  10337. * if start < 0:
  10338. */
  10339. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  10340. if (__pyx_t_2) {
  10341. /* "View.MemoryView":843
  10342. * if have_start:
  10343. * if start < 0:
  10344. * start += shape # <<<<<<<<<<<<<<
  10345. * if start < 0:
  10346. * start = 0
  10347. */
  10348. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  10349. /* "View.MemoryView":844
  10350. * if start < 0:
  10351. * start += shape
  10352. * if start < 0: # <<<<<<<<<<<<<<
  10353. * start = 0
  10354. * elif start >= shape:
  10355. */
  10356. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  10357. if (__pyx_t_2) {
  10358. /* "View.MemoryView":845
  10359. * start += shape
  10360. * if start < 0:
  10361. * start = 0 # <<<<<<<<<<<<<<
  10362. * elif start >= shape:
  10363. * if negative_step:
  10364. */
  10365. __pyx_v_start = 0;
  10366. /* "View.MemoryView":844
  10367. * if start < 0:
  10368. * start += shape
  10369. * if start < 0: # <<<<<<<<<<<<<<
  10370. * start = 0
  10371. * elif start >= shape:
  10372. */
  10373. }
  10374. /* "View.MemoryView":842
  10375. *
  10376. * if have_start:
  10377. * if start < 0: # <<<<<<<<<<<<<<
  10378. * start += shape
  10379. * if start < 0:
  10380. */
  10381. goto __pyx_L12;
  10382. }
  10383. /* "View.MemoryView":846
  10384. * if start < 0:
  10385. * start = 0
  10386. * elif start >= shape: # <<<<<<<<<<<<<<
  10387. * if negative_step:
  10388. * start = shape - 1
  10389. */
  10390. __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
  10391. if (__pyx_t_2) {
  10392. /* "View.MemoryView":847
  10393. * start = 0
  10394. * elif start >= shape:
  10395. * if negative_step: # <<<<<<<<<<<<<<
  10396. * start = shape - 1
  10397. * else:
  10398. */
  10399. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10400. if (__pyx_t_2) {
  10401. /* "View.MemoryView":848
  10402. * elif start >= shape:
  10403. * if negative_step:
  10404. * start = shape - 1 # <<<<<<<<<<<<<<
  10405. * else:
  10406. * start = shape
  10407. */
  10408. __pyx_v_start = (__pyx_v_shape - 1);
  10409. /* "View.MemoryView":847
  10410. * start = 0
  10411. * elif start >= shape:
  10412. * if negative_step: # <<<<<<<<<<<<<<
  10413. * start = shape - 1
  10414. * else:
  10415. */
  10416. goto __pyx_L14;
  10417. }
  10418. /* "View.MemoryView":850
  10419. * start = shape - 1
  10420. * else:
  10421. * start = shape # <<<<<<<<<<<<<<
  10422. * else:
  10423. * if negative_step:
  10424. */
  10425. /*else*/ {
  10426. __pyx_v_start = __pyx_v_shape;
  10427. }
  10428. __pyx_L14:;
  10429. /* "View.MemoryView":846
  10430. * if start < 0:
  10431. * start = 0
  10432. * elif start >= shape: # <<<<<<<<<<<<<<
  10433. * if negative_step:
  10434. * start = shape - 1
  10435. */
  10436. }
  10437. __pyx_L12:;
  10438. /* "View.MemoryView":841
  10439. *
  10440. *
  10441. * if have_start: # <<<<<<<<<<<<<<
  10442. * if start < 0:
  10443. * start += shape
  10444. */
  10445. goto __pyx_L11;
  10446. }
  10447. /* "View.MemoryView":852
  10448. * start = shape
  10449. * else:
  10450. * if negative_step: # <<<<<<<<<<<<<<
  10451. * start = shape - 1
  10452. * else:
  10453. */
  10454. /*else*/ {
  10455. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10456. if (__pyx_t_2) {
  10457. /* "View.MemoryView":853
  10458. * else:
  10459. * if negative_step:
  10460. * start = shape - 1 # <<<<<<<<<<<<<<
  10461. * else:
  10462. * start = 0
  10463. */
  10464. __pyx_v_start = (__pyx_v_shape - 1);
  10465. /* "View.MemoryView":852
  10466. * start = shape
  10467. * else:
  10468. * if negative_step: # <<<<<<<<<<<<<<
  10469. * start = shape - 1
  10470. * else:
  10471. */
  10472. goto __pyx_L15;
  10473. }
  10474. /* "View.MemoryView":855
  10475. * start = shape - 1
  10476. * else:
  10477. * start = 0 # <<<<<<<<<<<<<<
  10478. *
  10479. * if have_stop:
  10480. */
  10481. /*else*/ {
  10482. __pyx_v_start = 0;
  10483. }
  10484. __pyx_L15:;
  10485. }
  10486. __pyx_L11:;
  10487. /* "View.MemoryView":857
  10488. * start = 0
  10489. *
  10490. * if have_stop: # <<<<<<<<<<<<<<
  10491. * if stop < 0:
  10492. * stop += shape
  10493. */
  10494. __pyx_t_2 = (__pyx_v_have_stop != 0);
  10495. if (__pyx_t_2) {
  10496. /* "View.MemoryView":858
  10497. *
  10498. * if have_stop:
  10499. * if stop < 0: # <<<<<<<<<<<<<<
  10500. * stop += shape
  10501. * if stop < 0:
  10502. */
  10503. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  10504. if (__pyx_t_2) {
  10505. /* "View.MemoryView":859
  10506. * if have_stop:
  10507. * if stop < 0:
  10508. * stop += shape # <<<<<<<<<<<<<<
  10509. * if stop < 0:
  10510. * stop = 0
  10511. */
  10512. __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
  10513. /* "View.MemoryView":860
  10514. * if stop < 0:
  10515. * stop += shape
  10516. * if stop < 0: # <<<<<<<<<<<<<<
  10517. * stop = 0
  10518. * elif stop > shape:
  10519. */
  10520. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  10521. if (__pyx_t_2) {
  10522. /* "View.MemoryView":861
  10523. * stop += shape
  10524. * if stop < 0:
  10525. * stop = 0 # <<<<<<<<<<<<<<
  10526. * elif stop > shape:
  10527. * stop = shape
  10528. */
  10529. __pyx_v_stop = 0;
  10530. /* "View.MemoryView":860
  10531. * if stop < 0:
  10532. * stop += shape
  10533. * if stop < 0: # <<<<<<<<<<<<<<
  10534. * stop = 0
  10535. * elif stop > shape:
  10536. */
  10537. }
  10538. /* "View.MemoryView":858
  10539. *
  10540. * if have_stop:
  10541. * if stop < 0: # <<<<<<<<<<<<<<
  10542. * stop += shape
  10543. * if stop < 0:
  10544. */
  10545. goto __pyx_L17;
  10546. }
  10547. /* "View.MemoryView":862
  10548. * if stop < 0:
  10549. * stop = 0
  10550. * elif stop > shape: # <<<<<<<<<<<<<<
  10551. * stop = shape
  10552. * else:
  10553. */
  10554. __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
  10555. if (__pyx_t_2) {
  10556. /* "View.MemoryView":863
  10557. * stop = 0
  10558. * elif stop > shape:
  10559. * stop = shape # <<<<<<<<<<<<<<
  10560. * else:
  10561. * if negative_step:
  10562. */
  10563. __pyx_v_stop = __pyx_v_shape;
  10564. /* "View.MemoryView":862
  10565. * if stop < 0:
  10566. * stop = 0
  10567. * elif stop > shape: # <<<<<<<<<<<<<<
  10568. * stop = shape
  10569. * else:
  10570. */
  10571. }
  10572. __pyx_L17:;
  10573. /* "View.MemoryView":857
  10574. * start = 0
  10575. *
  10576. * if have_stop: # <<<<<<<<<<<<<<
  10577. * if stop < 0:
  10578. * stop += shape
  10579. */
  10580. goto __pyx_L16;
  10581. }
  10582. /* "View.MemoryView":865
  10583. * stop = shape
  10584. * else:
  10585. * if negative_step: # <<<<<<<<<<<<<<
  10586. * stop = -1
  10587. * else:
  10588. */
  10589. /*else*/ {
  10590. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10591. if (__pyx_t_2) {
  10592. /* "View.MemoryView":866
  10593. * else:
  10594. * if negative_step:
  10595. * stop = -1 # <<<<<<<<<<<<<<
  10596. * else:
  10597. * stop = shape
  10598. */
  10599. __pyx_v_stop = -1L;
  10600. /* "View.MemoryView":865
  10601. * stop = shape
  10602. * else:
  10603. * if negative_step: # <<<<<<<<<<<<<<
  10604. * stop = -1
  10605. * else:
  10606. */
  10607. goto __pyx_L19;
  10608. }
  10609. /* "View.MemoryView":868
  10610. * stop = -1
  10611. * else:
  10612. * stop = shape # <<<<<<<<<<<<<<
  10613. *
  10614. * if not have_step:
  10615. */
  10616. /*else*/ {
  10617. __pyx_v_stop = __pyx_v_shape;
  10618. }
  10619. __pyx_L19:;
  10620. }
  10621. __pyx_L16:;
  10622. /* "View.MemoryView":870
  10623. * stop = shape
  10624. *
  10625. * if not have_step: # <<<<<<<<<<<<<<
  10626. * step = 1
  10627. *
  10628. */
  10629. __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
  10630. if (__pyx_t_2) {
  10631. /* "View.MemoryView":871
  10632. *
  10633. * if not have_step:
  10634. * step = 1 # <<<<<<<<<<<<<<
  10635. *
  10636. *
  10637. */
  10638. __pyx_v_step = 1;
  10639. /* "View.MemoryView":870
  10640. * stop = shape
  10641. *
  10642. * if not have_step: # <<<<<<<<<<<<<<
  10643. * step = 1
  10644. *
  10645. */
  10646. }
  10647. /* "View.MemoryView":875
  10648. *
  10649. * with cython.cdivision(True):
  10650. * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
  10651. *
  10652. * if (stop - start) - step * new_shape:
  10653. */
  10654. __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
  10655. /* "View.MemoryView":877
  10656. * new_shape = (stop - start) // step
  10657. *
  10658. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  10659. * new_shape += 1
  10660. *
  10661. */
  10662. __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
  10663. if (__pyx_t_2) {
  10664. /* "View.MemoryView":878
  10665. *
  10666. * if (stop - start) - step * new_shape:
  10667. * new_shape += 1 # <<<<<<<<<<<<<<
  10668. *
  10669. * if new_shape < 0:
  10670. */
  10671. __pyx_v_new_shape = (__pyx_v_new_shape + 1);
  10672. /* "View.MemoryView":877
  10673. * new_shape = (stop - start) // step
  10674. *
  10675. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  10676. * new_shape += 1
  10677. *
  10678. */
  10679. }
  10680. /* "View.MemoryView":880
  10681. * new_shape += 1
  10682. *
  10683. * if new_shape < 0: # <<<<<<<<<<<<<<
  10684. * new_shape = 0
  10685. *
  10686. */
  10687. __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
  10688. if (__pyx_t_2) {
  10689. /* "View.MemoryView":881
  10690. *
  10691. * if new_shape < 0:
  10692. * new_shape = 0 # <<<<<<<<<<<<<<
  10693. *
  10694. *
  10695. */
  10696. __pyx_v_new_shape = 0;
  10697. /* "View.MemoryView":880
  10698. * new_shape += 1
  10699. *
  10700. * if new_shape < 0: # <<<<<<<<<<<<<<
  10701. * new_shape = 0
  10702. *
  10703. */
  10704. }
  10705. /* "View.MemoryView":884
  10706. *
  10707. *
  10708. * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
  10709. * dst.shape[new_ndim] = new_shape
  10710. * dst.suboffsets[new_ndim] = suboffset
  10711. */
  10712. (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
  10713. /* "View.MemoryView":885
  10714. *
  10715. * dst.strides[new_ndim] = stride * step
  10716. * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
  10717. * dst.suboffsets[new_ndim] = suboffset
  10718. *
  10719. */
  10720. (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
  10721. /* "View.MemoryView":886
  10722. * dst.strides[new_ndim] = stride * step
  10723. * dst.shape[new_ndim] = new_shape
  10724. * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
  10725. *
  10726. *
  10727. */
  10728. (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  10729. }
  10730. __pyx_L3:;
  10731. /* "View.MemoryView":889
  10732. *
  10733. *
  10734. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  10735. * dst.data += start * stride
  10736. * else:
  10737. */
  10738. __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  10739. if (__pyx_t_2) {
  10740. /* "View.MemoryView":890
  10741. *
  10742. * if suboffset_dim[0] < 0:
  10743. * dst.data += start * stride # <<<<<<<<<<<<<<
  10744. * else:
  10745. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10746. */
  10747. __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
  10748. /* "View.MemoryView":889
  10749. *
  10750. *
  10751. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  10752. * dst.data += start * stride
  10753. * else:
  10754. */
  10755. goto __pyx_L23;
  10756. }
  10757. /* "View.MemoryView":892
  10758. * dst.data += start * stride
  10759. * else:
  10760. * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
  10761. *
  10762. * if suboffset >= 0:
  10763. */
  10764. /*else*/ {
  10765. __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
  10766. (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  10767. }
  10768. __pyx_L23:;
  10769. /* "View.MemoryView":894
  10770. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10771. *
  10772. * if suboffset >= 0: # <<<<<<<<<<<<<<
  10773. * if not is_slice:
  10774. * if new_ndim == 0:
  10775. */
  10776. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  10777. if (__pyx_t_2) {
  10778. /* "View.MemoryView":895
  10779. *
  10780. * if suboffset >= 0:
  10781. * if not is_slice: # <<<<<<<<<<<<<<
  10782. * if new_ndim == 0:
  10783. * dst.data = (<char **> dst.data)[0] + suboffset
  10784. */
  10785. __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
  10786. if (__pyx_t_2) {
  10787. /* "View.MemoryView":896
  10788. * if suboffset >= 0:
  10789. * if not is_slice:
  10790. * if new_ndim == 0: # <<<<<<<<<<<<<<
  10791. * dst.data = (<char **> dst.data)[0] + suboffset
  10792. * else:
  10793. */
  10794. __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
  10795. if (__pyx_t_2) {
  10796. /* "View.MemoryView":897
  10797. * if not is_slice:
  10798. * if new_ndim == 0:
  10799. * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
  10800. * else:
  10801. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  10802. */
  10803. __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
  10804. /* "View.MemoryView":896
  10805. * if suboffset >= 0:
  10806. * if not is_slice:
  10807. * if new_ndim == 0: # <<<<<<<<<<<<<<
  10808. * dst.data = (<char **> dst.data)[0] + suboffset
  10809. * else:
  10810. */
  10811. goto __pyx_L26;
  10812. }
  10813. /* "View.MemoryView":899
  10814. * dst.data = (<char **> dst.data)[0] + suboffset
  10815. * else:
  10816. * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
  10817. * "must be indexed and not sliced", dim)
  10818. * else:
  10819. */
  10820. /*else*/ {
  10821. /* "View.MemoryView":900
  10822. * else:
  10823. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  10824. * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
  10825. * else:
  10826. * suboffset_dim[0] = new_ndim
  10827. */
  10828. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
  10829. }
  10830. __pyx_L26:;
  10831. /* "View.MemoryView":895
  10832. *
  10833. * if suboffset >= 0:
  10834. * if not is_slice: # <<<<<<<<<<<<<<
  10835. * if new_ndim == 0:
  10836. * dst.data = (<char **> dst.data)[0] + suboffset
  10837. */
  10838. goto __pyx_L25;
  10839. }
  10840. /* "View.MemoryView":902
  10841. * "must be indexed and not sliced", dim)
  10842. * else:
  10843. * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
  10844. *
  10845. * return 0
  10846. */
  10847. /*else*/ {
  10848. (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
  10849. }
  10850. __pyx_L25:;
  10851. /* "View.MemoryView":894
  10852. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10853. *
  10854. * if suboffset >= 0: # <<<<<<<<<<<<<<
  10855. * if not is_slice:
  10856. * if new_ndim == 0:
  10857. */
  10858. }
  10859. /* "View.MemoryView":904
  10860. * suboffset_dim[0] = new_ndim
  10861. *
  10862. * return 0 # <<<<<<<<<<<<<<
  10863. *
  10864. *
  10865. */
  10866. __pyx_r = 0;
  10867. goto __pyx_L0;
  10868. /* "View.MemoryView":807
  10869. *
  10870. * @cname('__pyx_memoryview_slice_memviewslice')
  10871. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  10872. * __Pyx_memviewslice *dst,
  10873. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  10874. */
  10875. /* function exit code */
  10876. __pyx_L1_error:;
  10877. {
  10878. #ifdef WITH_THREAD
  10879. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  10880. #endif
  10881. __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10882. #ifdef WITH_THREAD
  10883. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  10884. #endif
  10885. }
  10886. __pyx_r = -1;
  10887. __pyx_L0:;
  10888. return __pyx_r;
  10889. }
  10890. /* "View.MemoryView":910
  10891. *
  10892. * @cname('__pyx_pybuffer_index')
  10893. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  10894. * Py_ssize_t dim) except NULL:
  10895. * cdef Py_ssize_t shape, stride, suboffset = -1
  10896. */
  10897. static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  10898. Py_ssize_t __pyx_v_shape;
  10899. Py_ssize_t __pyx_v_stride;
  10900. Py_ssize_t __pyx_v_suboffset;
  10901. Py_ssize_t __pyx_v_itemsize;
  10902. char *__pyx_v_resultp;
  10903. char *__pyx_r;
  10904. __Pyx_RefNannyDeclarations
  10905. Py_ssize_t __pyx_t_1;
  10906. int __pyx_t_2;
  10907. PyObject *__pyx_t_3 = NULL;
  10908. PyObject *__pyx_t_4 = NULL;
  10909. int __pyx_lineno = 0;
  10910. const char *__pyx_filename = NULL;
  10911. int __pyx_clineno = 0;
  10912. __Pyx_RefNannySetupContext("pybuffer_index", 0);
  10913. /* "View.MemoryView":912
  10914. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
  10915. * Py_ssize_t dim) except NULL:
  10916. * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
  10917. * cdef Py_ssize_t itemsize = view.itemsize
  10918. * cdef char *resultp
  10919. */
  10920. __pyx_v_suboffset = -1L;
  10921. /* "View.MemoryView":913
  10922. * Py_ssize_t dim) except NULL:
  10923. * cdef Py_ssize_t shape, stride, suboffset = -1
  10924. * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
  10925. * cdef char *resultp
  10926. *
  10927. */
  10928. __pyx_t_1 = __pyx_v_view->itemsize;
  10929. __pyx_v_itemsize = __pyx_t_1;
  10930. /* "View.MemoryView":916
  10931. * cdef char *resultp
  10932. *
  10933. * if view.ndim == 0: # <<<<<<<<<<<<<<
  10934. * shape = view.len / itemsize
  10935. * stride = itemsize
  10936. */
  10937. __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  10938. if (__pyx_t_2) {
  10939. /* "View.MemoryView":917
  10940. *
  10941. * if view.ndim == 0:
  10942. * shape = view.len / itemsize # <<<<<<<<<<<<<<
  10943. * stride = itemsize
  10944. * else:
  10945. */
  10946. if (unlikely(__pyx_v_itemsize == 0)) {
  10947. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  10948. __PYX_ERR(2, 917, __pyx_L1_error)
  10949. }
  10950. else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
  10951. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  10952. __PYX_ERR(2, 917, __pyx_L1_error)
  10953. }
  10954. __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
  10955. /* "View.MemoryView":918
  10956. * if view.ndim == 0:
  10957. * shape = view.len / itemsize
  10958. * stride = itemsize # <<<<<<<<<<<<<<
  10959. * else:
  10960. * shape = view.shape[dim]
  10961. */
  10962. __pyx_v_stride = __pyx_v_itemsize;
  10963. /* "View.MemoryView":916
  10964. * cdef char *resultp
  10965. *
  10966. * if view.ndim == 0: # <<<<<<<<<<<<<<
  10967. * shape = view.len / itemsize
  10968. * stride = itemsize
  10969. */
  10970. goto __pyx_L3;
  10971. }
  10972. /* "View.MemoryView":920
  10973. * stride = itemsize
  10974. * else:
  10975. * shape = view.shape[dim] # <<<<<<<<<<<<<<
  10976. * stride = view.strides[dim]
  10977. * if view.suboffsets != NULL:
  10978. */
  10979. /*else*/ {
  10980. __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
  10981. /* "View.MemoryView":921
  10982. * else:
  10983. * shape = view.shape[dim]
  10984. * stride = view.strides[dim] # <<<<<<<<<<<<<<
  10985. * if view.suboffsets != NULL:
  10986. * suboffset = view.suboffsets[dim]
  10987. */
  10988. __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
  10989. /* "View.MemoryView":922
  10990. * shape = view.shape[dim]
  10991. * stride = view.strides[dim]
  10992. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  10993. * suboffset = view.suboffsets[dim]
  10994. *
  10995. */
  10996. __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
  10997. if (__pyx_t_2) {
  10998. /* "View.MemoryView":923
  10999. * stride = view.strides[dim]
  11000. * if view.suboffsets != NULL:
  11001. * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
  11002. *
  11003. * if index < 0:
  11004. */
  11005. __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
  11006. /* "View.MemoryView":922
  11007. * shape = view.shape[dim]
  11008. * stride = view.strides[dim]
  11009. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  11010. * suboffset = view.suboffsets[dim]
  11011. *
  11012. */
  11013. }
  11014. }
  11015. __pyx_L3:;
  11016. /* "View.MemoryView":925
  11017. * suboffset = view.suboffsets[dim]
  11018. *
  11019. * if index < 0: # <<<<<<<<<<<<<<
  11020. * index += view.shape[dim]
  11021. * if index < 0:
  11022. */
  11023. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  11024. if (__pyx_t_2) {
  11025. /* "View.MemoryView":926
  11026. *
  11027. * if index < 0:
  11028. * index += view.shape[dim] # <<<<<<<<<<<<<<
  11029. * if index < 0:
  11030. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11031. */
  11032. __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
  11033. /* "View.MemoryView":927
  11034. * if index < 0:
  11035. * index += view.shape[dim]
  11036. * if index < 0: # <<<<<<<<<<<<<<
  11037. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11038. *
  11039. */
  11040. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  11041. if (unlikely(__pyx_t_2)) {
  11042. /* "View.MemoryView":928
  11043. * index += view.shape[dim]
  11044. * if index < 0:
  11045. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  11046. *
  11047. * if index >= shape:
  11048. */
  11049. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
  11050. __Pyx_GOTREF(__pyx_t_3);
  11051. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
  11052. __Pyx_GOTREF(__pyx_t_4);
  11053. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11054. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
  11055. __Pyx_GOTREF(__pyx_t_3);
  11056. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11057. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  11058. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11059. __PYX_ERR(2, 928, __pyx_L1_error)
  11060. /* "View.MemoryView":927
  11061. * if index < 0:
  11062. * index += view.shape[dim]
  11063. * if index < 0: # <<<<<<<<<<<<<<
  11064. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11065. *
  11066. */
  11067. }
  11068. /* "View.MemoryView":925
  11069. * suboffset = view.suboffsets[dim]
  11070. *
  11071. * if index < 0: # <<<<<<<<<<<<<<
  11072. * index += view.shape[dim]
  11073. * if index < 0:
  11074. */
  11075. }
  11076. /* "View.MemoryView":930
  11077. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11078. *
  11079. * if index >= shape: # <<<<<<<<<<<<<<
  11080. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11081. *
  11082. */
  11083. __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  11084. if (unlikely(__pyx_t_2)) {
  11085. /* "View.MemoryView":931
  11086. *
  11087. * if index >= shape:
  11088. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  11089. *
  11090. * resultp = bufp + index * stride
  11091. */
  11092. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
  11093. __Pyx_GOTREF(__pyx_t_3);
  11094. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
  11095. __Pyx_GOTREF(__pyx_t_4);
  11096. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11097. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
  11098. __Pyx_GOTREF(__pyx_t_3);
  11099. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11100. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  11101. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11102. __PYX_ERR(2, 931, __pyx_L1_error)
  11103. /* "View.MemoryView":930
  11104. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11105. *
  11106. * if index >= shape: # <<<<<<<<<<<<<<
  11107. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11108. *
  11109. */
  11110. }
  11111. /* "View.MemoryView":933
  11112. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11113. *
  11114. * resultp = bufp + index * stride # <<<<<<<<<<<<<<
  11115. * if suboffset >= 0:
  11116. * resultp = (<char **> resultp)[0] + suboffset
  11117. */
  11118. __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
  11119. /* "View.MemoryView":934
  11120. *
  11121. * resultp = bufp + index * stride
  11122. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11123. * resultp = (<char **> resultp)[0] + suboffset
  11124. *
  11125. */
  11126. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  11127. if (__pyx_t_2) {
  11128. /* "View.MemoryView":935
  11129. * resultp = bufp + index * stride
  11130. * if suboffset >= 0:
  11131. * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
  11132. *
  11133. * return resultp
  11134. */
  11135. __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
  11136. /* "View.MemoryView":934
  11137. *
  11138. * resultp = bufp + index * stride
  11139. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11140. * resultp = (<char **> resultp)[0] + suboffset
  11141. *
  11142. */
  11143. }
  11144. /* "View.MemoryView":937
  11145. * resultp = (<char **> resultp)[0] + suboffset
  11146. *
  11147. * return resultp # <<<<<<<<<<<<<<
  11148. *
  11149. *
  11150. */
  11151. __pyx_r = __pyx_v_resultp;
  11152. goto __pyx_L0;
  11153. /* "View.MemoryView":910
  11154. *
  11155. * @cname('__pyx_pybuffer_index')
  11156. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  11157. * Py_ssize_t dim) except NULL:
  11158. * cdef Py_ssize_t shape, stride, suboffset = -1
  11159. */
  11160. /* function exit code */
  11161. __pyx_L1_error:;
  11162. __Pyx_XDECREF(__pyx_t_3);
  11163. __Pyx_XDECREF(__pyx_t_4);
  11164. __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11165. __pyx_r = NULL;
  11166. __pyx_L0:;
  11167. __Pyx_RefNannyFinishContext();
  11168. return __pyx_r;
  11169. }
  11170. /* "View.MemoryView":943
  11171. *
  11172. * @cname('__pyx_memslice_transpose')
  11173. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  11174. * cdef int ndim = memslice.memview.view.ndim
  11175. *
  11176. */
  11177. static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  11178. int __pyx_v_ndim;
  11179. Py_ssize_t *__pyx_v_shape;
  11180. Py_ssize_t *__pyx_v_strides;
  11181. int __pyx_v_i;
  11182. int __pyx_v_j;
  11183. int __pyx_r;
  11184. int __pyx_t_1;
  11185. Py_ssize_t *__pyx_t_2;
  11186. long __pyx_t_3;
  11187. long __pyx_t_4;
  11188. Py_ssize_t __pyx_t_5;
  11189. Py_ssize_t __pyx_t_6;
  11190. int __pyx_t_7;
  11191. int __pyx_t_8;
  11192. int __pyx_t_9;
  11193. int __pyx_lineno = 0;
  11194. const char *__pyx_filename = NULL;
  11195. int __pyx_clineno = 0;
  11196. /* "View.MemoryView":944
  11197. * @cname('__pyx_memslice_transpose')
  11198. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
  11199. * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
  11200. *
  11201. * cdef Py_ssize_t *shape = memslice.shape
  11202. */
  11203. __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  11204. __pyx_v_ndim = __pyx_t_1;
  11205. /* "View.MemoryView":946
  11206. * cdef int ndim = memslice.memview.view.ndim
  11207. *
  11208. * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
  11209. * cdef Py_ssize_t *strides = memslice.strides
  11210. *
  11211. */
  11212. __pyx_t_2 = __pyx_v_memslice->shape;
  11213. __pyx_v_shape = __pyx_t_2;
  11214. /* "View.MemoryView":947
  11215. *
  11216. * cdef Py_ssize_t *shape = memslice.shape
  11217. * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
  11218. *
  11219. *
  11220. */
  11221. __pyx_t_2 = __pyx_v_memslice->strides;
  11222. __pyx_v_strides = __pyx_t_2;
  11223. /* "View.MemoryView":951
  11224. *
  11225. * cdef int i, j
  11226. * for i in range(ndim / 2): # <<<<<<<<<<<<<<
  11227. * j = ndim - 1 - i
  11228. * strides[i], strides[j] = strides[j], strides[i]
  11229. */
  11230. __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  11231. __pyx_t_4 = __pyx_t_3;
  11232. for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
  11233. __pyx_v_i = __pyx_t_1;
  11234. /* "View.MemoryView":952
  11235. * cdef int i, j
  11236. * for i in range(ndim / 2):
  11237. * j = ndim - 1 - i # <<<<<<<<<<<<<<
  11238. * strides[i], strides[j] = strides[j], strides[i]
  11239. * shape[i], shape[j] = shape[j], shape[i]
  11240. */
  11241. __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
  11242. /* "View.MemoryView":953
  11243. * for i in range(ndim / 2):
  11244. * j = ndim - 1 - i
  11245. * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
  11246. * shape[i], shape[j] = shape[j], shape[i]
  11247. *
  11248. */
  11249. __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
  11250. __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
  11251. (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
  11252. (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
  11253. /* "View.MemoryView":954
  11254. * j = ndim - 1 - i
  11255. * strides[i], strides[j] = strides[j], strides[i]
  11256. * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
  11257. *
  11258. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  11259. */
  11260. __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
  11261. __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
  11262. (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
  11263. (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
  11264. /* "View.MemoryView":956
  11265. * shape[i], shape[j] = shape[j], shape[i]
  11266. *
  11267. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  11268. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11269. *
  11270. */
  11271. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
  11272. if (!__pyx_t_8) {
  11273. } else {
  11274. __pyx_t_7 = __pyx_t_8;
  11275. goto __pyx_L6_bool_binop_done;
  11276. }
  11277. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
  11278. __pyx_t_7 = __pyx_t_8;
  11279. __pyx_L6_bool_binop_done:;
  11280. if (__pyx_t_7) {
  11281. /* "View.MemoryView":957
  11282. *
  11283. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  11284. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
  11285. *
  11286. * return 1
  11287. */
  11288. __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
  11289. /* "View.MemoryView":956
  11290. * shape[i], shape[j] = shape[j], shape[i]
  11291. *
  11292. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  11293. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11294. *
  11295. */
  11296. }
  11297. }
  11298. /* "View.MemoryView":959
  11299. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11300. *
  11301. * return 1 # <<<<<<<<<<<<<<
  11302. *
  11303. *
  11304. */
  11305. __pyx_r = 1;
  11306. goto __pyx_L0;
  11307. /* "View.MemoryView":943
  11308. *
  11309. * @cname('__pyx_memslice_transpose')
  11310. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  11311. * cdef int ndim = memslice.memview.view.ndim
  11312. *
  11313. */
  11314. /* function exit code */
  11315. __pyx_L1_error:;
  11316. {
  11317. #ifdef WITH_THREAD
  11318. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  11319. #endif
  11320. __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11321. #ifdef WITH_THREAD
  11322. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  11323. #endif
  11324. }
  11325. __pyx_r = 0;
  11326. __pyx_L0:;
  11327. return __pyx_r;
  11328. }
  11329. /* "View.MemoryView":976
  11330. * cdef int (*to_dtype_func)(char *, object) except 0
  11331. *
  11332. * def __dealloc__(self): # <<<<<<<<<<<<<<
  11333. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11334. *
  11335. */
  11336. /* Python wrapper */
  11337. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
  11338. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  11339. __Pyx_RefNannyDeclarations
  11340. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  11341. __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11342. /* function exit code */
  11343. __Pyx_RefNannyFinishContext();
  11344. }
  11345. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11346. __Pyx_RefNannyDeclarations
  11347. __Pyx_RefNannySetupContext("__dealloc__", 0);
  11348. /* "View.MemoryView":977
  11349. *
  11350. * def __dealloc__(self):
  11351. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
  11352. *
  11353. * cdef convert_item_to_object(self, char *itemp):
  11354. */
  11355. __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
  11356. /* "View.MemoryView":976
  11357. * cdef int (*to_dtype_func)(char *, object) except 0
  11358. *
  11359. * def __dealloc__(self): # <<<<<<<<<<<<<<
  11360. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11361. *
  11362. */
  11363. /* function exit code */
  11364. __Pyx_RefNannyFinishContext();
  11365. }
  11366. /* "View.MemoryView":979
  11367. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11368. *
  11369. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  11370. * if self.to_object_func != NULL:
  11371. * return self.to_object_func(itemp)
  11372. */
  11373. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  11374. PyObject *__pyx_r = NULL;
  11375. __Pyx_RefNannyDeclarations
  11376. int __pyx_t_1;
  11377. PyObject *__pyx_t_2 = NULL;
  11378. int __pyx_lineno = 0;
  11379. const char *__pyx_filename = NULL;
  11380. int __pyx_clineno = 0;
  11381. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  11382. /* "View.MemoryView":980
  11383. *
  11384. * cdef convert_item_to_object(self, char *itemp):
  11385. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  11386. * return self.to_object_func(itemp)
  11387. * else:
  11388. */
  11389. __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  11390. if (__pyx_t_1) {
  11391. /* "View.MemoryView":981
  11392. * cdef convert_item_to_object(self, char *itemp):
  11393. * if self.to_object_func != NULL:
  11394. * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
  11395. * else:
  11396. * return memoryview.convert_item_to_object(self, itemp)
  11397. */
  11398. __Pyx_XDECREF(__pyx_r);
  11399. __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
  11400. __Pyx_GOTREF(__pyx_t_2);
  11401. __pyx_r = __pyx_t_2;
  11402. __pyx_t_2 = 0;
  11403. goto __pyx_L0;
  11404. /* "View.MemoryView":980
  11405. *
  11406. * cdef convert_item_to_object(self, char *itemp):
  11407. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  11408. * return self.to_object_func(itemp)
  11409. * else:
  11410. */
  11411. }
  11412. /* "View.MemoryView":983
  11413. * return self.to_object_func(itemp)
  11414. * else:
  11415. * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
  11416. *
  11417. * cdef assign_item_from_object(self, char *itemp, object value):
  11418. */
  11419. /*else*/ {
  11420. __Pyx_XDECREF(__pyx_r);
  11421. __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
  11422. __Pyx_GOTREF(__pyx_t_2);
  11423. __pyx_r = __pyx_t_2;
  11424. __pyx_t_2 = 0;
  11425. goto __pyx_L0;
  11426. }
  11427. /* "View.MemoryView":979
  11428. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11429. *
  11430. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  11431. * if self.to_object_func != NULL:
  11432. * return self.to_object_func(itemp)
  11433. */
  11434. /* function exit code */
  11435. __pyx_L1_error:;
  11436. __Pyx_XDECREF(__pyx_t_2);
  11437. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11438. __pyx_r = 0;
  11439. __pyx_L0:;
  11440. __Pyx_XGIVEREF(__pyx_r);
  11441. __Pyx_RefNannyFinishContext();
  11442. return __pyx_r;
  11443. }
  11444. /* "View.MemoryView":985
  11445. * return memoryview.convert_item_to_object(self, itemp)
  11446. *
  11447. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  11448. * if self.to_dtype_func != NULL:
  11449. * self.to_dtype_func(itemp, value)
  11450. */
  11451. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  11452. PyObject *__pyx_r = NULL;
  11453. __Pyx_RefNannyDeclarations
  11454. int __pyx_t_1;
  11455. int __pyx_t_2;
  11456. PyObject *__pyx_t_3 = NULL;
  11457. int __pyx_lineno = 0;
  11458. const char *__pyx_filename = NULL;
  11459. int __pyx_clineno = 0;
  11460. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  11461. /* "View.MemoryView":986
  11462. *
  11463. * cdef assign_item_from_object(self, char *itemp, object value):
  11464. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  11465. * self.to_dtype_func(itemp, value)
  11466. * else:
  11467. */
  11468. __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  11469. if (__pyx_t_1) {
  11470. /* "View.MemoryView":987
  11471. * cdef assign_item_from_object(self, char *itemp, object value):
  11472. * if self.to_dtype_func != NULL:
  11473. * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
  11474. * else:
  11475. * memoryview.assign_item_from_object(self, itemp, value)
  11476. */
  11477. __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
  11478. /* "View.MemoryView":986
  11479. *
  11480. * cdef assign_item_from_object(self, char *itemp, object value):
  11481. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  11482. * self.to_dtype_func(itemp, value)
  11483. * else:
  11484. */
  11485. goto __pyx_L3;
  11486. }
  11487. /* "View.MemoryView":989
  11488. * self.to_dtype_func(itemp, value)
  11489. * else:
  11490. * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
  11491. *
  11492. * @property
  11493. */
  11494. /*else*/ {
  11495. __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
  11496. __Pyx_GOTREF(__pyx_t_3);
  11497. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11498. }
  11499. __pyx_L3:;
  11500. /* "View.MemoryView":985
  11501. * return memoryview.convert_item_to_object(self, itemp)
  11502. *
  11503. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  11504. * if self.to_dtype_func != NULL:
  11505. * self.to_dtype_func(itemp, value)
  11506. */
  11507. /* function exit code */
  11508. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  11509. goto __pyx_L0;
  11510. __pyx_L1_error:;
  11511. __Pyx_XDECREF(__pyx_t_3);
  11512. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11513. __pyx_r = 0;
  11514. __pyx_L0:;
  11515. __Pyx_XGIVEREF(__pyx_r);
  11516. __Pyx_RefNannyFinishContext();
  11517. return __pyx_r;
  11518. }
  11519. /* "View.MemoryView":992
  11520. *
  11521. * @property
  11522. * def base(self): # <<<<<<<<<<<<<<
  11523. * return self.from_object
  11524. *
  11525. */
  11526. /* Python wrapper */
  11527. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  11528. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  11529. PyObject *__pyx_r = 0;
  11530. __Pyx_RefNannyDeclarations
  11531. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11532. __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11533. /* function exit code */
  11534. __Pyx_RefNannyFinishContext();
  11535. return __pyx_r;
  11536. }
  11537. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11538. PyObject *__pyx_r = NULL;
  11539. __Pyx_RefNannyDeclarations
  11540. __Pyx_RefNannySetupContext("__get__", 0);
  11541. /* "View.MemoryView":993
  11542. * @property
  11543. * def base(self):
  11544. * return self.from_object # <<<<<<<<<<<<<<
  11545. *
  11546. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  11547. */
  11548. __Pyx_XDECREF(__pyx_r);
  11549. __Pyx_INCREF(__pyx_v_self->from_object);
  11550. __pyx_r = __pyx_v_self->from_object;
  11551. goto __pyx_L0;
  11552. /* "View.MemoryView":992
  11553. *
  11554. * @property
  11555. * def base(self): # <<<<<<<<<<<<<<
  11556. * return self.from_object
  11557. *
  11558. */
  11559. /* function exit code */
  11560. __pyx_L0:;
  11561. __Pyx_XGIVEREF(__pyx_r);
  11562. __Pyx_RefNannyFinishContext();
  11563. return __pyx_r;
  11564. }
  11565. /* "(tree fragment)":1
  11566. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11567. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11568. * def __setstate_cython__(self, __pyx_state):
  11569. */
  11570. /* Python wrapper */
  11571. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11572. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11573. PyObject *__pyx_r = 0;
  11574. __Pyx_RefNannyDeclarations
  11575. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  11576. __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11577. /* function exit code */
  11578. __Pyx_RefNannyFinishContext();
  11579. return __pyx_r;
  11580. }
  11581. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11582. PyObject *__pyx_r = NULL;
  11583. __Pyx_RefNannyDeclarations
  11584. PyObject *__pyx_t_1 = NULL;
  11585. int __pyx_lineno = 0;
  11586. const char *__pyx_filename = NULL;
  11587. int __pyx_clineno = 0;
  11588. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  11589. /* "(tree fragment)":2
  11590. * def __reduce_cython__(self):
  11591. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11592. * def __setstate_cython__(self, __pyx_state):
  11593. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11594. */
  11595. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  11596. __Pyx_GOTREF(__pyx_t_1);
  11597. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11598. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11599. __PYX_ERR(2, 2, __pyx_L1_error)
  11600. /* "(tree fragment)":1
  11601. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11602. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11603. * def __setstate_cython__(self, __pyx_state):
  11604. */
  11605. /* function exit code */
  11606. __pyx_L1_error:;
  11607. __Pyx_XDECREF(__pyx_t_1);
  11608. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11609. __pyx_r = NULL;
  11610. __Pyx_XGIVEREF(__pyx_r);
  11611. __Pyx_RefNannyFinishContext();
  11612. return __pyx_r;
  11613. }
  11614. /* "(tree fragment)":3
  11615. * def __reduce_cython__(self):
  11616. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11617. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11618. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11619. */
  11620. /* Python wrapper */
  11621. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  11622. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  11623. PyObject *__pyx_r = 0;
  11624. __Pyx_RefNannyDeclarations
  11625. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  11626. __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  11627. /* function exit code */
  11628. __Pyx_RefNannyFinishContext();
  11629. return __pyx_r;
  11630. }
  11631. static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  11632. PyObject *__pyx_r = NULL;
  11633. __Pyx_RefNannyDeclarations
  11634. PyObject *__pyx_t_1 = NULL;
  11635. int __pyx_lineno = 0;
  11636. const char *__pyx_filename = NULL;
  11637. int __pyx_clineno = 0;
  11638. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  11639. /* "(tree fragment)":4
  11640. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11641. * def __setstate_cython__(self, __pyx_state):
  11642. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11643. */
  11644. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  11645. __Pyx_GOTREF(__pyx_t_1);
  11646. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11647. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11648. __PYX_ERR(2, 4, __pyx_L1_error)
  11649. /* "(tree fragment)":3
  11650. * def __reduce_cython__(self):
  11651. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11652. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11653. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11654. */
  11655. /* function exit code */
  11656. __pyx_L1_error:;
  11657. __Pyx_XDECREF(__pyx_t_1);
  11658. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11659. __pyx_r = NULL;
  11660. __Pyx_XGIVEREF(__pyx_r);
  11661. __Pyx_RefNannyFinishContext();
  11662. return __pyx_r;
  11663. }
  11664. /* "View.MemoryView":999
  11665. *
  11666. * @cname('__pyx_memoryview_fromslice')
  11667. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  11668. * int ndim,
  11669. * object (*to_object_func)(char *),
  11670. */
  11671. static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  11672. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  11673. Py_ssize_t __pyx_v_suboffset;
  11674. PyObject *__pyx_v_length = NULL;
  11675. PyObject *__pyx_r = NULL;
  11676. __Pyx_RefNannyDeclarations
  11677. int __pyx_t_1;
  11678. PyObject *__pyx_t_2 = NULL;
  11679. PyObject *__pyx_t_3 = NULL;
  11680. __Pyx_TypeInfo *__pyx_t_4;
  11681. Py_buffer __pyx_t_5;
  11682. Py_ssize_t *__pyx_t_6;
  11683. Py_ssize_t *__pyx_t_7;
  11684. Py_ssize_t *__pyx_t_8;
  11685. Py_ssize_t __pyx_t_9;
  11686. int __pyx_lineno = 0;
  11687. const char *__pyx_filename = NULL;
  11688. int __pyx_clineno = 0;
  11689. __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
  11690. /* "View.MemoryView":1007
  11691. * cdef _memoryviewslice result
  11692. *
  11693. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  11694. * return None
  11695. *
  11696. */
  11697. __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  11698. if (__pyx_t_1) {
  11699. /* "View.MemoryView":1008
  11700. *
  11701. * if <PyObject *> memviewslice.memview == Py_None:
  11702. * return None # <<<<<<<<<<<<<<
  11703. *
  11704. *
  11705. */
  11706. __Pyx_XDECREF(__pyx_r);
  11707. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  11708. goto __pyx_L0;
  11709. /* "View.MemoryView":1007
  11710. * cdef _memoryviewslice result
  11711. *
  11712. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  11713. * return None
  11714. *
  11715. */
  11716. }
  11717. /* "View.MemoryView":1013
  11718. *
  11719. *
  11720. * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
  11721. *
  11722. * result.from_slice = memviewslice
  11723. */
  11724. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
  11725. __Pyx_GOTREF(__pyx_t_2);
  11726. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
  11727. __Pyx_GOTREF(__pyx_t_3);
  11728. __Pyx_INCREF(Py_None);
  11729. __Pyx_GIVEREF(Py_None);
  11730. PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  11731. __Pyx_INCREF(__pyx_int_0);
  11732. __Pyx_GIVEREF(__pyx_int_0);
  11733. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  11734. __Pyx_GIVEREF(__pyx_t_2);
  11735. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  11736. __pyx_t_2 = 0;
  11737. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
  11738. __Pyx_GOTREF(__pyx_t_2);
  11739. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11740. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  11741. __pyx_t_2 = 0;
  11742. /* "View.MemoryView":1015
  11743. * result = _memoryviewslice(None, 0, dtype_is_object)
  11744. *
  11745. * result.from_slice = memviewslice # <<<<<<<<<<<<<<
  11746. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  11747. *
  11748. */
  11749. __pyx_v_result->from_slice = __pyx_v_memviewslice;
  11750. /* "View.MemoryView":1016
  11751. *
  11752. * result.from_slice = memviewslice
  11753. * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
  11754. *
  11755. * result.from_object = (<memoryview> memviewslice.memview).base
  11756. */
  11757. __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
  11758. /* "View.MemoryView":1018
  11759. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  11760. *
  11761. * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
  11762. * result.typeinfo = memviewslice.memview.typeinfo
  11763. *
  11764. */
  11765. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
  11766. __Pyx_GOTREF(__pyx_t_2);
  11767. __Pyx_GIVEREF(__pyx_t_2);
  11768. __Pyx_GOTREF(__pyx_v_result->from_object);
  11769. __Pyx_DECREF(__pyx_v_result->from_object);
  11770. __pyx_v_result->from_object = __pyx_t_2;
  11771. __pyx_t_2 = 0;
  11772. /* "View.MemoryView":1019
  11773. *
  11774. * result.from_object = (<memoryview> memviewslice.memview).base
  11775. * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
  11776. *
  11777. * result.view = memviewslice.memview.view
  11778. */
  11779. __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  11780. __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
  11781. /* "View.MemoryView":1021
  11782. * result.typeinfo = memviewslice.memview.typeinfo
  11783. *
  11784. * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
  11785. * result.view.buf = <void *> memviewslice.data
  11786. * result.view.ndim = ndim
  11787. */
  11788. __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  11789. __pyx_v_result->__pyx_base.view = __pyx_t_5;
  11790. /* "View.MemoryView":1022
  11791. *
  11792. * result.view = memviewslice.memview.view
  11793. * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
  11794. * result.view.ndim = ndim
  11795. * (<__pyx_buffer *> &result.view).obj = Py_None
  11796. */
  11797. __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
  11798. /* "View.MemoryView":1023
  11799. * result.view = memviewslice.memview.view
  11800. * result.view.buf = <void *> memviewslice.data
  11801. * result.view.ndim = ndim # <<<<<<<<<<<<<<
  11802. * (<__pyx_buffer *> &result.view).obj = Py_None
  11803. * Py_INCREF(Py_None)
  11804. */
  11805. __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
  11806. /* "View.MemoryView":1024
  11807. * result.view.buf = <void *> memviewslice.data
  11808. * result.view.ndim = ndim
  11809. * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
  11810. * Py_INCREF(Py_None)
  11811. *
  11812. */
  11813. ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
  11814. /* "View.MemoryView":1025
  11815. * result.view.ndim = ndim
  11816. * (<__pyx_buffer *> &result.view).obj = Py_None
  11817. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  11818. *
  11819. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  11820. */
  11821. Py_INCREF(Py_None);
  11822. /* "View.MemoryView":1027
  11823. * Py_INCREF(Py_None)
  11824. *
  11825. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  11826. * result.flags = PyBUF_RECORDS
  11827. * else:
  11828. */
  11829. __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  11830. if (__pyx_t_1) {
  11831. /* "View.MemoryView":1028
  11832. *
  11833. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  11834. * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
  11835. * else:
  11836. * result.flags = PyBUF_RECORDS_RO
  11837. */
  11838. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
  11839. /* "View.MemoryView":1027
  11840. * Py_INCREF(Py_None)
  11841. *
  11842. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  11843. * result.flags = PyBUF_RECORDS
  11844. * else:
  11845. */
  11846. goto __pyx_L4;
  11847. }
  11848. /* "View.MemoryView":1030
  11849. * result.flags = PyBUF_RECORDS
  11850. * else:
  11851. * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
  11852. *
  11853. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  11854. */
  11855. /*else*/ {
  11856. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  11857. }
  11858. __pyx_L4:;
  11859. /* "View.MemoryView":1032
  11860. * result.flags = PyBUF_RECORDS_RO
  11861. *
  11862. * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
  11863. * result.view.strides = <Py_ssize_t *> result.from_slice.strides
  11864. *
  11865. */
  11866. __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
  11867. /* "View.MemoryView":1033
  11868. *
  11869. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  11870. * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
  11871. *
  11872. *
  11873. */
  11874. __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
  11875. /* "View.MemoryView":1036
  11876. *
  11877. *
  11878. * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
  11879. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11880. * if suboffset >= 0:
  11881. */
  11882. __pyx_v_result->__pyx_base.view.suboffsets = NULL;
  11883. /* "View.MemoryView":1037
  11884. *
  11885. * result.view.suboffsets = NULL
  11886. * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
  11887. * if suboffset >= 0:
  11888. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11889. */
  11890. __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  11891. for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  11892. __pyx_t_6 = __pyx_t_8;
  11893. __pyx_v_suboffset = (__pyx_t_6[0]);
  11894. /* "View.MemoryView":1038
  11895. * result.view.suboffsets = NULL
  11896. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11897. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11898. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11899. * break
  11900. */
  11901. __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
  11902. if (__pyx_t_1) {
  11903. /* "View.MemoryView":1039
  11904. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11905. * if suboffset >= 0:
  11906. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
  11907. * break
  11908. *
  11909. */
  11910. __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
  11911. /* "View.MemoryView":1040
  11912. * if suboffset >= 0:
  11913. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11914. * break # <<<<<<<<<<<<<<
  11915. *
  11916. * result.view.len = result.view.itemsize
  11917. */
  11918. goto __pyx_L6_break;
  11919. /* "View.MemoryView":1038
  11920. * result.view.suboffsets = NULL
  11921. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11922. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11923. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11924. * break
  11925. */
  11926. }
  11927. }
  11928. __pyx_L6_break:;
  11929. /* "View.MemoryView":1042
  11930. * break
  11931. *
  11932. * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
  11933. * for length in result.view.shape[:ndim]:
  11934. * result.view.len *= length
  11935. */
  11936. __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  11937. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  11938. /* "View.MemoryView":1043
  11939. *
  11940. * result.view.len = result.view.itemsize
  11941. * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
  11942. * result.view.len *= length
  11943. *
  11944. */
  11945. __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  11946. for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  11947. __pyx_t_6 = __pyx_t_8;
  11948. __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
  11949. __Pyx_GOTREF(__pyx_t_2);
  11950. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
  11951. __pyx_t_2 = 0;
  11952. /* "View.MemoryView":1044
  11953. * result.view.len = result.view.itemsize
  11954. * for length in result.view.shape[:ndim]:
  11955. * result.view.len *= length # <<<<<<<<<<<<<<
  11956. *
  11957. * result.to_object_func = to_object_func
  11958. */
  11959. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
  11960. __Pyx_GOTREF(__pyx_t_2);
  11961. __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
  11962. __Pyx_GOTREF(__pyx_t_3);
  11963. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11964. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
  11965. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11966. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  11967. }
  11968. /* "View.MemoryView":1046
  11969. * result.view.len *= length
  11970. *
  11971. * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
  11972. * result.to_dtype_func = to_dtype_func
  11973. *
  11974. */
  11975. __pyx_v_result->to_object_func = __pyx_v_to_object_func;
  11976. /* "View.MemoryView":1047
  11977. *
  11978. * result.to_object_func = to_object_func
  11979. * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
  11980. *
  11981. * return result
  11982. */
  11983. __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
  11984. /* "View.MemoryView":1049
  11985. * result.to_dtype_func = to_dtype_func
  11986. *
  11987. * return result # <<<<<<<<<<<<<<
  11988. *
  11989. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  11990. */
  11991. __Pyx_XDECREF(__pyx_r);
  11992. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  11993. __pyx_r = ((PyObject *)__pyx_v_result);
  11994. goto __pyx_L0;
  11995. /* "View.MemoryView":999
  11996. *
  11997. * @cname('__pyx_memoryview_fromslice')
  11998. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  11999. * int ndim,
  12000. * object (*to_object_func)(char *),
  12001. */
  12002. /* function exit code */
  12003. __pyx_L1_error:;
  12004. __Pyx_XDECREF(__pyx_t_2);
  12005. __Pyx_XDECREF(__pyx_t_3);
  12006. __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12007. __pyx_r = 0;
  12008. __pyx_L0:;
  12009. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  12010. __Pyx_XDECREF(__pyx_v_length);
  12011. __Pyx_XGIVEREF(__pyx_r);
  12012. __Pyx_RefNannyFinishContext();
  12013. return __pyx_r;
  12014. }
  12015. /* "View.MemoryView":1052
  12016. *
  12017. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  12018. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  12019. * __Pyx_memviewslice *mslice) except NULL:
  12020. * cdef _memoryviewslice obj
  12021. */
  12022. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  12023. struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  12024. __Pyx_memviewslice *__pyx_r;
  12025. __Pyx_RefNannyDeclarations
  12026. int __pyx_t_1;
  12027. int __pyx_t_2;
  12028. PyObject *__pyx_t_3 = NULL;
  12029. int __pyx_lineno = 0;
  12030. const char *__pyx_filename = NULL;
  12031. int __pyx_clineno = 0;
  12032. __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
  12033. /* "View.MemoryView":1055
  12034. * __Pyx_memviewslice *mslice) except NULL:
  12035. * cdef _memoryviewslice obj
  12036. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12037. * obj = memview
  12038. * return &obj.from_slice
  12039. */
  12040. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  12041. __pyx_t_2 = (__pyx_t_1 != 0);
  12042. if (__pyx_t_2) {
  12043. /* "View.MemoryView":1056
  12044. * cdef _memoryviewslice obj
  12045. * if isinstance(memview, _memoryviewslice):
  12046. * obj = memview # <<<<<<<<<<<<<<
  12047. * return &obj.from_slice
  12048. * else:
  12049. */
  12050. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
  12051. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  12052. __Pyx_INCREF(__pyx_t_3);
  12053. __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  12054. __pyx_t_3 = 0;
  12055. /* "View.MemoryView":1057
  12056. * if isinstance(memview, _memoryviewslice):
  12057. * obj = memview
  12058. * return &obj.from_slice # <<<<<<<<<<<<<<
  12059. * else:
  12060. * slice_copy(memview, mslice)
  12061. */
  12062. __pyx_r = (&__pyx_v_obj->from_slice);
  12063. goto __pyx_L0;
  12064. /* "View.MemoryView":1055
  12065. * __Pyx_memviewslice *mslice) except NULL:
  12066. * cdef _memoryviewslice obj
  12067. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12068. * obj = memview
  12069. * return &obj.from_slice
  12070. */
  12071. }
  12072. /* "View.MemoryView":1059
  12073. * return &obj.from_slice
  12074. * else:
  12075. * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
  12076. * return mslice
  12077. *
  12078. */
  12079. /*else*/ {
  12080. __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
  12081. /* "View.MemoryView":1060
  12082. * else:
  12083. * slice_copy(memview, mslice)
  12084. * return mslice # <<<<<<<<<<<<<<
  12085. *
  12086. * @cname('__pyx_memoryview_slice_copy')
  12087. */
  12088. __pyx_r = __pyx_v_mslice;
  12089. goto __pyx_L0;
  12090. }
  12091. /* "View.MemoryView":1052
  12092. *
  12093. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  12094. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  12095. * __Pyx_memviewslice *mslice) except NULL:
  12096. * cdef _memoryviewslice obj
  12097. */
  12098. /* function exit code */
  12099. __pyx_L1_error:;
  12100. __Pyx_XDECREF(__pyx_t_3);
  12101. __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12102. __pyx_r = NULL;
  12103. __pyx_L0:;
  12104. __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  12105. __Pyx_RefNannyFinishContext();
  12106. return __pyx_r;
  12107. }
  12108. /* "View.MemoryView":1063
  12109. *
  12110. * @cname('__pyx_memoryview_slice_copy')
  12111. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  12112. * cdef int dim
  12113. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12114. */
  12115. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  12116. int __pyx_v_dim;
  12117. Py_ssize_t *__pyx_v_shape;
  12118. Py_ssize_t *__pyx_v_strides;
  12119. Py_ssize_t *__pyx_v_suboffsets;
  12120. __Pyx_RefNannyDeclarations
  12121. Py_ssize_t *__pyx_t_1;
  12122. int __pyx_t_2;
  12123. int __pyx_t_3;
  12124. int __pyx_t_4;
  12125. Py_ssize_t __pyx_t_5;
  12126. __Pyx_RefNannySetupContext("slice_copy", 0);
  12127. /* "View.MemoryView":1067
  12128. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12129. *
  12130. * shape = memview.view.shape # <<<<<<<<<<<<<<
  12131. * strides = memview.view.strides
  12132. * suboffsets = memview.view.suboffsets
  12133. */
  12134. __pyx_t_1 = __pyx_v_memview->view.shape;
  12135. __pyx_v_shape = __pyx_t_1;
  12136. /* "View.MemoryView":1068
  12137. *
  12138. * shape = memview.view.shape
  12139. * strides = memview.view.strides # <<<<<<<<<<<<<<
  12140. * suboffsets = memview.view.suboffsets
  12141. *
  12142. */
  12143. __pyx_t_1 = __pyx_v_memview->view.strides;
  12144. __pyx_v_strides = __pyx_t_1;
  12145. /* "View.MemoryView":1069
  12146. * shape = memview.view.shape
  12147. * strides = memview.view.strides
  12148. * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
  12149. *
  12150. * dst.memview = <__pyx_memoryview *> memview
  12151. */
  12152. __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  12153. __pyx_v_suboffsets = __pyx_t_1;
  12154. /* "View.MemoryView":1071
  12155. * suboffsets = memview.view.suboffsets
  12156. *
  12157. * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
  12158. * dst.data = <char *> memview.view.buf
  12159. *
  12160. */
  12161. __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
  12162. /* "View.MemoryView":1072
  12163. *
  12164. * dst.memview = <__pyx_memoryview *> memview
  12165. * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
  12166. *
  12167. * for dim in range(memview.view.ndim):
  12168. */
  12169. __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
  12170. /* "View.MemoryView":1074
  12171. * dst.data = <char *> memview.view.buf
  12172. *
  12173. * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
  12174. * dst.shape[dim] = shape[dim]
  12175. * dst.strides[dim] = strides[dim]
  12176. */
  12177. __pyx_t_2 = __pyx_v_memview->view.ndim;
  12178. __pyx_t_3 = __pyx_t_2;
  12179. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  12180. __pyx_v_dim = __pyx_t_4;
  12181. /* "View.MemoryView":1075
  12182. *
  12183. * for dim in range(memview.view.ndim):
  12184. * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
  12185. * dst.strides[dim] = strides[dim]
  12186. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  12187. */
  12188. (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
  12189. /* "View.MemoryView":1076
  12190. * for dim in range(memview.view.ndim):
  12191. * dst.shape[dim] = shape[dim]
  12192. * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
  12193. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  12194. *
  12195. */
  12196. (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
  12197. /* "View.MemoryView":1077
  12198. * dst.shape[dim] = shape[dim]
  12199. * dst.strides[dim] = strides[dim]
  12200. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
  12201. *
  12202. * @cname('__pyx_memoryview_copy_object')
  12203. */
  12204. if ((__pyx_v_suboffsets != 0)) {
  12205. __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
  12206. } else {
  12207. __pyx_t_5 = -1L;
  12208. }
  12209. (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  12210. }
  12211. /* "View.MemoryView":1063
  12212. *
  12213. * @cname('__pyx_memoryview_slice_copy')
  12214. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  12215. * cdef int dim
  12216. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12217. */
  12218. /* function exit code */
  12219. __Pyx_RefNannyFinishContext();
  12220. }
  12221. /* "View.MemoryView":1080
  12222. *
  12223. * @cname('__pyx_memoryview_copy_object')
  12224. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  12225. * "Create a new memoryview object"
  12226. * cdef __Pyx_memviewslice memviewslice
  12227. */
  12228. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  12229. __Pyx_memviewslice __pyx_v_memviewslice;
  12230. PyObject *__pyx_r = NULL;
  12231. __Pyx_RefNannyDeclarations
  12232. PyObject *__pyx_t_1 = NULL;
  12233. int __pyx_lineno = 0;
  12234. const char *__pyx_filename = NULL;
  12235. int __pyx_clineno = 0;
  12236. __Pyx_RefNannySetupContext("memoryview_copy", 0);
  12237. /* "View.MemoryView":1083
  12238. * "Create a new memoryview object"
  12239. * cdef __Pyx_memviewslice memviewslice
  12240. * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
  12241. * return memoryview_copy_from_slice(memview, &memviewslice)
  12242. *
  12243. */
  12244. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
  12245. /* "View.MemoryView":1084
  12246. * cdef __Pyx_memviewslice memviewslice
  12247. * slice_copy(memview, &memviewslice)
  12248. * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
  12249. *
  12250. * @cname('__pyx_memoryview_copy_object_from_slice')
  12251. */
  12252. __Pyx_XDECREF(__pyx_r);
  12253. __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
  12254. __Pyx_GOTREF(__pyx_t_1);
  12255. __pyx_r = __pyx_t_1;
  12256. __pyx_t_1 = 0;
  12257. goto __pyx_L0;
  12258. /* "View.MemoryView":1080
  12259. *
  12260. * @cname('__pyx_memoryview_copy_object')
  12261. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  12262. * "Create a new memoryview object"
  12263. * cdef __Pyx_memviewslice memviewslice
  12264. */
  12265. /* function exit code */
  12266. __pyx_L1_error:;
  12267. __Pyx_XDECREF(__pyx_t_1);
  12268. __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12269. __pyx_r = 0;
  12270. __pyx_L0:;
  12271. __Pyx_XGIVEREF(__pyx_r);
  12272. __Pyx_RefNannyFinishContext();
  12273. return __pyx_r;
  12274. }
  12275. /* "View.MemoryView":1087
  12276. *
  12277. * @cname('__pyx_memoryview_copy_object_from_slice')
  12278. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  12279. * """
  12280. * Create a new memoryview object from a given memoryview object and slice.
  12281. */
  12282. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  12283. PyObject *(*__pyx_v_to_object_func)(char *);
  12284. int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  12285. PyObject *__pyx_r = NULL;
  12286. __Pyx_RefNannyDeclarations
  12287. int __pyx_t_1;
  12288. int __pyx_t_2;
  12289. PyObject *(*__pyx_t_3)(char *);
  12290. int (*__pyx_t_4)(char *, PyObject *);
  12291. PyObject *__pyx_t_5 = NULL;
  12292. int __pyx_lineno = 0;
  12293. const char *__pyx_filename = NULL;
  12294. int __pyx_clineno = 0;
  12295. __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
  12296. /* "View.MemoryView":1094
  12297. * cdef int (*to_dtype_func)(char *, object) except 0
  12298. *
  12299. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12300. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12301. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12302. */
  12303. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  12304. __pyx_t_2 = (__pyx_t_1 != 0);
  12305. if (__pyx_t_2) {
  12306. /* "View.MemoryView":1095
  12307. *
  12308. * if isinstance(memview, _memoryviewslice):
  12309. * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
  12310. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12311. * else:
  12312. */
  12313. __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
  12314. __pyx_v_to_object_func = __pyx_t_3;
  12315. /* "View.MemoryView":1096
  12316. * if isinstance(memview, _memoryviewslice):
  12317. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12318. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
  12319. * else:
  12320. * to_object_func = NULL
  12321. */
  12322. __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
  12323. __pyx_v_to_dtype_func = __pyx_t_4;
  12324. /* "View.MemoryView":1094
  12325. * cdef int (*to_dtype_func)(char *, object) except 0
  12326. *
  12327. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12328. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12329. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12330. */
  12331. goto __pyx_L3;
  12332. }
  12333. /* "View.MemoryView":1098
  12334. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12335. * else:
  12336. * to_object_func = NULL # <<<<<<<<<<<<<<
  12337. * to_dtype_func = NULL
  12338. *
  12339. */
  12340. /*else*/ {
  12341. __pyx_v_to_object_func = NULL;
  12342. /* "View.MemoryView":1099
  12343. * else:
  12344. * to_object_func = NULL
  12345. * to_dtype_func = NULL # <<<<<<<<<<<<<<
  12346. *
  12347. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  12348. */
  12349. __pyx_v_to_dtype_func = NULL;
  12350. }
  12351. __pyx_L3:;
  12352. /* "View.MemoryView":1101
  12353. * to_dtype_func = NULL
  12354. *
  12355. * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
  12356. * to_object_func, to_dtype_func,
  12357. * memview.dtype_is_object)
  12358. */
  12359. __Pyx_XDECREF(__pyx_r);
  12360. /* "View.MemoryView":1103
  12361. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  12362. * to_object_func, to_dtype_func,
  12363. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  12364. *
  12365. *
  12366. */
  12367. __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
  12368. __Pyx_GOTREF(__pyx_t_5);
  12369. __pyx_r = __pyx_t_5;
  12370. __pyx_t_5 = 0;
  12371. goto __pyx_L0;
  12372. /* "View.MemoryView":1087
  12373. *
  12374. * @cname('__pyx_memoryview_copy_object_from_slice')
  12375. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  12376. * """
  12377. * Create a new memoryview object from a given memoryview object and slice.
  12378. */
  12379. /* function exit code */
  12380. __pyx_L1_error:;
  12381. __Pyx_XDECREF(__pyx_t_5);
  12382. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12383. __pyx_r = 0;
  12384. __pyx_L0:;
  12385. __Pyx_XGIVEREF(__pyx_r);
  12386. __Pyx_RefNannyFinishContext();
  12387. return __pyx_r;
  12388. }
  12389. /* "View.MemoryView":1109
  12390. *
  12391. *
  12392. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  12393. * if arg < 0:
  12394. * return -arg
  12395. */
  12396. static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  12397. Py_ssize_t __pyx_r;
  12398. int __pyx_t_1;
  12399. /* "View.MemoryView":1110
  12400. *
  12401. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12402. * if arg < 0: # <<<<<<<<<<<<<<
  12403. * return -arg
  12404. * else:
  12405. */
  12406. __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  12407. if (__pyx_t_1) {
  12408. /* "View.MemoryView":1111
  12409. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12410. * if arg < 0:
  12411. * return -arg # <<<<<<<<<<<<<<
  12412. * else:
  12413. * return arg
  12414. */
  12415. __pyx_r = (-__pyx_v_arg);
  12416. goto __pyx_L0;
  12417. /* "View.MemoryView":1110
  12418. *
  12419. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12420. * if arg < 0: # <<<<<<<<<<<<<<
  12421. * return -arg
  12422. * else:
  12423. */
  12424. }
  12425. /* "View.MemoryView":1113
  12426. * return -arg
  12427. * else:
  12428. * return arg # <<<<<<<<<<<<<<
  12429. *
  12430. * @cname('__pyx_get_best_slice_order')
  12431. */
  12432. /*else*/ {
  12433. __pyx_r = __pyx_v_arg;
  12434. goto __pyx_L0;
  12435. }
  12436. /* "View.MemoryView":1109
  12437. *
  12438. *
  12439. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  12440. * if arg < 0:
  12441. * return -arg
  12442. */
  12443. /* function exit code */
  12444. __pyx_L0:;
  12445. return __pyx_r;
  12446. }
  12447. /* "View.MemoryView":1116
  12448. *
  12449. * @cname('__pyx_get_best_slice_order')
  12450. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  12451. * """
  12452. * Figure out the best memory access order for a given slice.
  12453. */
  12454. static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  12455. int __pyx_v_i;
  12456. Py_ssize_t __pyx_v_c_stride;
  12457. Py_ssize_t __pyx_v_f_stride;
  12458. char __pyx_r;
  12459. int __pyx_t_1;
  12460. int __pyx_t_2;
  12461. int __pyx_t_3;
  12462. int __pyx_t_4;
  12463. /* "View.MemoryView":1121
  12464. * """
  12465. * cdef int i
  12466. * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
  12467. * cdef Py_ssize_t f_stride = 0
  12468. *
  12469. */
  12470. __pyx_v_c_stride = 0;
  12471. /* "View.MemoryView":1122
  12472. * cdef int i
  12473. * cdef Py_ssize_t c_stride = 0
  12474. * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
  12475. *
  12476. * for i in range(ndim - 1, -1, -1):
  12477. */
  12478. __pyx_v_f_stride = 0;
  12479. /* "View.MemoryView":1124
  12480. * cdef Py_ssize_t f_stride = 0
  12481. *
  12482. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  12483. * if mslice.shape[i] > 1:
  12484. * c_stride = mslice.strides[i]
  12485. */
  12486. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  12487. __pyx_v_i = __pyx_t_1;
  12488. /* "View.MemoryView":1125
  12489. *
  12490. * for i in range(ndim - 1, -1, -1):
  12491. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12492. * c_stride = mslice.strides[i]
  12493. * break
  12494. */
  12495. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  12496. if (__pyx_t_2) {
  12497. /* "View.MemoryView":1126
  12498. * for i in range(ndim - 1, -1, -1):
  12499. * if mslice.shape[i] > 1:
  12500. * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  12501. * break
  12502. *
  12503. */
  12504. __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  12505. /* "View.MemoryView":1127
  12506. * if mslice.shape[i] > 1:
  12507. * c_stride = mslice.strides[i]
  12508. * break # <<<<<<<<<<<<<<
  12509. *
  12510. * for i in range(ndim):
  12511. */
  12512. goto __pyx_L4_break;
  12513. /* "View.MemoryView":1125
  12514. *
  12515. * for i in range(ndim - 1, -1, -1):
  12516. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12517. * c_stride = mslice.strides[i]
  12518. * break
  12519. */
  12520. }
  12521. }
  12522. __pyx_L4_break:;
  12523. /* "View.MemoryView":1129
  12524. * break
  12525. *
  12526. * for i in range(ndim): # <<<<<<<<<<<<<<
  12527. * if mslice.shape[i] > 1:
  12528. * f_stride = mslice.strides[i]
  12529. */
  12530. __pyx_t_1 = __pyx_v_ndim;
  12531. __pyx_t_3 = __pyx_t_1;
  12532. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  12533. __pyx_v_i = __pyx_t_4;
  12534. /* "View.MemoryView":1130
  12535. *
  12536. * for i in range(ndim):
  12537. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12538. * f_stride = mslice.strides[i]
  12539. * break
  12540. */
  12541. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  12542. if (__pyx_t_2) {
  12543. /* "View.MemoryView":1131
  12544. * for i in range(ndim):
  12545. * if mslice.shape[i] > 1:
  12546. * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  12547. * break
  12548. *
  12549. */
  12550. __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  12551. /* "View.MemoryView":1132
  12552. * if mslice.shape[i] > 1:
  12553. * f_stride = mslice.strides[i]
  12554. * break # <<<<<<<<<<<<<<
  12555. *
  12556. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  12557. */
  12558. goto __pyx_L7_break;
  12559. /* "View.MemoryView":1130
  12560. *
  12561. * for i in range(ndim):
  12562. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12563. * f_stride = mslice.strides[i]
  12564. * break
  12565. */
  12566. }
  12567. }
  12568. __pyx_L7_break:;
  12569. /* "View.MemoryView":1134
  12570. * break
  12571. *
  12572. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  12573. * return 'C'
  12574. * else:
  12575. */
  12576. __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  12577. if (__pyx_t_2) {
  12578. /* "View.MemoryView":1135
  12579. *
  12580. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  12581. * return 'C' # <<<<<<<<<<<<<<
  12582. * else:
  12583. * return 'F'
  12584. */
  12585. __pyx_r = 'C';
  12586. goto __pyx_L0;
  12587. /* "View.MemoryView":1134
  12588. * break
  12589. *
  12590. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  12591. * return 'C'
  12592. * else:
  12593. */
  12594. }
  12595. /* "View.MemoryView":1137
  12596. * return 'C'
  12597. * else:
  12598. * return 'F' # <<<<<<<<<<<<<<
  12599. *
  12600. * @cython.cdivision(True)
  12601. */
  12602. /*else*/ {
  12603. __pyx_r = 'F';
  12604. goto __pyx_L0;
  12605. }
  12606. /* "View.MemoryView":1116
  12607. *
  12608. * @cname('__pyx_get_best_slice_order')
  12609. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  12610. * """
  12611. * Figure out the best memory access order for a given slice.
  12612. */
  12613. /* function exit code */
  12614. __pyx_L0:;
  12615. return __pyx_r;
  12616. }
  12617. /* "View.MemoryView":1140
  12618. *
  12619. * @cython.cdivision(True)
  12620. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  12621. * char *dst_data, Py_ssize_t *dst_strides,
  12622. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  12623. */
  12624. static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  12625. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  12626. CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  12627. Py_ssize_t __pyx_v_dst_extent;
  12628. Py_ssize_t __pyx_v_src_stride;
  12629. Py_ssize_t __pyx_v_dst_stride;
  12630. int __pyx_t_1;
  12631. int __pyx_t_2;
  12632. int __pyx_t_3;
  12633. Py_ssize_t __pyx_t_4;
  12634. Py_ssize_t __pyx_t_5;
  12635. Py_ssize_t __pyx_t_6;
  12636. /* "View.MemoryView":1147
  12637. *
  12638. * cdef Py_ssize_t i
  12639. * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
  12640. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12641. * cdef Py_ssize_t src_stride = src_strides[0]
  12642. */
  12643. __pyx_v_src_extent = (__pyx_v_src_shape[0]);
  12644. /* "View.MemoryView":1148
  12645. * cdef Py_ssize_t i
  12646. * cdef Py_ssize_t src_extent = src_shape[0]
  12647. * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
  12648. * cdef Py_ssize_t src_stride = src_strides[0]
  12649. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12650. */
  12651. __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
  12652. /* "View.MemoryView":1149
  12653. * cdef Py_ssize_t src_extent = src_shape[0]
  12654. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12655. * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
  12656. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12657. *
  12658. */
  12659. __pyx_v_src_stride = (__pyx_v_src_strides[0]);
  12660. /* "View.MemoryView":1150
  12661. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12662. * cdef Py_ssize_t src_stride = src_strides[0]
  12663. * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
  12664. *
  12665. * if ndim == 1:
  12666. */
  12667. __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
  12668. /* "View.MemoryView":1152
  12669. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12670. *
  12671. * if ndim == 1: # <<<<<<<<<<<<<<
  12672. * if (src_stride > 0 and dst_stride > 0 and
  12673. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12674. */
  12675. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  12676. if (__pyx_t_1) {
  12677. /* "View.MemoryView":1153
  12678. *
  12679. * if ndim == 1:
  12680. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12681. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12682. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12683. */
  12684. __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
  12685. if (__pyx_t_2) {
  12686. } else {
  12687. __pyx_t_1 = __pyx_t_2;
  12688. goto __pyx_L5_bool_binop_done;
  12689. }
  12690. __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
  12691. if (__pyx_t_2) {
  12692. } else {
  12693. __pyx_t_1 = __pyx_t_2;
  12694. goto __pyx_L5_bool_binop_done;
  12695. }
  12696. /* "View.MemoryView":1154
  12697. * if ndim == 1:
  12698. * if (src_stride > 0 and dst_stride > 0 and
  12699. * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
  12700. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12701. * else:
  12702. */
  12703. __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
  12704. if (__pyx_t_2) {
  12705. __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
  12706. }
  12707. __pyx_t_3 = (__pyx_t_2 != 0);
  12708. __pyx_t_1 = __pyx_t_3;
  12709. __pyx_L5_bool_binop_done:;
  12710. /* "View.MemoryView":1153
  12711. *
  12712. * if ndim == 1:
  12713. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12714. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12715. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12716. */
  12717. if (__pyx_t_1) {
  12718. /* "View.MemoryView":1155
  12719. * if (src_stride > 0 and dst_stride > 0 and
  12720. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12721. * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
  12722. * else:
  12723. * for i in range(dst_extent):
  12724. */
  12725. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
  12726. /* "View.MemoryView":1153
  12727. *
  12728. * if ndim == 1:
  12729. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12730. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12731. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12732. */
  12733. goto __pyx_L4;
  12734. }
  12735. /* "View.MemoryView":1157
  12736. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12737. * else:
  12738. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  12739. * memcpy(dst_data, src_data, itemsize)
  12740. * src_data += src_stride
  12741. */
  12742. /*else*/ {
  12743. __pyx_t_4 = __pyx_v_dst_extent;
  12744. __pyx_t_5 = __pyx_t_4;
  12745. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  12746. __pyx_v_i = __pyx_t_6;
  12747. /* "View.MemoryView":1158
  12748. * else:
  12749. * for i in range(dst_extent):
  12750. * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
  12751. * src_data += src_stride
  12752. * dst_data += dst_stride
  12753. */
  12754. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
  12755. /* "View.MemoryView":1159
  12756. * for i in range(dst_extent):
  12757. * memcpy(dst_data, src_data, itemsize)
  12758. * src_data += src_stride # <<<<<<<<<<<<<<
  12759. * dst_data += dst_stride
  12760. * else:
  12761. */
  12762. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  12763. /* "View.MemoryView":1160
  12764. * memcpy(dst_data, src_data, itemsize)
  12765. * src_data += src_stride
  12766. * dst_data += dst_stride # <<<<<<<<<<<<<<
  12767. * else:
  12768. * for i in range(dst_extent):
  12769. */
  12770. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  12771. }
  12772. }
  12773. __pyx_L4:;
  12774. /* "View.MemoryView":1152
  12775. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12776. *
  12777. * if ndim == 1: # <<<<<<<<<<<<<<
  12778. * if (src_stride > 0 and dst_stride > 0 and
  12779. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12780. */
  12781. goto __pyx_L3;
  12782. }
  12783. /* "View.MemoryView":1162
  12784. * dst_data += dst_stride
  12785. * else:
  12786. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  12787. * _copy_strided_to_strided(src_data, src_strides + 1,
  12788. * dst_data, dst_strides + 1,
  12789. */
  12790. /*else*/ {
  12791. __pyx_t_4 = __pyx_v_dst_extent;
  12792. __pyx_t_5 = __pyx_t_4;
  12793. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  12794. __pyx_v_i = __pyx_t_6;
  12795. /* "View.MemoryView":1163
  12796. * else:
  12797. * for i in range(dst_extent):
  12798. * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
  12799. * dst_data, dst_strides + 1,
  12800. * src_shape + 1, dst_shape + 1,
  12801. */
  12802. _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
  12803. /* "View.MemoryView":1167
  12804. * src_shape + 1, dst_shape + 1,
  12805. * ndim - 1, itemsize)
  12806. * src_data += src_stride # <<<<<<<<<<<<<<
  12807. * dst_data += dst_stride
  12808. *
  12809. */
  12810. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  12811. /* "View.MemoryView":1168
  12812. * ndim - 1, itemsize)
  12813. * src_data += src_stride
  12814. * dst_data += dst_stride # <<<<<<<<<<<<<<
  12815. *
  12816. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
  12817. */
  12818. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  12819. }
  12820. }
  12821. __pyx_L3:;
  12822. /* "View.MemoryView":1140
  12823. *
  12824. * @cython.cdivision(True)
  12825. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  12826. * char *dst_data, Py_ssize_t *dst_strides,
  12827. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  12828. */
  12829. /* function exit code */
  12830. }
  12831. /* "View.MemoryView":1170
  12832. * dst_data += dst_stride
  12833. *
  12834. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  12835. * __Pyx_memviewslice *dst,
  12836. * int ndim, size_t itemsize) nogil:
  12837. */
  12838. static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  12839. /* "View.MemoryView":1173
  12840. * __Pyx_memviewslice *dst,
  12841. * int ndim, size_t itemsize) nogil:
  12842. * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
  12843. * src.shape, dst.shape, ndim, itemsize)
  12844. *
  12845. */
  12846. _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
  12847. /* "View.MemoryView":1170
  12848. * dst_data += dst_stride
  12849. *
  12850. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  12851. * __Pyx_memviewslice *dst,
  12852. * int ndim, size_t itemsize) nogil:
  12853. */
  12854. /* function exit code */
  12855. }
  12856. /* "View.MemoryView":1177
  12857. *
  12858. * @cname('__pyx_memoryview_slice_get_size')
  12859. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  12860. * "Return the size of the memory occupied by the slice in number of bytes"
  12861. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  12862. */
  12863. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  12864. Py_ssize_t __pyx_v_shape;
  12865. Py_ssize_t __pyx_v_size;
  12866. Py_ssize_t __pyx_r;
  12867. Py_ssize_t __pyx_t_1;
  12868. Py_ssize_t *__pyx_t_2;
  12869. Py_ssize_t *__pyx_t_3;
  12870. Py_ssize_t *__pyx_t_4;
  12871. /* "View.MemoryView":1179
  12872. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
  12873. * "Return the size of the memory occupied by the slice in number of bytes"
  12874. * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
  12875. *
  12876. * for shape in src.shape[:ndim]:
  12877. */
  12878. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  12879. __pyx_v_size = __pyx_t_1;
  12880. /* "View.MemoryView":1181
  12881. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  12882. *
  12883. * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
  12884. * size *= shape
  12885. *
  12886. */
  12887. __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  12888. for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  12889. __pyx_t_2 = __pyx_t_4;
  12890. __pyx_v_shape = (__pyx_t_2[0]);
  12891. /* "View.MemoryView":1182
  12892. *
  12893. * for shape in src.shape[:ndim]:
  12894. * size *= shape # <<<<<<<<<<<<<<
  12895. *
  12896. * return size
  12897. */
  12898. __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  12899. }
  12900. /* "View.MemoryView":1184
  12901. * size *= shape
  12902. *
  12903. * return size # <<<<<<<<<<<<<<
  12904. *
  12905. * @cname('__pyx_fill_contig_strides_array')
  12906. */
  12907. __pyx_r = __pyx_v_size;
  12908. goto __pyx_L0;
  12909. /* "View.MemoryView":1177
  12910. *
  12911. * @cname('__pyx_memoryview_slice_get_size')
  12912. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  12913. * "Return the size of the memory occupied by the slice in number of bytes"
  12914. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  12915. */
  12916. /* function exit code */
  12917. __pyx_L0:;
  12918. return __pyx_r;
  12919. }
  12920. /* "View.MemoryView":1187
  12921. *
  12922. * @cname('__pyx_fill_contig_strides_array')
  12923. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  12924. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  12925. * int ndim, char order) nogil:
  12926. */
  12927. static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  12928. int __pyx_v_idx;
  12929. Py_ssize_t __pyx_r;
  12930. int __pyx_t_1;
  12931. int __pyx_t_2;
  12932. int __pyx_t_3;
  12933. int __pyx_t_4;
  12934. /* "View.MemoryView":1196
  12935. * cdef int idx
  12936. *
  12937. * if order == 'F': # <<<<<<<<<<<<<<
  12938. * for idx in range(ndim):
  12939. * strides[idx] = stride
  12940. */
  12941. __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  12942. if (__pyx_t_1) {
  12943. /* "View.MemoryView":1197
  12944. *
  12945. * if order == 'F':
  12946. * for idx in range(ndim): # <<<<<<<<<<<<<<
  12947. * strides[idx] = stride
  12948. * stride *= shape[idx]
  12949. */
  12950. __pyx_t_2 = __pyx_v_ndim;
  12951. __pyx_t_3 = __pyx_t_2;
  12952. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  12953. __pyx_v_idx = __pyx_t_4;
  12954. /* "View.MemoryView":1198
  12955. * if order == 'F':
  12956. * for idx in range(ndim):
  12957. * strides[idx] = stride # <<<<<<<<<<<<<<
  12958. * stride *= shape[idx]
  12959. * else:
  12960. */
  12961. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  12962. /* "View.MemoryView":1199
  12963. * for idx in range(ndim):
  12964. * strides[idx] = stride
  12965. * stride *= shape[idx] # <<<<<<<<<<<<<<
  12966. * else:
  12967. * for idx in range(ndim - 1, -1, -1):
  12968. */
  12969. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  12970. }
  12971. /* "View.MemoryView":1196
  12972. * cdef int idx
  12973. *
  12974. * if order == 'F': # <<<<<<<<<<<<<<
  12975. * for idx in range(ndim):
  12976. * strides[idx] = stride
  12977. */
  12978. goto __pyx_L3;
  12979. }
  12980. /* "View.MemoryView":1201
  12981. * stride *= shape[idx]
  12982. * else:
  12983. * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  12984. * strides[idx] = stride
  12985. * stride *= shape[idx]
  12986. */
  12987. /*else*/ {
  12988. for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
  12989. __pyx_v_idx = __pyx_t_2;
  12990. /* "View.MemoryView":1202
  12991. * else:
  12992. * for idx in range(ndim - 1, -1, -1):
  12993. * strides[idx] = stride # <<<<<<<<<<<<<<
  12994. * stride *= shape[idx]
  12995. *
  12996. */
  12997. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  12998. /* "View.MemoryView":1203
  12999. * for idx in range(ndim - 1, -1, -1):
  13000. * strides[idx] = stride
  13001. * stride *= shape[idx] # <<<<<<<<<<<<<<
  13002. *
  13003. * return stride
  13004. */
  13005. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  13006. }
  13007. }
  13008. __pyx_L3:;
  13009. /* "View.MemoryView":1205
  13010. * stride *= shape[idx]
  13011. *
  13012. * return stride # <<<<<<<<<<<<<<
  13013. *
  13014. * @cname('__pyx_memoryview_copy_data_to_temp')
  13015. */
  13016. __pyx_r = __pyx_v_stride;
  13017. goto __pyx_L0;
  13018. /* "View.MemoryView":1187
  13019. *
  13020. * @cname('__pyx_fill_contig_strides_array')
  13021. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  13022. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  13023. * int ndim, char order) nogil:
  13024. */
  13025. /* function exit code */
  13026. __pyx_L0:;
  13027. return __pyx_r;
  13028. }
  13029. /* "View.MemoryView":1208
  13030. *
  13031. * @cname('__pyx_memoryview_copy_data_to_temp')
  13032. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  13033. * __Pyx_memviewslice *tmpslice,
  13034. * char order,
  13035. */
  13036. static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  13037. int __pyx_v_i;
  13038. void *__pyx_v_result;
  13039. size_t __pyx_v_itemsize;
  13040. size_t __pyx_v_size;
  13041. void *__pyx_r;
  13042. Py_ssize_t __pyx_t_1;
  13043. int __pyx_t_2;
  13044. int __pyx_t_3;
  13045. struct __pyx_memoryview_obj *__pyx_t_4;
  13046. int __pyx_t_5;
  13047. int __pyx_t_6;
  13048. int __pyx_lineno = 0;
  13049. const char *__pyx_filename = NULL;
  13050. int __pyx_clineno = 0;
  13051. /* "View.MemoryView":1219
  13052. * cdef void *result
  13053. *
  13054. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  13055. * cdef size_t size = slice_get_size(src, ndim)
  13056. *
  13057. */
  13058. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  13059. __pyx_v_itemsize = __pyx_t_1;
  13060. /* "View.MemoryView":1220
  13061. *
  13062. * cdef size_t itemsize = src.memview.view.itemsize
  13063. * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
  13064. *
  13065. * result = malloc(size)
  13066. */
  13067. __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
  13068. /* "View.MemoryView":1222
  13069. * cdef size_t size = slice_get_size(src, ndim)
  13070. *
  13071. * result = malloc(size) # <<<<<<<<<<<<<<
  13072. * if not result:
  13073. * _err(MemoryError, NULL)
  13074. */
  13075. __pyx_v_result = malloc(__pyx_v_size);
  13076. /* "View.MemoryView":1223
  13077. *
  13078. * result = malloc(size)
  13079. * if not result: # <<<<<<<<<<<<<<
  13080. * _err(MemoryError, NULL)
  13081. *
  13082. */
  13083. __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  13084. if (__pyx_t_2) {
  13085. /* "View.MemoryView":1224
  13086. * result = malloc(size)
  13087. * if not result:
  13088. * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
  13089. *
  13090. *
  13091. */
  13092. __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
  13093. /* "View.MemoryView":1223
  13094. *
  13095. * result = malloc(size)
  13096. * if not result: # <<<<<<<<<<<<<<
  13097. * _err(MemoryError, NULL)
  13098. *
  13099. */
  13100. }
  13101. /* "View.MemoryView":1227
  13102. *
  13103. *
  13104. * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
  13105. * tmpslice.memview = src.memview
  13106. * for i in range(ndim):
  13107. */
  13108. __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
  13109. /* "View.MemoryView":1228
  13110. *
  13111. * tmpslice.data = <char *> result
  13112. * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
  13113. * for i in range(ndim):
  13114. * tmpslice.shape[i] = src.shape[i]
  13115. */
  13116. __pyx_t_4 = __pyx_v_src->memview;
  13117. __pyx_v_tmpslice->memview = __pyx_t_4;
  13118. /* "View.MemoryView":1229
  13119. * tmpslice.data = <char *> result
  13120. * tmpslice.memview = src.memview
  13121. * for i in range(ndim): # <<<<<<<<<<<<<<
  13122. * tmpslice.shape[i] = src.shape[i]
  13123. * tmpslice.suboffsets[i] = -1
  13124. */
  13125. __pyx_t_3 = __pyx_v_ndim;
  13126. __pyx_t_5 = __pyx_t_3;
  13127. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  13128. __pyx_v_i = __pyx_t_6;
  13129. /* "View.MemoryView":1230
  13130. * tmpslice.memview = src.memview
  13131. * for i in range(ndim):
  13132. * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
  13133. * tmpslice.suboffsets[i] = -1
  13134. *
  13135. */
  13136. (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
  13137. /* "View.MemoryView":1231
  13138. * for i in range(ndim):
  13139. * tmpslice.shape[i] = src.shape[i]
  13140. * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  13141. *
  13142. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
  13143. */
  13144. (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  13145. }
  13146. /* "View.MemoryView":1233
  13147. * tmpslice.suboffsets[i] = -1
  13148. *
  13149. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
  13150. * ndim, order)
  13151. *
  13152. */
  13153. (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
  13154. /* "View.MemoryView":1237
  13155. *
  13156. *
  13157. * for i in range(ndim): # <<<<<<<<<<<<<<
  13158. * if tmpslice.shape[i] == 1:
  13159. * tmpslice.strides[i] = 0
  13160. */
  13161. __pyx_t_3 = __pyx_v_ndim;
  13162. __pyx_t_5 = __pyx_t_3;
  13163. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  13164. __pyx_v_i = __pyx_t_6;
  13165. /* "View.MemoryView":1238
  13166. *
  13167. * for i in range(ndim):
  13168. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  13169. * tmpslice.strides[i] = 0
  13170. *
  13171. */
  13172. __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
  13173. if (__pyx_t_2) {
  13174. /* "View.MemoryView":1239
  13175. * for i in range(ndim):
  13176. * if tmpslice.shape[i] == 1:
  13177. * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
  13178. *
  13179. * if slice_is_contig(src[0], order, ndim):
  13180. */
  13181. (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
  13182. /* "View.MemoryView":1238
  13183. *
  13184. * for i in range(ndim):
  13185. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  13186. * tmpslice.strides[i] = 0
  13187. *
  13188. */
  13189. }
  13190. }
  13191. /* "View.MemoryView":1241
  13192. * tmpslice.strides[i] = 0
  13193. *
  13194. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  13195. * memcpy(result, src.data, size)
  13196. * else:
  13197. */
  13198. __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  13199. if (__pyx_t_2) {
  13200. /* "View.MemoryView":1242
  13201. *
  13202. * if slice_is_contig(src[0], order, ndim):
  13203. * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
  13204. * else:
  13205. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  13206. */
  13207. (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
  13208. /* "View.MemoryView":1241
  13209. * tmpslice.strides[i] = 0
  13210. *
  13211. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  13212. * memcpy(result, src.data, size)
  13213. * else:
  13214. */
  13215. goto __pyx_L9;
  13216. }
  13217. /* "View.MemoryView":1244
  13218. * memcpy(result, src.data, size)
  13219. * else:
  13220. * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
  13221. *
  13222. * return result
  13223. */
  13224. /*else*/ {
  13225. copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  13226. }
  13227. __pyx_L9:;
  13228. /* "View.MemoryView":1246
  13229. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  13230. *
  13231. * return result # <<<<<<<<<<<<<<
  13232. *
  13233. *
  13234. */
  13235. __pyx_r = __pyx_v_result;
  13236. goto __pyx_L0;
  13237. /* "View.MemoryView":1208
  13238. *
  13239. * @cname('__pyx_memoryview_copy_data_to_temp')
  13240. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  13241. * __Pyx_memviewslice *tmpslice,
  13242. * char order,
  13243. */
  13244. /* function exit code */
  13245. __pyx_L1_error:;
  13246. {
  13247. #ifdef WITH_THREAD
  13248. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13249. #endif
  13250. __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13251. #ifdef WITH_THREAD
  13252. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13253. #endif
  13254. }
  13255. __pyx_r = NULL;
  13256. __pyx_L0:;
  13257. return __pyx_r;
  13258. }
  13259. /* "View.MemoryView":1251
  13260. *
  13261. * @cname('__pyx_memoryview_err_extents')
  13262. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  13263. * Py_ssize_t extent2) except -1 with gil:
  13264. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13265. */
  13266. static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  13267. int __pyx_r;
  13268. __Pyx_RefNannyDeclarations
  13269. PyObject *__pyx_t_1 = NULL;
  13270. PyObject *__pyx_t_2 = NULL;
  13271. PyObject *__pyx_t_3 = NULL;
  13272. PyObject *__pyx_t_4 = NULL;
  13273. int __pyx_lineno = 0;
  13274. const char *__pyx_filename = NULL;
  13275. int __pyx_clineno = 0;
  13276. #ifdef WITH_THREAD
  13277. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13278. #endif
  13279. __Pyx_RefNannySetupContext("_err_extents", 0);
  13280. /* "View.MemoryView":1254
  13281. * Py_ssize_t extent2) except -1 with gil:
  13282. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13283. * (i, extent1, extent2)) # <<<<<<<<<<<<<<
  13284. *
  13285. * @cname('__pyx_memoryview_err_dim')
  13286. */
  13287. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
  13288. __Pyx_GOTREF(__pyx_t_1);
  13289. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
  13290. __Pyx_GOTREF(__pyx_t_2);
  13291. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
  13292. __Pyx_GOTREF(__pyx_t_3);
  13293. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
  13294. __Pyx_GOTREF(__pyx_t_4);
  13295. __Pyx_GIVEREF(__pyx_t_1);
  13296. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  13297. __Pyx_GIVEREF(__pyx_t_2);
  13298. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  13299. __Pyx_GIVEREF(__pyx_t_3);
  13300. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  13301. __pyx_t_1 = 0;
  13302. __pyx_t_2 = 0;
  13303. __pyx_t_3 = 0;
  13304. /* "View.MemoryView":1253
  13305. * cdef int _err_extents(int i, Py_ssize_t extent1,
  13306. * Py_ssize_t extent2) except -1 with gil:
  13307. * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
  13308. * (i, extent1, extent2))
  13309. *
  13310. */
  13311. __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
  13312. __Pyx_GOTREF(__pyx_t_3);
  13313. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13314. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
  13315. __Pyx_GOTREF(__pyx_t_4);
  13316. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13317. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  13318. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13319. __PYX_ERR(2, 1253, __pyx_L1_error)
  13320. /* "View.MemoryView":1251
  13321. *
  13322. * @cname('__pyx_memoryview_err_extents')
  13323. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  13324. * Py_ssize_t extent2) except -1 with gil:
  13325. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13326. */
  13327. /* function exit code */
  13328. __pyx_L1_error:;
  13329. __Pyx_XDECREF(__pyx_t_1);
  13330. __Pyx_XDECREF(__pyx_t_2);
  13331. __Pyx_XDECREF(__pyx_t_3);
  13332. __Pyx_XDECREF(__pyx_t_4);
  13333. __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13334. __pyx_r = -1;
  13335. __Pyx_RefNannyFinishContext();
  13336. #ifdef WITH_THREAD
  13337. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13338. #endif
  13339. return __pyx_r;
  13340. }
  13341. /* "View.MemoryView":1257
  13342. *
  13343. * @cname('__pyx_memoryview_err_dim')
  13344. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  13345. * raise error(msg.decode('ascii') % dim)
  13346. *
  13347. */
  13348. static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  13349. int __pyx_r;
  13350. __Pyx_RefNannyDeclarations
  13351. PyObject *__pyx_t_1 = NULL;
  13352. PyObject *__pyx_t_2 = NULL;
  13353. PyObject *__pyx_t_3 = NULL;
  13354. PyObject *__pyx_t_4 = NULL;
  13355. int __pyx_lineno = 0;
  13356. const char *__pyx_filename = NULL;
  13357. int __pyx_clineno = 0;
  13358. #ifdef WITH_THREAD
  13359. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13360. #endif
  13361. __Pyx_RefNannySetupContext("_err_dim", 0);
  13362. __Pyx_INCREF(__pyx_v_error);
  13363. /* "View.MemoryView":1258
  13364. * @cname('__pyx_memoryview_err_dim')
  13365. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
  13366. * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
  13367. *
  13368. * @cname('__pyx_memoryview_err')
  13369. */
  13370. __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
  13371. __Pyx_GOTREF(__pyx_t_2);
  13372. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
  13373. __Pyx_GOTREF(__pyx_t_3);
  13374. __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
  13375. __Pyx_GOTREF(__pyx_t_4);
  13376. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13377. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13378. __Pyx_INCREF(__pyx_v_error);
  13379. __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  13380. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  13381. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  13382. if (likely(__pyx_t_2)) {
  13383. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  13384. __Pyx_INCREF(__pyx_t_2);
  13385. __Pyx_INCREF(function);
  13386. __Pyx_DECREF_SET(__pyx_t_3, function);
  13387. }
  13388. }
  13389. __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  13390. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13391. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13392. if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
  13393. __Pyx_GOTREF(__pyx_t_1);
  13394. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13395. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  13396. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13397. __PYX_ERR(2, 1258, __pyx_L1_error)
  13398. /* "View.MemoryView":1257
  13399. *
  13400. * @cname('__pyx_memoryview_err_dim')
  13401. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  13402. * raise error(msg.decode('ascii') % dim)
  13403. *
  13404. */
  13405. /* function exit code */
  13406. __pyx_L1_error:;
  13407. __Pyx_XDECREF(__pyx_t_1);
  13408. __Pyx_XDECREF(__pyx_t_2);
  13409. __Pyx_XDECREF(__pyx_t_3);
  13410. __Pyx_XDECREF(__pyx_t_4);
  13411. __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13412. __pyx_r = -1;
  13413. __Pyx_XDECREF(__pyx_v_error);
  13414. __Pyx_RefNannyFinishContext();
  13415. #ifdef WITH_THREAD
  13416. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13417. #endif
  13418. return __pyx_r;
  13419. }
  13420. /* "View.MemoryView":1261
  13421. *
  13422. * @cname('__pyx_memoryview_err')
  13423. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  13424. * if msg != NULL:
  13425. * raise error(msg.decode('ascii'))
  13426. */
  13427. static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  13428. int __pyx_r;
  13429. __Pyx_RefNannyDeclarations
  13430. int __pyx_t_1;
  13431. PyObject *__pyx_t_2 = NULL;
  13432. PyObject *__pyx_t_3 = NULL;
  13433. PyObject *__pyx_t_4 = NULL;
  13434. PyObject *__pyx_t_5 = NULL;
  13435. int __pyx_lineno = 0;
  13436. const char *__pyx_filename = NULL;
  13437. int __pyx_clineno = 0;
  13438. #ifdef WITH_THREAD
  13439. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13440. #endif
  13441. __Pyx_RefNannySetupContext("_err", 0);
  13442. __Pyx_INCREF(__pyx_v_error);
  13443. /* "View.MemoryView":1262
  13444. * @cname('__pyx_memoryview_err')
  13445. * cdef int _err(object error, char *msg) except -1 with gil:
  13446. * if msg != NULL: # <<<<<<<<<<<<<<
  13447. * raise error(msg.decode('ascii'))
  13448. * else:
  13449. */
  13450. __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  13451. if (unlikely(__pyx_t_1)) {
  13452. /* "View.MemoryView":1263
  13453. * cdef int _err(object error, char *msg) except -1 with gil:
  13454. * if msg != NULL:
  13455. * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
  13456. * else:
  13457. * raise error
  13458. */
  13459. __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
  13460. __Pyx_GOTREF(__pyx_t_3);
  13461. __Pyx_INCREF(__pyx_v_error);
  13462. __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
  13463. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  13464. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
  13465. if (likely(__pyx_t_5)) {
  13466. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  13467. __Pyx_INCREF(__pyx_t_5);
  13468. __Pyx_INCREF(function);
  13469. __Pyx_DECREF_SET(__pyx_t_4, function);
  13470. }
  13471. }
  13472. __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  13473. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  13474. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13475. if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
  13476. __Pyx_GOTREF(__pyx_t_2);
  13477. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13478. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  13479. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13480. __PYX_ERR(2, 1263, __pyx_L1_error)
  13481. /* "View.MemoryView":1262
  13482. * @cname('__pyx_memoryview_err')
  13483. * cdef int _err(object error, char *msg) except -1 with gil:
  13484. * if msg != NULL: # <<<<<<<<<<<<<<
  13485. * raise error(msg.decode('ascii'))
  13486. * else:
  13487. */
  13488. }
  13489. /* "View.MemoryView":1265
  13490. * raise error(msg.decode('ascii'))
  13491. * else:
  13492. * raise error # <<<<<<<<<<<<<<
  13493. *
  13494. * @cname('__pyx_memoryview_copy_contents')
  13495. */
  13496. /*else*/ {
  13497. __Pyx_Raise(__pyx_v_error, 0, 0, 0);
  13498. __PYX_ERR(2, 1265, __pyx_L1_error)
  13499. }
  13500. /* "View.MemoryView":1261
  13501. *
  13502. * @cname('__pyx_memoryview_err')
  13503. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  13504. * if msg != NULL:
  13505. * raise error(msg.decode('ascii'))
  13506. */
  13507. /* function exit code */
  13508. __pyx_L1_error:;
  13509. __Pyx_XDECREF(__pyx_t_2);
  13510. __Pyx_XDECREF(__pyx_t_3);
  13511. __Pyx_XDECREF(__pyx_t_4);
  13512. __Pyx_XDECREF(__pyx_t_5);
  13513. __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13514. __pyx_r = -1;
  13515. __Pyx_XDECREF(__pyx_v_error);
  13516. __Pyx_RefNannyFinishContext();
  13517. #ifdef WITH_THREAD
  13518. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13519. #endif
  13520. return __pyx_r;
  13521. }
  13522. /* "View.MemoryView":1268
  13523. *
  13524. * @cname('__pyx_memoryview_copy_contents')
  13525. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  13526. * __Pyx_memviewslice dst,
  13527. * int src_ndim, int dst_ndim,
  13528. */
  13529. static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  13530. void *__pyx_v_tmpdata;
  13531. size_t __pyx_v_itemsize;
  13532. int __pyx_v_i;
  13533. char __pyx_v_order;
  13534. int __pyx_v_broadcasting;
  13535. int __pyx_v_direct_copy;
  13536. __Pyx_memviewslice __pyx_v_tmp;
  13537. int __pyx_v_ndim;
  13538. int __pyx_r;
  13539. Py_ssize_t __pyx_t_1;
  13540. int __pyx_t_2;
  13541. int __pyx_t_3;
  13542. int __pyx_t_4;
  13543. int __pyx_t_5;
  13544. int __pyx_t_6;
  13545. void *__pyx_t_7;
  13546. int __pyx_t_8;
  13547. int __pyx_lineno = 0;
  13548. const char *__pyx_filename = NULL;
  13549. int __pyx_clineno = 0;
  13550. /* "View.MemoryView":1276
  13551. * Check for overlapping memory and verify the shapes.
  13552. * """
  13553. * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
  13554. * cdef size_t itemsize = src.memview.view.itemsize
  13555. * cdef int i
  13556. */
  13557. __pyx_v_tmpdata = NULL;
  13558. /* "View.MemoryView":1277
  13559. * """
  13560. * cdef void *tmpdata = NULL
  13561. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  13562. * cdef int i
  13563. * cdef char order = get_best_order(&src, src_ndim)
  13564. */
  13565. __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  13566. __pyx_v_itemsize = __pyx_t_1;
  13567. /* "View.MemoryView":1279
  13568. * cdef size_t itemsize = src.memview.view.itemsize
  13569. * cdef int i
  13570. * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
  13571. * cdef bint broadcasting = False
  13572. * cdef bint direct_copy = False
  13573. */
  13574. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
  13575. /* "View.MemoryView":1280
  13576. * cdef int i
  13577. * cdef char order = get_best_order(&src, src_ndim)
  13578. * cdef bint broadcasting = False # <<<<<<<<<<<<<<
  13579. * cdef bint direct_copy = False
  13580. * cdef __Pyx_memviewslice tmp
  13581. */
  13582. __pyx_v_broadcasting = 0;
  13583. /* "View.MemoryView":1281
  13584. * cdef char order = get_best_order(&src, src_ndim)
  13585. * cdef bint broadcasting = False
  13586. * cdef bint direct_copy = False # <<<<<<<<<<<<<<
  13587. * cdef __Pyx_memviewslice tmp
  13588. *
  13589. */
  13590. __pyx_v_direct_copy = 0;
  13591. /* "View.MemoryView":1284
  13592. * cdef __Pyx_memviewslice tmp
  13593. *
  13594. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  13595. * broadcast_leading(&src, src_ndim, dst_ndim)
  13596. * elif dst_ndim < src_ndim:
  13597. */
  13598. __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  13599. if (__pyx_t_2) {
  13600. /* "View.MemoryView":1285
  13601. *
  13602. * if src_ndim < dst_ndim:
  13603. * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  13604. * elif dst_ndim < src_ndim:
  13605. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13606. */
  13607. __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
  13608. /* "View.MemoryView":1284
  13609. * cdef __Pyx_memviewslice tmp
  13610. *
  13611. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  13612. * broadcast_leading(&src, src_ndim, dst_ndim)
  13613. * elif dst_ndim < src_ndim:
  13614. */
  13615. goto __pyx_L3;
  13616. }
  13617. /* "View.MemoryView":1286
  13618. * if src_ndim < dst_ndim:
  13619. * broadcast_leading(&src, src_ndim, dst_ndim)
  13620. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  13621. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13622. *
  13623. */
  13624. __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  13625. if (__pyx_t_2) {
  13626. /* "View.MemoryView":1287
  13627. * broadcast_leading(&src, src_ndim, dst_ndim)
  13628. * elif dst_ndim < src_ndim:
  13629. * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
  13630. *
  13631. * cdef int ndim = max(src_ndim, dst_ndim)
  13632. */
  13633. __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
  13634. /* "View.MemoryView":1286
  13635. * if src_ndim < dst_ndim:
  13636. * broadcast_leading(&src, src_ndim, dst_ndim)
  13637. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  13638. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13639. *
  13640. */
  13641. }
  13642. __pyx_L3:;
  13643. /* "View.MemoryView":1289
  13644. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13645. *
  13646. * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  13647. *
  13648. * for i in range(ndim):
  13649. */
  13650. __pyx_t_3 = __pyx_v_dst_ndim;
  13651. __pyx_t_4 = __pyx_v_src_ndim;
  13652. if (((__pyx_t_3 > __pyx_t_4) != 0)) {
  13653. __pyx_t_5 = __pyx_t_3;
  13654. } else {
  13655. __pyx_t_5 = __pyx_t_4;
  13656. }
  13657. __pyx_v_ndim = __pyx_t_5;
  13658. /* "View.MemoryView":1291
  13659. * cdef int ndim = max(src_ndim, dst_ndim)
  13660. *
  13661. * for i in range(ndim): # <<<<<<<<<<<<<<
  13662. * if src.shape[i] != dst.shape[i]:
  13663. * if src.shape[i] == 1:
  13664. */
  13665. __pyx_t_5 = __pyx_v_ndim;
  13666. __pyx_t_3 = __pyx_t_5;
  13667. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  13668. __pyx_v_i = __pyx_t_4;
  13669. /* "View.MemoryView":1292
  13670. *
  13671. * for i in range(ndim):
  13672. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  13673. * if src.shape[i] == 1:
  13674. * broadcasting = True
  13675. */
  13676. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
  13677. if (__pyx_t_2) {
  13678. /* "View.MemoryView":1293
  13679. * for i in range(ndim):
  13680. * if src.shape[i] != dst.shape[i]:
  13681. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  13682. * broadcasting = True
  13683. * src.strides[i] = 0
  13684. */
  13685. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
  13686. if (__pyx_t_2) {
  13687. /* "View.MemoryView":1294
  13688. * if src.shape[i] != dst.shape[i]:
  13689. * if src.shape[i] == 1:
  13690. * broadcasting = True # <<<<<<<<<<<<<<
  13691. * src.strides[i] = 0
  13692. * else:
  13693. */
  13694. __pyx_v_broadcasting = 1;
  13695. /* "View.MemoryView":1295
  13696. * if src.shape[i] == 1:
  13697. * broadcasting = True
  13698. * src.strides[i] = 0 # <<<<<<<<<<<<<<
  13699. * else:
  13700. * _err_extents(i, dst.shape[i], src.shape[i])
  13701. */
  13702. (__pyx_v_src.strides[__pyx_v_i]) = 0;
  13703. /* "View.MemoryView":1293
  13704. * for i in range(ndim):
  13705. * if src.shape[i] != dst.shape[i]:
  13706. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  13707. * broadcasting = True
  13708. * src.strides[i] = 0
  13709. */
  13710. goto __pyx_L7;
  13711. }
  13712. /* "View.MemoryView":1297
  13713. * src.strides[i] = 0
  13714. * else:
  13715. * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
  13716. *
  13717. * if src.suboffsets[i] >= 0:
  13718. */
  13719. /*else*/ {
  13720. __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
  13721. }
  13722. __pyx_L7:;
  13723. /* "View.MemoryView":1292
  13724. *
  13725. * for i in range(ndim):
  13726. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  13727. * if src.shape[i] == 1:
  13728. * broadcasting = True
  13729. */
  13730. }
  13731. /* "View.MemoryView":1299
  13732. * _err_extents(i, dst.shape[i], src.shape[i])
  13733. *
  13734. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  13735. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13736. *
  13737. */
  13738. __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
  13739. if (__pyx_t_2) {
  13740. /* "View.MemoryView":1300
  13741. *
  13742. * if src.suboffsets[i] >= 0:
  13743. * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
  13744. *
  13745. * if slices_overlap(&src, &dst, ndim, itemsize):
  13746. */
  13747. __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
  13748. /* "View.MemoryView":1299
  13749. * _err_extents(i, dst.shape[i], src.shape[i])
  13750. *
  13751. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  13752. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13753. *
  13754. */
  13755. }
  13756. }
  13757. /* "View.MemoryView":1302
  13758. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13759. *
  13760. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  13761. *
  13762. * if not slice_is_contig(src, order, ndim):
  13763. */
  13764. __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  13765. if (__pyx_t_2) {
  13766. /* "View.MemoryView":1304
  13767. * if slices_overlap(&src, &dst, ndim, itemsize):
  13768. *
  13769. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  13770. * order = get_best_order(&dst, ndim)
  13771. *
  13772. */
  13773. __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
  13774. if (__pyx_t_2) {
  13775. /* "View.MemoryView":1305
  13776. *
  13777. * if not slice_is_contig(src, order, ndim):
  13778. * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
  13779. *
  13780. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  13781. */
  13782. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
  13783. /* "View.MemoryView":1304
  13784. * if slices_overlap(&src, &dst, ndim, itemsize):
  13785. *
  13786. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  13787. * order = get_best_order(&dst, ndim)
  13788. *
  13789. */
  13790. }
  13791. /* "View.MemoryView":1307
  13792. * order = get_best_order(&dst, ndim)
  13793. *
  13794. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
  13795. * src = tmp
  13796. *
  13797. */
  13798. __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
  13799. __pyx_v_tmpdata = __pyx_t_7;
  13800. /* "View.MemoryView":1308
  13801. *
  13802. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  13803. * src = tmp # <<<<<<<<<<<<<<
  13804. *
  13805. * if not broadcasting:
  13806. */
  13807. __pyx_v_src = __pyx_v_tmp;
  13808. /* "View.MemoryView":1302
  13809. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13810. *
  13811. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  13812. *
  13813. * if not slice_is_contig(src, order, ndim):
  13814. */
  13815. }
  13816. /* "View.MemoryView":1310
  13817. * src = tmp
  13818. *
  13819. * if not broadcasting: # <<<<<<<<<<<<<<
  13820. *
  13821. *
  13822. */
  13823. __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  13824. if (__pyx_t_2) {
  13825. /* "View.MemoryView":1313
  13826. *
  13827. *
  13828. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  13829. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13830. * elif slice_is_contig(src, 'F', ndim):
  13831. */
  13832. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
  13833. if (__pyx_t_2) {
  13834. /* "View.MemoryView":1314
  13835. *
  13836. * if slice_is_contig(src, 'C', ndim):
  13837. * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
  13838. * elif slice_is_contig(src, 'F', ndim):
  13839. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13840. */
  13841. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
  13842. /* "View.MemoryView":1313
  13843. *
  13844. *
  13845. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  13846. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13847. * elif slice_is_contig(src, 'F', ndim):
  13848. */
  13849. goto __pyx_L12;
  13850. }
  13851. /* "View.MemoryView":1315
  13852. * if slice_is_contig(src, 'C', ndim):
  13853. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13854. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  13855. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13856. *
  13857. */
  13858. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
  13859. if (__pyx_t_2) {
  13860. /* "View.MemoryView":1316
  13861. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13862. * elif slice_is_contig(src, 'F', ndim):
  13863. * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
  13864. *
  13865. * if direct_copy:
  13866. */
  13867. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
  13868. /* "View.MemoryView":1315
  13869. * if slice_is_contig(src, 'C', ndim):
  13870. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13871. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  13872. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13873. *
  13874. */
  13875. }
  13876. __pyx_L12:;
  13877. /* "View.MemoryView":1318
  13878. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13879. *
  13880. * if direct_copy: # <<<<<<<<<<<<<<
  13881. *
  13882. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13883. */
  13884. __pyx_t_2 = (__pyx_v_direct_copy != 0);
  13885. if (__pyx_t_2) {
  13886. /* "View.MemoryView":1320
  13887. * if direct_copy:
  13888. *
  13889. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  13890. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13891. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13892. */
  13893. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  13894. /* "View.MemoryView":1321
  13895. *
  13896. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13897. * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
  13898. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13899. * free(tmpdata)
  13900. */
  13901. (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
  13902. /* "View.MemoryView":1322
  13903. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13904. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13905. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  13906. * free(tmpdata)
  13907. * return 0
  13908. */
  13909. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  13910. /* "View.MemoryView":1323
  13911. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13912. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13913. * free(tmpdata) # <<<<<<<<<<<<<<
  13914. * return 0
  13915. *
  13916. */
  13917. free(__pyx_v_tmpdata);
  13918. /* "View.MemoryView":1324
  13919. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13920. * free(tmpdata)
  13921. * return 0 # <<<<<<<<<<<<<<
  13922. *
  13923. * if order == 'F' == get_best_order(&dst, ndim):
  13924. */
  13925. __pyx_r = 0;
  13926. goto __pyx_L0;
  13927. /* "View.MemoryView":1318
  13928. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13929. *
  13930. * if direct_copy: # <<<<<<<<<<<<<<
  13931. *
  13932. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13933. */
  13934. }
  13935. /* "View.MemoryView":1310
  13936. * src = tmp
  13937. *
  13938. * if not broadcasting: # <<<<<<<<<<<<<<
  13939. *
  13940. *
  13941. */
  13942. }
  13943. /* "View.MemoryView":1326
  13944. * return 0
  13945. *
  13946. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  13947. *
  13948. *
  13949. */
  13950. __pyx_t_2 = (__pyx_v_order == 'F');
  13951. if (__pyx_t_2) {
  13952. __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  13953. }
  13954. __pyx_t_8 = (__pyx_t_2 != 0);
  13955. if (__pyx_t_8) {
  13956. /* "View.MemoryView":1329
  13957. *
  13958. *
  13959. * transpose_memslice(&src) # <<<<<<<<<<<<<<
  13960. * transpose_memslice(&dst)
  13961. *
  13962. */
  13963. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
  13964. /* "View.MemoryView":1330
  13965. *
  13966. * transpose_memslice(&src)
  13967. * transpose_memslice(&dst) # <<<<<<<<<<<<<<
  13968. *
  13969. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13970. */
  13971. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
  13972. /* "View.MemoryView":1326
  13973. * return 0
  13974. *
  13975. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  13976. *
  13977. *
  13978. */
  13979. }
  13980. /* "View.MemoryView":1332
  13981. * transpose_memslice(&dst)
  13982. *
  13983. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  13984. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  13985. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13986. */
  13987. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  13988. /* "View.MemoryView":1333
  13989. *
  13990. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13991. * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
  13992. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13993. *
  13994. */
  13995. copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
  13996. /* "View.MemoryView":1334
  13997. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13998. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  13999. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  14000. *
  14001. * free(tmpdata)
  14002. */
  14003. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  14004. /* "View.MemoryView":1336
  14005. * refcount_copying(&dst, dtype_is_object, ndim, True)
  14006. *
  14007. * free(tmpdata) # <<<<<<<<<<<<<<
  14008. * return 0
  14009. *
  14010. */
  14011. free(__pyx_v_tmpdata);
  14012. /* "View.MemoryView":1337
  14013. *
  14014. * free(tmpdata)
  14015. * return 0 # <<<<<<<<<<<<<<
  14016. *
  14017. * @cname('__pyx_memoryview_broadcast_leading')
  14018. */
  14019. __pyx_r = 0;
  14020. goto __pyx_L0;
  14021. /* "View.MemoryView":1268
  14022. *
  14023. * @cname('__pyx_memoryview_copy_contents')
  14024. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  14025. * __Pyx_memviewslice dst,
  14026. * int src_ndim, int dst_ndim,
  14027. */
  14028. /* function exit code */
  14029. __pyx_L1_error:;
  14030. {
  14031. #ifdef WITH_THREAD
  14032. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  14033. #endif
  14034. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14035. #ifdef WITH_THREAD
  14036. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  14037. #endif
  14038. }
  14039. __pyx_r = -1;
  14040. __pyx_L0:;
  14041. return __pyx_r;
  14042. }
  14043. /* "View.MemoryView":1340
  14044. *
  14045. * @cname('__pyx_memoryview_broadcast_leading')
  14046. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  14047. * int ndim,
  14048. * int ndim_other) nogil:
  14049. */
  14050. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  14051. int __pyx_v_i;
  14052. int __pyx_v_offset;
  14053. int __pyx_t_1;
  14054. int __pyx_t_2;
  14055. int __pyx_t_3;
  14056. /* "View.MemoryView":1344
  14057. * int ndim_other) nogil:
  14058. * cdef int i
  14059. * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
  14060. *
  14061. * for i in range(ndim - 1, -1, -1):
  14062. */
  14063. __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
  14064. /* "View.MemoryView":1346
  14065. * cdef int offset = ndim_other - ndim
  14066. *
  14067. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  14068. * mslice.shape[i + offset] = mslice.shape[i]
  14069. * mslice.strides[i + offset] = mslice.strides[i]
  14070. */
  14071. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  14072. __pyx_v_i = __pyx_t_1;
  14073. /* "View.MemoryView":1347
  14074. *
  14075. * for i in range(ndim - 1, -1, -1):
  14076. * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
  14077. * mslice.strides[i + offset] = mslice.strides[i]
  14078. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14079. */
  14080. (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
  14081. /* "View.MemoryView":1348
  14082. * for i in range(ndim - 1, -1, -1):
  14083. * mslice.shape[i + offset] = mslice.shape[i]
  14084. * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
  14085. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14086. *
  14087. */
  14088. (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
  14089. /* "View.MemoryView":1349
  14090. * mslice.shape[i + offset] = mslice.shape[i]
  14091. * mslice.strides[i + offset] = mslice.strides[i]
  14092. * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
  14093. *
  14094. * for i in range(offset):
  14095. */
  14096. (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  14097. }
  14098. /* "View.MemoryView":1351
  14099. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14100. *
  14101. * for i in range(offset): # <<<<<<<<<<<<<<
  14102. * mslice.shape[i] = 1
  14103. * mslice.strides[i] = mslice.strides[0]
  14104. */
  14105. __pyx_t_1 = __pyx_v_offset;
  14106. __pyx_t_2 = __pyx_t_1;
  14107. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  14108. __pyx_v_i = __pyx_t_3;
  14109. /* "View.MemoryView":1352
  14110. *
  14111. * for i in range(offset):
  14112. * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
  14113. * mslice.strides[i] = mslice.strides[0]
  14114. * mslice.suboffsets[i] = -1
  14115. */
  14116. (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
  14117. /* "View.MemoryView":1353
  14118. * for i in range(offset):
  14119. * mslice.shape[i] = 1
  14120. * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
  14121. * mslice.suboffsets[i] = -1
  14122. *
  14123. */
  14124. (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
  14125. /* "View.MemoryView":1354
  14126. * mslice.shape[i] = 1
  14127. * mslice.strides[i] = mslice.strides[0]
  14128. * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  14129. *
  14130. *
  14131. */
  14132. (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  14133. }
  14134. /* "View.MemoryView":1340
  14135. *
  14136. * @cname('__pyx_memoryview_broadcast_leading')
  14137. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  14138. * int ndim,
  14139. * int ndim_other) nogil:
  14140. */
  14141. /* function exit code */
  14142. }
  14143. /* "View.MemoryView":1362
  14144. *
  14145. * @cname('__pyx_memoryview_refcount_copying')
  14146. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  14147. * int ndim, bint inc) nogil:
  14148. *
  14149. */
  14150. static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
  14151. int __pyx_t_1;
  14152. /* "View.MemoryView":1366
  14153. *
  14154. *
  14155. * if dtype_is_object: # <<<<<<<<<<<<<<
  14156. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  14157. * dst.strides, ndim, inc)
  14158. */
  14159. __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  14160. if (__pyx_t_1) {
  14161. /* "View.MemoryView":1367
  14162. *
  14163. * if dtype_is_object:
  14164. * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
  14165. * dst.strides, ndim, inc)
  14166. *
  14167. */
  14168. __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
  14169. /* "View.MemoryView":1366
  14170. *
  14171. *
  14172. * if dtype_is_object: # <<<<<<<<<<<<<<
  14173. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  14174. * dst.strides, ndim, inc)
  14175. */
  14176. }
  14177. /* "View.MemoryView":1362
  14178. *
  14179. * @cname('__pyx_memoryview_refcount_copying')
  14180. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  14181. * int ndim, bint inc) nogil:
  14182. *
  14183. */
  14184. /* function exit code */
  14185. }
  14186. /* "View.MemoryView":1371
  14187. *
  14188. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  14189. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14190. * Py_ssize_t *strides, int ndim,
  14191. * bint inc) with gil:
  14192. */
  14193. static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  14194. __Pyx_RefNannyDeclarations
  14195. #ifdef WITH_THREAD
  14196. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  14197. #endif
  14198. __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
  14199. /* "View.MemoryView":1374
  14200. * Py_ssize_t *strides, int ndim,
  14201. * bint inc) with gil:
  14202. * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
  14203. *
  14204. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14205. */
  14206. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
  14207. /* "View.MemoryView":1371
  14208. *
  14209. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  14210. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14211. * Py_ssize_t *strides, int ndim,
  14212. * bint inc) with gil:
  14213. */
  14214. /* function exit code */
  14215. __Pyx_RefNannyFinishContext();
  14216. #ifdef WITH_THREAD
  14217. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  14218. #endif
  14219. }
  14220. /* "View.MemoryView":1377
  14221. *
  14222. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14223. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14224. * Py_ssize_t *strides, int ndim, bint inc):
  14225. * cdef Py_ssize_t i
  14226. */
  14227. static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  14228. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  14229. __Pyx_RefNannyDeclarations
  14230. Py_ssize_t __pyx_t_1;
  14231. Py_ssize_t __pyx_t_2;
  14232. Py_ssize_t __pyx_t_3;
  14233. int __pyx_t_4;
  14234. __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
  14235. /* "View.MemoryView":1381
  14236. * cdef Py_ssize_t i
  14237. *
  14238. * for i in range(shape[0]): # <<<<<<<<<<<<<<
  14239. * if ndim == 1:
  14240. * if inc:
  14241. */
  14242. __pyx_t_1 = (__pyx_v_shape[0]);
  14243. __pyx_t_2 = __pyx_t_1;
  14244. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  14245. __pyx_v_i = __pyx_t_3;
  14246. /* "View.MemoryView":1382
  14247. *
  14248. * for i in range(shape[0]):
  14249. * if ndim == 1: # <<<<<<<<<<<<<<
  14250. * if inc:
  14251. * Py_INCREF((<PyObject **> data)[0])
  14252. */
  14253. __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
  14254. if (__pyx_t_4) {
  14255. /* "View.MemoryView":1383
  14256. * for i in range(shape[0]):
  14257. * if ndim == 1:
  14258. * if inc: # <<<<<<<<<<<<<<
  14259. * Py_INCREF((<PyObject **> data)[0])
  14260. * else:
  14261. */
  14262. __pyx_t_4 = (__pyx_v_inc != 0);
  14263. if (__pyx_t_4) {
  14264. /* "View.MemoryView":1384
  14265. * if ndim == 1:
  14266. * if inc:
  14267. * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  14268. * else:
  14269. * Py_DECREF((<PyObject **> data)[0])
  14270. */
  14271. Py_INCREF((((PyObject **)__pyx_v_data)[0]));
  14272. /* "View.MemoryView":1383
  14273. * for i in range(shape[0]):
  14274. * if ndim == 1:
  14275. * if inc: # <<<<<<<<<<<<<<
  14276. * Py_INCREF((<PyObject **> data)[0])
  14277. * else:
  14278. */
  14279. goto __pyx_L6;
  14280. }
  14281. /* "View.MemoryView":1386
  14282. * Py_INCREF((<PyObject **> data)[0])
  14283. * else:
  14284. * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  14285. * else:
  14286. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  14287. */
  14288. /*else*/ {
  14289. Py_DECREF((((PyObject **)__pyx_v_data)[0]));
  14290. }
  14291. __pyx_L6:;
  14292. /* "View.MemoryView":1382
  14293. *
  14294. * for i in range(shape[0]):
  14295. * if ndim == 1: # <<<<<<<<<<<<<<
  14296. * if inc:
  14297. * Py_INCREF((<PyObject **> data)[0])
  14298. */
  14299. goto __pyx_L5;
  14300. }
  14301. /* "View.MemoryView":1388
  14302. * Py_DECREF((<PyObject **> data)[0])
  14303. * else:
  14304. * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  14305. * ndim - 1, inc)
  14306. *
  14307. */
  14308. /*else*/ {
  14309. /* "View.MemoryView":1389
  14310. * else:
  14311. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  14312. * ndim - 1, inc) # <<<<<<<<<<<<<<
  14313. *
  14314. * data += strides[0]
  14315. */
  14316. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
  14317. }
  14318. __pyx_L5:;
  14319. /* "View.MemoryView":1391
  14320. * ndim - 1, inc)
  14321. *
  14322. * data += strides[0] # <<<<<<<<<<<<<<
  14323. *
  14324. *
  14325. */
  14326. __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  14327. }
  14328. /* "View.MemoryView":1377
  14329. *
  14330. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14331. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14332. * Py_ssize_t *strides, int ndim, bint inc):
  14333. * cdef Py_ssize_t i
  14334. */
  14335. /* function exit code */
  14336. __Pyx_RefNannyFinishContext();
  14337. }
  14338. /* "View.MemoryView":1397
  14339. *
  14340. * @cname('__pyx_memoryview_slice_assign_scalar')
  14341. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  14342. * size_t itemsize, void *item,
  14343. * bint dtype_is_object) nogil:
  14344. */
  14345. static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
  14346. /* "View.MemoryView":1400
  14347. * size_t itemsize, void *item,
  14348. * bint dtype_is_object) nogil:
  14349. * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  14350. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  14351. * itemsize, item)
  14352. */
  14353. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  14354. /* "View.MemoryView":1401
  14355. * bint dtype_is_object) nogil:
  14356. * refcount_copying(dst, dtype_is_object, ndim, False)
  14357. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
  14358. * itemsize, item)
  14359. * refcount_copying(dst, dtype_is_object, ndim, True)
  14360. */
  14361. __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
  14362. /* "View.MemoryView":1403
  14363. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  14364. * itemsize, item)
  14365. * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  14366. *
  14367. *
  14368. */
  14369. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  14370. /* "View.MemoryView":1397
  14371. *
  14372. * @cname('__pyx_memoryview_slice_assign_scalar')
  14373. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  14374. * size_t itemsize, void *item,
  14375. * bint dtype_is_object) nogil:
  14376. */
  14377. /* function exit code */
  14378. }
  14379. /* "View.MemoryView":1407
  14380. *
  14381. * @cname('__pyx_memoryview__slice_assign_scalar')
  14382. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14383. * Py_ssize_t *strides, int ndim,
  14384. * size_t itemsize, void *item) nogil:
  14385. */
  14386. static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  14387. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  14388. Py_ssize_t __pyx_v_stride;
  14389. Py_ssize_t __pyx_v_extent;
  14390. int __pyx_t_1;
  14391. Py_ssize_t __pyx_t_2;
  14392. Py_ssize_t __pyx_t_3;
  14393. Py_ssize_t __pyx_t_4;
  14394. /* "View.MemoryView":1411
  14395. * size_t itemsize, void *item) nogil:
  14396. * cdef Py_ssize_t i
  14397. * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
  14398. * cdef Py_ssize_t extent = shape[0]
  14399. *
  14400. */
  14401. __pyx_v_stride = (__pyx_v_strides[0]);
  14402. /* "View.MemoryView":1412
  14403. * cdef Py_ssize_t i
  14404. * cdef Py_ssize_t stride = strides[0]
  14405. * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
  14406. *
  14407. * if ndim == 1:
  14408. */
  14409. __pyx_v_extent = (__pyx_v_shape[0]);
  14410. /* "View.MemoryView":1414
  14411. * cdef Py_ssize_t extent = shape[0]
  14412. *
  14413. * if ndim == 1: # <<<<<<<<<<<<<<
  14414. * for i in range(extent):
  14415. * memcpy(data, item, itemsize)
  14416. */
  14417. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  14418. if (__pyx_t_1) {
  14419. /* "View.MemoryView":1415
  14420. *
  14421. * if ndim == 1:
  14422. * for i in range(extent): # <<<<<<<<<<<<<<
  14423. * memcpy(data, item, itemsize)
  14424. * data += stride
  14425. */
  14426. __pyx_t_2 = __pyx_v_extent;
  14427. __pyx_t_3 = __pyx_t_2;
  14428. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  14429. __pyx_v_i = __pyx_t_4;
  14430. /* "View.MemoryView":1416
  14431. * if ndim == 1:
  14432. * for i in range(extent):
  14433. * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
  14434. * data += stride
  14435. * else:
  14436. */
  14437. (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
  14438. /* "View.MemoryView":1417
  14439. * for i in range(extent):
  14440. * memcpy(data, item, itemsize)
  14441. * data += stride # <<<<<<<<<<<<<<
  14442. * else:
  14443. * for i in range(extent):
  14444. */
  14445. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  14446. }
  14447. /* "View.MemoryView":1414
  14448. * cdef Py_ssize_t extent = shape[0]
  14449. *
  14450. * if ndim == 1: # <<<<<<<<<<<<<<
  14451. * for i in range(extent):
  14452. * memcpy(data, item, itemsize)
  14453. */
  14454. goto __pyx_L3;
  14455. }
  14456. /* "View.MemoryView":1419
  14457. * data += stride
  14458. * else:
  14459. * for i in range(extent): # <<<<<<<<<<<<<<
  14460. * _slice_assign_scalar(data, shape + 1, strides + 1,
  14461. * ndim - 1, itemsize, item)
  14462. */
  14463. /*else*/ {
  14464. __pyx_t_2 = __pyx_v_extent;
  14465. __pyx_t_3 = __pyx_t_2;
  14466. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  14467. __pyx_v_i = __pyx_t_4;
  14468. /* "View.MemoryView":1420
  14469. * else:
  14470. * for i in range(extent):
  14471. * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  14472. * ndim - 1, itemsize, item)
  14473. * data += stride
  14474. */
  14475. __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
  14476. /* "View.MemoryView":1422
  14477. * _slice_assign_scalar(data, shape + 1, strides + 1,
  14478. * ndim - 1, itemsize, item)
  14479. * data += stride # <<<<<<<<<<<<<<
  14480. *
  14481. *
  14482. */
  14483. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  14484. }
  14485. }
  14486. __pyx_L3:;
  14487. /* "View.MemoryView":1407
  14488. *
  14489. * @cname('__pyx_memoryview__slice_assign_scalar')
  14490. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14491. * Py_ssize_t *strides, int ndim,
  14492. * size_t itemsize, void *item) nogil:
  14493. */
  14494. /* function exit code */
  14495. }
  14496. /* "(tree fragment)":1
  14497. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  14498. * cdef object __pyx_PickleError
  14499. * cdef object __pyx_result
  14500. */
  14501. /* Python wrapper */
  14502. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  14503. static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
  14504. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  14505. PyObject *__pyx_v___pyx_type = 0;
  14506. long __pyx_v___pyx_checksum;
  14507. PyObject *__pyx_v___pyx_state = 0;
  14508. int __pyx_lineno = 0;
  14509. const char *__pyx_filename = NULL;
  14510. int __pyx_clineno = 0;
  14511. PyObject *__pyx_r = 0;
  14512. __Pyx_RefNannyDeclarations
  14513. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  14514. {
  14515. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  14516. PyObject* values[3] = {0,0,0};
  14517. if (unlikely(__pyx_kwds)) {
  14518. Py_ssize_t kw_args;
  14519. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  14520. switch (pos_args) {
  14521. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  14522. CYTHON_FALLTHROUGH;
  14523. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14524. CYTHON_FALLTHROUGH;
  14525. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14526. CYTHON_FALLTHROUGH;
  14527. case 0: break;
  14528. default: goto __pyx_L5_argtuple_error;
  14529. }
  14530. kw_args = PyDict_Size(__pyx_kwds);
  14531. switch (pos_args) {
  14532. case 0:
  14533. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  14534. else goto __pyx_L5_argtuple_error;
  14535. CYTHON_FALLTHROUGH;
  14536. case 1:
  14537. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  14538. else {
  14539. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
  14540. }
  14541. CYTHON_FALLTHROUGH;
  14542. case 2:
  14543. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  14544. else {
  14545. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
  14546. }
  14547. }
  14548. if (unlikely(kw_args > 0)) {
  14549. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
  14550. }
  14551. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  14552. goto __pyx_L5_argtuple_error;
  14553. } else {
  14554. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14555. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14556. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  14557. }
  14558. __pyx_v___pyx_type = values[0];
  14559. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
  14560. __pyx_v___pyx_state = values[2];
  14561. }
  14562. goto __pyx_L4_argument_unpacking_done;
  14563. __pyx_L5_argtuple_error:;
  14564. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  14565. __pyx_L3_error:;
  14566. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14567. __Pyx_RefNannyFinishContext();
  14568. return NULL;
  14569. __pyx_L4_argument_unpacking_done:;
  14570. __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  14571. /* function exit code */
  14572. __Pyx_RefNannyFinishContext();
  14573. return __pyx_r;
  14574. }
  14575. static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  14576. PyObject *__pyx_v___pyx_PickleError = 0;
  14577. PyObject *__pyx_v___pyx_result = 0;
  14578. PyObject *__pyx_r = NULL;
  14579. __Pyx_RefNannyDeclarations
  14580. int __pyx_t_1;
  14581. PyObject *__pyx_t_2 = NULL;
  14582. PyObject *__pyx_t_3 = NULL;
  14583. PyObject *__pyx_t_4 = NULL;
  14584. PyObject *__pyx_t_5 = NULL;
  14585. int __pyx_t_6;
  14586. int __pyx_lineno = 0;
  14587. const char *__pyx_filename = NULL;
  14588. int __pyx_clineno = 0;
  14589. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
  14590. /* "(tree fragment)":4
  14591. * cdef object __pyx_PickleError
  14592. * cdef object __pyx_result
  14593. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  14594. * from pickle import PickleError as __pyx_PickleError
  14595. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14596. */
  14597. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  14598. if (__pyx_t_1) {
  14599. /* "(tree fragment)":5
  14600. * cdef object __pyx_result
  14601. * if __pyx_checksum != 0xb068931:
  14602. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  14603. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14604. * __pyx_result = Enum.__new__(__pyx_type)
  14605. */
  14606. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  14607. __Pyx_GOTREF(__pyx_t_2);
  14608. __Pyx_INCREF(__pyx_n_s_PickleError);
  14609. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  14610. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  14611. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
  14612. __Pyx_GOTREF(__pyx_t_3);
  14613. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14614. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  14615. __Pyx_GOTREF(__pyx_t_2);
  14616. __Pyx_INCREF(__pyx_t_2);
  14617. __pyx_v___pyx_PickleError = __pyx_t_2;
  14618. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14619. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14620. /* "(tree fragment)":6
  14621. * if __pyx_checksum != 0xb068931:
  14622. * from pickle import PickleError as __pyx_PickleError
  14623. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
  14624. * __pyx_result = Enum.__new__(__pyx_type)
  14625. * if __pyx_state is not None:
  14626. */
  14627. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
  14628. __Pyx_GOTREF(__pyx_t_2);
  14629. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
  14630. __Pyx_GOTREF(__pyx_t_4);
  14631. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14632. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  14633. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  14634. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  14635. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  14636. if (likely(__pyx_t_5)) {
  14637. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14638. __Pyx_INCREF(__pyx_t_5);
  14639. __Pyx_INCREF(function);
  14640. __Pyx_DECREF_SET(__pyx_t_2, function);
  14641. }
  14642. }
  14643. __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  14644. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  14645. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14646. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
  14647. __Pyx_GOTREF(__pyx_t_3);
  14648. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14649. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  14650. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14651. __PYX_ERR(2, 6, __pyx_L1_error)
  14652. /* "(tree fragment)":4
  14653. * cdef object __pyx_PickleError
  14654. * cdef object __pyx_result
  14655. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  14656. * from pickle import PickleError as __pyx_PickleError
  14657. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14658. */
  14659. }
  14660. /* "(tree fragment)":7
  14661. * from pickle import PickleError as __pyx_PickleError
  14662. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14663. * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
  14664. * if __pyx_state is not None:
  14665. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14666. */
  14667. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
  14668. __Pyx_GOTREF(__pyx_t_2);
  14669. __pyx_t_4 = NULL;
  14670. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  14671. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
  14672. if (likely(__pyx_t_4)) {
  14673. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14674. __Pyx_INCREF(__pyx_t_4);
  14675. __Pyx_INCREF(function);
  14676. __Pyx_DECREF_SET(__pyx_t_2, function);
  14677. }
  14678. }
  14679. __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  14680. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14681. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
  14682. __Pyx_GOTREF(__pyx_t_3);
  14683. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14684. __pyx_v___pyx_result = __pyx_t_3;
  14685. __pyx_t_3 = 0;
  14686. /* "(tree fragment)":8
  14687. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14688. * __pyx_result = Enum.__new__(__pyx_type)
  14689. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  14690. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14691. * return __pyx_result
  14692. */
  14693. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  14694. __pyx_t_6 = (__pyx_t_1 != 0);
  14695. if (__pyx_t_6) {
  14696. /* "(tree fragment)":9
  14697. * __pyx_result = Enum.__new__(__pyx_type)
  14698. * if __pyx_state is not None:
  14699. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  14700. * return __pyx_result
  14701. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14702. */
  14703. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
  14704. __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
  14705. __Pyx_GOTREF(__pyx_t_3);
  14706. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14707. /* "(tree fragment)":8
  14708. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14709. * __pyx_result = Enum.__new__(__pyx_type)
  14710. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  14711. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14712. * return __pyx_result
  14713. */
  14714. }
  14715. /* "(tree fragment)":10
  14716. * if __pyx_state is not None:
  14717. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14718. * return __pyx_result # <<<<<<<<<<<<<<
  14719. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14720. * __pyx_result.name = __pyx_state[0]
  14721. */
  14722. __Pyx_XDECREF(__pyx_r);
  14723. __Pyx_INCREF(__pyx_v___pyx_result);
  14724. __pyx_r = __pyx_v___pyx_result;
  14725. goto __pyx_L0;
  14726. /* "(tree fragment)":1
  14727. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  14728. * cdef object __pyx_PickleError
  14729. * cdef object __pyx_result
  14730. */
  14731. /* function exit code */
  14732. __pyx_L1_error:;
  14733. __Pyx_XDECREF(__pyx_t_2);
  14734. __Pyx_XDECREF(__pyx_t_3);
  14735. __Pyx_XDECREF(__pyx_t_4);
  14736. __Pyx_XDECREF(__pyx_t_5);
  14737. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14738. __pyx_r = NULL;
  14739. __pyx_L0:;
  14740. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  14741. __Pyx_XDECREF(__pyx_v___pyx_result);
  14742. __Pyx_XGIVEREF(__pyx_r);
  14743. __Pyx_RefNannyFinishContext();
  14744. return __pyx_r;
  14745. }
  14746. /* "(tree fragment)":11
  14747. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14748. * return __pyx_result
  14749. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  14750. * __pyx_result.name = __pyx_state[0]
  14751. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14752. */
  14753. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  14754. PyObject *__pyx_r = NULL;
  14755. __Pyx_RefNannyDeclarations
  14756. PyObject *__pyx_t_1 = NULL;
  14757. int __pyx_t_2;
  14758. Py_ssize_t __pyx_t_3;
  14759. int __pyx_t_4;
  14760. int __pyx_t_5;
  14761. PyObject *__pyx_t_6 = NULL;
  14762. PyObject *__pyx_t_7 = NULL;
  14763. PyObject *__pyx_t_8 = NULL;
  14764. int __pyx_lineno = 0;
  14765. const char *__pyx_filename = NULL;
  14766. int __pyx_clineno = 0;
  14767. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
  14768. /* "(tree fragment)":12
  14769. * return __pyx_result
  14770. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14771. * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
  14772. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14773. * __pyx_result.__dict__.update(__pyx_state[1])
  14774. */
  14775. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14776. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  14777. __PYX_ERR(2, 12, __pyx_L1_error)
  14778. }
  14779. __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  14780. __Pyx_GOTREF(__pyx_t_1);
  14781. __Pyx_GIVEREF(__pyx_t_1);
  14782. __Pyx_GOTREF(__pyx_v___pyx_result->name);
  14783. __Pyx_DECREF(__pyx_v___pyx_result->name);
  14784. __pyx_v___pyx_result->name = __pyx_t_1;
  14785. __pyx_t_1 = 0;
  14786. /* "(tree fragment)":13
  14787. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14788. * __pyx_result.name = __pyx_state[0]
  14789. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  14790. * __pyx_result.__dict__.update(__pyx_state[1])
  14791. */
  14792. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14793. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  14794. __PYX_ERR(2, 13, __pyx_L1_error)
  14795. }
  14796. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  14797. __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  14798. if (__pyx_t_4) {
  14799. } else {
  14800. __pyx_t_2 = __pyx_t_4;
  14801. goto __pyx_L4_bool_binop_done;
  14802. }
  14803. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  14804. __pyx_t_5 = (__pyx_t_4 != 0);
  14805. __pyx_t_2 = __pyx_t_5;
  14806. __pyx_L4_bool_binop_done:;
  14807. if (__pyx_t_2) {
  14808. /* "(tree fragment)":14
  14809. * __pyx_result.name = __pyx_state[0]
  14810. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14811. * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
  14812. */
  14813. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
  14814. __Pyx_GOTREF(__pyx_t_6);
  14815. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
  14816. __Pyx_GOTREF(__pyx_t_7);
  14817. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14818. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14819. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  14820. __PYX_ERR(2, 14, __pyx_L1_error)
  14821. }
  14822. __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
  14823. __Pyx_GOTREF(__pyx_t_6);
  14824. __pyx_t_8 = NULL;
  14825. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  14826. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  14827. if (likely(__pyx_t_8)) {
  14828. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  14829. __Pyx_INCREF(__pyx_t_8);
  14830. __Pyx_INCREF(function);
  14831. __Pyx_DECREF_SET(__pyx_t_7, function);
  14832. }
  14833. }
  14834. __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  14835. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14836. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14837. if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
  14838. __Pyx_GOTREF(__pyx_t_1);
  14839. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  14840. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14841. /* "(tree fragment)":13
  14842. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14843. * __pyx_result.name = __pyx_state[0]
  14844. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  14845. * __pyx_result.__dict__.update(__pyx_state[1])
  14846. */
  14847. }
  14848. /* "(tree fragment)":11
  14849. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14850. * return __pyx_result
  14851. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  14852. * __pyx_result.name = __pyx_state[0]
  14853. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14854. */
  14855. /* function exit code */
  14856. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  14857. goto __pyx_L0;
  14858. __pyx_L1_error:;
  14859. __Pyx_XDECREF(__pyx_t_1);
  14860. __Pyx_XDECREF(__pyx_t_6);
  14861. __Pyx_XDECREF(__pyx_t_7);
  14862. __Pyx_XDECREF(__pyx_t_8);
  14863. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14864. __pyx_r = 0;
  14865. __pyx_L0:;
  14866. __Pyx_XGIVEREF(__pyx_r);
  14867. __Pyx_RefNannyFinishContext();
  14868. return __pyx_r;
  14869. }
  14870. static struct __pyx_vtabstruct_array __pyx_vtable_array;
  14871. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  14872. struct __pyx_array_obj *p;
  14873. PyObject *o;
  14874. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  14875. o = (*t->tp_alloc)(t, 0);
  14876. } else {
  14877. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  14878. }
  14879. if (unlikely(!o)) return 0;
  14880. p = ((struct __pyx_array_obj *)o);
  14881. p->__pyx_vtab = __pyx_vtabptr_array;
  14882. p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  14883. p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  14884. if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  14885. return o;
  14886. bad:
  14887. Py_DECREF(o); o = 0;
  14888. return NULL;
  14889. }
  14890. static void __pyx_tp_dealloc_array(PyObject *o) {
  14891. struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  14892. #if CYTHON_USE_TP_FINALIZE
  14893. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
  14894. if (PyObject_CallFinalizerFromDealloc(o)) return;
  14895. }
  14896. #endif
  14897. {
  14898. PyObject *etype, *eval, *etb;
  14899. PyErr_Fetch(&etype, &eval, &etb);
  14900. __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
  14901. __pyx_array___dealloc__(o);
  14902. __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
  14903. PyErr_Restore(etype, eval, etb);
  14904. }
  14905. Py_CLEAR(p->mode);
  14906. Py_CLEAR(p->_format);
  14907. (*Py_TYPE(o)->tp_free)(o);
  14908. }
  14909. static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  14910. PyObject *r;
  14911. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  14912. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  14913. Py_DECREF(x);
  14914. return r;
  14915. }
  14916. static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  14917. if (v) {
  14918. return __pyx_array___setitem__(o, i, v);
  14919. }
  14920. else {
  14921. PyErr_Format(PyExc_NotImplementedError,
  14922. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  14923. return -1;
  14924. }
  14925. }
  14926. static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  14927. PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  14928. if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  14929. PyErr_Clear();
  14930. v = __pyx_array___getattr__(o, n);
  14931. }
  14932. return v;
  14933. }
  14934. static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  14935. return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
  14936. }
  14937. static PyMethodDef __pyx_methods_array[] = {
  14938. {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  14939. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  14940. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  14941. {0, 0, 0, 0}
  14942. };
  14943. static struct PyGetSetDef __pyx_getsets_array[] = {
  14944. {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  14945. {0, 0, 0, 0, 0}
  14946. };
  14947. static PySequenceMethods __pyx_tp_as_sequence_array = {
  14948. __pyx_array___len__, /*sq_length*/
  14949. 0, /*sq_concat*/
  14950. 0, /*sq_repeat*/
  14951. __pyx_sq_item_array, /*sq_item*/
  14952. 0, /*sq_slice*/
  14953. 0, /*sq_ass_item*/
  14954. 0, /*sq_ass_slice*/
  14955. 0, /*sq_contains*/
  14956. 0, /*sq_inplace_concat*/
  14957. 0, /*sq_inplace_repeat*/
  14958. };
  14959. static PyMappingMethods __pyx_tp_as_mapping_array = {
  14960. __pyx_array___len__, /*mp_length*/
  14961. __pyx_array___getitem__, /*mp_subscript*/
  14962. __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
  14963. };
  14964. static PyBufferProcs __pyx_tp_as_buffer_array = {
  14965. #if PY_MAJOR_VERSION < 3
  14966. 0, /*bf_getreadbuffer*/
  14967. #endif
  14968. #if PY_MAJOR_VERSION < 3
  14969. 0, /*bf_getwritebuffer*/
  14970. #endif
  14971. #if PY_MAJOR_VERSION < 3
  14972. 0, /*bf_getsegcount*/
  14973. #endif
  14974. #if PY_MAJOR_VERSION < 3
  14975. 0, /*bf_getcharbuffer*/
  14976. #endif
  14977. __pyx_array_getbuffer, /*bf_getbuffer*/
  14978. 0, /*bf_releasebuffer*/
  14979. };
  14980. static PyTypeObject __pyx_type___pyx_array = {
  14981. PyVarObject_HEAD_INIT(0, 0)
  14982. "ArtNetProcessor_cy_pi.array", /*tp_name*/
  14983. sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  14984. 0, /*tp_itemsize*/
  14985. __pyx_tp_dealloc_array, /*tp_dealloc*/
  14986. #if PY_VERSION_HEX < 0x030800b4
  14987. 0, /*tp_print*/
  14988. #endif
  14989. #if PY_VERSION_HEX >= 0x030800b4
  14990. 0, /*tp_vectorcall_offset*/
  14991. #endif
  14992. 0, /*tp_getattr*/
  14993. 0, /*tp_setattr*/
  14994. #if PY_MAJOR_VERSION < 3
  14995. 0, /*tp_compare*/
  14996. #endif
  14997. #if PY_MAJOR_VERSION >= 3
  14998. 0, /*tp_as_async*/
  14999. #endif
  15000. 0, /*tp_repr*/
  15001. 0, /*tp_as_number*/
  15002. &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  15003. &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  15004. 0, /*tp_hash*/
  15005. 0, /*tp_call*/
  15006. 0, /*tp_str*/
  15007. __pyx_tp_getattro_array, /*tp_getattro*/
  15008. 0, /*tp_setattro*/
  15009. &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  15010. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  15011. 0, /*tp_doc*/
  15012. 0, /*tp_traverse*/
  15013. 0, /*tp_clear*/
  15014. 0, /*tp_richcompare*/
  15015. 0, /*tp_weaklistoffset*/
  15016. 0, /*tp_iter*/
  15017. 0, /*tp_iternext*/
  15018. __pyx_methods_array, /*tp_methods*/
  15019. 0, /*tp_members*/
  15020. __pyx_getsets_array, /*tp_getset*/
  15021. 0, /*tp_base*/
  15022. 0, /*tp_dict*/
  15023. 0, /*tp_descr_get*/
  15024. 0, /*tp_descr_set*/
  15025. 0, /*tp_dictoffset*/
  15026. 0, /*tp_init*/
  15027. 0, /*tp_alloc*/
  15028. __pyx_tp_new_array, /*tp_new*/
  15029. 0, /*tp_free*/
  15030. 0, /*tp_is_gc*/
  15031. 0, /*tp_bases*/
  15032. 0, /*tp_mro*/
  15033. 0, /*tp_cache*/
  15034. 0, /*tp_subclasses*/
  15035. 0, /*tp_weaklist*/
  15036. 0, /*tp_del*/
  15037. 0, /*tp_version_tag*/
  15038. #if PY_VERSION_HEX >= 0x030400a1
  15039. 0, /*tp_finalize*/
  15040. #endif
  15041. #if PY_VERSION_HEX >= 0x030800b1
  15042. 0, /*tp_vectorcall*/
  15043. #endif
  15044. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15045. 0, /*tp_print*/
  15046. #endif
  15047. };
  15048. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  15049. struct __pyx_MemviewEnum_obj *p;
  15050. PyObject *o;
  15051. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  15052. o = (*t->tp_alloc)(t, 0);
  15053. } else {
  15054. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  15055. }
  15056. if (unlikely(!o)) return 0;
  15057. p = ((struct __pyx_MemviewEnum_obj *)o);
  15058. p->name = Py_None; Py_INCREF(Py_None);
  15059. return o;
  15060. }
  15061. static void __pyx_tp_dealloc_Enum(PyObject *o) {
  15062. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15063. #if CYTHON_USE_TP_FINALIZE
  15064. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15065. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15066. }
  15067. #endif
  15068. PyObject_GC_UnTrack(o);
  15069. Py_CLEAR(p->name);
  15070. (*Py_TYPE(o)->tp_free)(o);
  15071. }
  15072. static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  15073. int e;
  15074. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15075. if (p->name) {
  15076. e = (*v)(p->name, a); if (e) return e;
  15077. }
  15078. return 0;
  15079. }
  15080. static int __pyx_tp_clear_Enum(PyObject *o) {
  15081. PyObject* tmp;
  15082. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15083. tmp = ((PyObject*)p->name);
  15084. p->name = Py_None; Py_INCREF(Py_None);
  15085. Py_XDECREF(tmp);
  15086. return 0;
  15087. }
  15088. static PyMethodDef __pyx_methods_Enum[] = {
  15089. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  15090. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  15091. {0, 0, 0, 0}
  15092. };
  15093. static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  15094. PyVarObject_HEAD_INIT(0, 0)
  15095. "ArtNetProcessor_cy_pi.Enum", /*tp_name*/
  15096. sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  15097. 0, /*tp_itemsize*/
  15098. __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  15099. #if PY_VERSION_HEX < 0x030800b4
  15100. 0, /*tp_print*/
  15101. #endif
  15102. #if PY_VERSION_HEX >= 0x030800b4
  15103. 0, /*tp_vectorcall_offset*/
  15104. #endif
  15105. 0, /*tp_getattr*/
  15106. 0, /*tp_setattr*/
  15107. #if PY_MAJOR_VERSION < 3
  15108. 0, /*tp_compare*/
  15109. #endif
  15110. #if PY_MAJOR_VERSION >= 3
  15111. 0, /*tp_as_async*/
  15112. #endif
  15113. __pyx_MemviewEnum___repr__, /*tp_repr*/
  15114. 0, /*tp_as_number*/
  15115. 0, /*tp_as_sequence*/
  15116. 0, /*tp_as_mapping*/
  15117. 0, /*tp_hash*/
  15118. 0, /*tp_call*/
  15119. 0, /*tp_str*/
  15120. 0, /*tp_getattro*/
  15121. 0, /*tp_setattro*/
  15122. 0, /*tp_as_buffer*/
  15123. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15124. 0, /*tp_doc*/
  15125. __pyx_tp_traverse_Enum, /*tp_traverse*/
  15126. __pyx_tp_clear_Enum, /*tp_clear*/
  15127. 0, /*tp_richcompare*/
  15128. 0, /*tp_weaklistoffset*/
  15129. 0, /*tp_iter*/
  15130. 0, /*tp_iternext*/
  15131. __pyx_methods_Enum, /*tp_methods*/
  15132. 0, /*tp_members*/
  15133. 0, /*tp_getset*/
  15134. 0, /*tp_base*/
  15135. 0, /*tp_dict*/
  15136. 0, /*tp_descr_get*/
  15137. 0, /*tp_descr_set*/
  15138. 0, /*tp_dictoffset*/
  15139. __pyx_MemviewEnum___init__, /*tp_init*/
  15140. 0, /*tp_alloc*/
  15141. __pyx_tp_new_Enum, /*tp_new*/
  15142. 0, /*tp_free*/
  15143. 0, /*tp_is_gc*/
  15144. 0, /*tp_bases*/
  15145. 0, /*tp_mro*/
  15146. 0, /*tp_cache*/
  15147. 0, /*tp_subclasses*/
  15148. 0, /*tp_weaklist*/
  15149. 0, /*tp_del*/
  15150. 0, /*tp_version_tag*/
  15151. #if PY_VERSION_HEX >= 0x030400a1
  15152. 0, /*tp_finalize*/
  15153. #endif
  15154. #if PY_VERSION_HEX >= 0x030800b1
  15155. 0, /*tp_vectorcall*/
  15156. #endif
  15157. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15158. 0, /*tp_print*/
  15159. #endif
  15160. };
  15161. static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
  15162. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  15163. struct __pyx_memoryview_obj *p;
  15164. PyObject *o;
  15165. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  15166. o = (*t->tp_alloc)(t, 0);
  15167. } else {
  15168. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  15169. }
  15170. if (unlikely(!o)) return 0;
  15171. p = ((struct __pyx_memoryview_obj *)o);
  15172. p->__pyx_vtab = __pyx_vtabptr_memoryview;
  15173. p->obj = Py_None; Py_INCREF(Py_None);
  15174. p->_size = Py_None; Py_INCREF(Py_None);
  15175. p->_array_interface = Py_None; Py_INCREF(Py_None);
  15176. p->view.obj = NULL;
  15177. if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  15178. return o;
  15179. bad:
  15180. Py_DECREF(o); o = 0;
  15181. return NULL;
  15182. }
  15183. static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  15184. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15185. #if CYTHON_USE_TP_FINALIZE
  15186. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15187. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15188. }
  15189. #endif
  15190. PyObject_GC_UnTrack(o);
  15191. {
  15192. PyObject *etype, *eval, *etb;
  15193. PyErr_Fetch(&etype, &eval, &etb);
  15194. __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
  15195. __pyx_memoryview___dealloc__(o);
  15196. __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
  15197. PyErr_Restore(etype, eval, etb);
  15198. }
  15199. Py_CLEAR(p->obj);
  15200. Py_CLEAR(p->_size);
  15201. Py_CLEAR(p->_array_interface);
  15202. (*Py_TYPE(o)->tp_free)(o);
  15203. }
  15204. static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  15205. int e;
  15206. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15207. if (p->obj) {
  15208. e = (*v)(p->obj, a); if (e) return e;
  15209. }
  15210. if (p->_size) {
  15211. e = (*v)(p->_size, a); if (e) return e;
  15212. }
  15213. if (p->_array_interface) {
  15214. e = (*v)(p->_array_interface, a); if (e) return e;
  15215. }
  15216. if (p->view.obj) {
  15217. e = (*v)(p->view.obj, a); if (e) return e;
  15218. }
  15219. return 0;
  15220. }
  15221. static int __pyx_tp_clear_memoryview(PyObject *o) {
  15222. PyObject* tmp;
  15223. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15224. tmp = ((PyObject*)p->obj);
  15225. p->obj = Py_None; Py_INCREF(Py_None);
  15226. Py_XDECREF(tmp);
  15227. tmp = ((PyObject*)p->_size);
  15228. p->_size = Py_None; Py_INCREF(Py_None);
  15229. Py_XDECREF(tmp);
  15230. tmp = ((PyObject*)p->_array_interface);
  15231. p->_array_interface = Py_None; Py_INCREF(Py_None);
  15232. Py_XDECREF(tmp);
  15233. Py_CLEAR(p->view.obj);
  15234. return 0;
  15235. }
  15236. static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  15237. PyObject *r;
  15238. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  15239. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  15240. Py_DECREF(x);
  15241. return r;
  15242. }
  15243. static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  15244. if (v) {
  15245. return __pyx_memoryview___setitem__(o, i, v);
  15246. }
  15247. else {
  15248. PyErr_Format(PyExc_NotImplementedError,
  15249. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  15250. return -1;
  15251. }
  15252. }
  15253. static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  15254. return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
  15255. }
  15256. static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  15257. return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
  15258. }
  15259. static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  15260. return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
  15261. }
  15262. static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  15263. return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
  15264. }
  15265. static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  15266. return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
  15267. }
  15268. static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  15269. return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
  15270. }
  15271. static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  15272. return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
  15273. }
  15274. static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  15275. return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
  15276. }
  15277. static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  15278. return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
  15279. }
  15280. static PyMethodDef __pyx_methods_memoryview[] = {
  15281. {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  15282. {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  15283. {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  15284. {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  15285. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  15286. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  15287. {0, 0, 0, 0}
  15288. };
  15289. static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  15290. {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  15291. {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  15292. {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  15293. {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  15294. {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  15295. {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  15296. {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  15297. {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  15298. {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  15299. {0, 0, 0, 0, 0}
  15300. };
  15301. static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  15302. __pyx_memoryview___len__, /*sq_length*/
  15303. 0, /*sq_concat*/
  15304. 0, /*sq_repeat*/
  15305. __pyx_sq_item_memoryview, /*sq_item*/
  15306. 0, /*sq_slice*/
  15307. 0, /*sq_ass_item*/
  15308. 0, /*sq_ass_slice*/
  15309. 0, /*sq_contains*/
  15310. 0, /*sq_inplace_concat*/
  15311. 0, /*sq_inplace_repeat*/
  15312. };
  15313. static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  15314. __pyx_memoryview___len__, /*mp_length*/
  15315. __pyx_memoryview___getitem__, /*mp_subscript*/
  15316. __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
  15317. };
  15318. static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  15319. #if PY_MAJOR_VERSION < 3
  15320. 0, /*bf_getreadbuffer*/
  15321. #endif
  15322. #if PY_MAJOR_VERSION < 3
  15323. 0, /*bf_getwritebuffer*/
  15324. #endif
  15325. #if PY_MAJOR_VERSION < 3
  15326. 0, /*bf_getsegcount*/
  15327. #endif
  15328. #if PY_MAJOR_VERSION < 3
  15329. 0, /*bf_getcharbuffer*/
  15330. #endif
  15331. __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  15332. 0, /*bf_releasebuffer*/
  15333. };
  15334. static PyTypeObject __pyx_type___pyx_memoryview = {
  15335. PyVarObject_HEAD_INIT(0, 0)
  15336. "ArtNetProcessor_cy_pi.memoryview", /*tp_name*/
  15337. sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  15338. 0, /*tp_itemsize*/
  15339. __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  15340. #if PY_VERSION_HEX < 0x030800b4
  15341. 0, /*tp_print*/
  15342. #endif
  15343. #if PY_VERSION_HEX >= 0x030800b4
  15344. 0, /*tp_vectorcall_offset*/
  15345. #endif
  15346. 0, /*tp_getattr*/
  15347. 0, /*tp_setattr*/
  15348. #if PY_MAJOR_VERSION < 3
  15349. 0, /*tp_compare*/
  15350. #endif
  15351. #if PY_MAJOR_VERSION >= 3
  15352. 0, /*tp_as_async*/
  15353. #endif
  15354. __pyx_memoryview___repr__, /*tp_repr*/
  15355. 0, /*tp_as_number*/
  15356. &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  15357. &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  15358. 0, /*tp_hash*/
  15359. 0, /*tp_call*/
  15360. __pyx_memoryview___str__, /*tp_str*/
  15361. 0, /*tp_getattro*/
  15362. 0, /*tp_setattro*/
  15363. &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  15364. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15365. 0, /*tp_doc*/
  15366. __pyx_tp_traverse_memoryview, /*tp_traverse*/
  15367. __pyx_tp_clear_memoryview, /*tp_clear*/
  15368. 0, /*tp_richcompare*/
  15369. 0, /*tp_weaklistoffset*/
  15370. 0, /*tp_iter*/
  15371. 0, /*tp_iternext*/
  15372. __pyx_methods_memoryview, /*tp_methods*/
  15373. 0, /*tp_members*/
  15374. __pyx_getsets_memoryview, /*tp_getset*/
  15375. 0, /*tp_base*/
  15376. 0, /*tp_dict*/
  15377. 0, /*tp_descr_get*/
  15378. 0, /*tp_descr_set*/
  15379. 0, /*tp_dictoffset*/
  15380. 0, /*tp_init*/
  15381. 0, /*tp_alloc*/
  15382. __pyx_tp_new_memoryview, /*tp_new*/
  15383. 0, /*tp_free*/
  15384. 0, /*tp_is_gc*/
  15385. 0, /*tp_bases*/
  15386. 0, /*tp_mro*/
  15387. 0, /*tp_cache*/
  15388. 0, /*tp_subclasses*/
  15389. 0, /*tp_weaklist*/
  15390. 0, /*tp_del*/
  15391. 0, /*tp_version_tag*/
  15392. #if PY_VERSION_HEX >= 0x030400a1
  15393. 0, /*tp_finalize*/
  15394. #endif
  15395. #if PY_VERSION_HEX >= 0x030800b1
  15396. 0, /*tp_vectorcall*/
  15397. #endif
  15398. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15399. 0, /*tp_print*/
  15400. #endif
  15401. };
  15402. static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
  15403. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  15404. struct __pyx_memoryviewslice_obj *p;
  15405. PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  15406. if (unlikely(!o)) return 0;
  15407. p = ((struct __pyx_memoryviewslice_obj *)o);
  15408. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  15409. p->from_object = Py_None; Py_INCREF(Py_None);
  15410. p->from_slice.memview = NULL;
  15411. return o;
  15412. }
  15413. static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  15414. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15415. #if CYTHON_USE_TP_FINALIZE
  15416. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15417. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15418. }
  15419. #endif
  15420. PyObject_GC_UnTrack(o);
  15421. {
  15422. PyObject *etype, *eval, *etb;
  15423. PyErr_Fetch(&etype, &eval, &etb);
  15424. __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
  15425. __pyx_memoryviewslice___dealloc__(o);
  15426. __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
  15427. PyErr_Restore(etype, eval, etb);
  15428. }
  15429. Py_CLEAR(p->from_object);
  15430. PyObject_GC_Track(o);
  15431. __pyx_tp_dealloc_memoryview(o);
  15432. }
  15433. static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  15434. int e;
  15435. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15436. e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  15437. if (p->from_object) {
  15438. e = (*v)(p->from_object, a); if (e) return e;
  15439. }
  15440. return 0;
  15441. }
  15442. static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  15443. PyObject* tmp;
  15444. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15445. __pyx_tp_clear_memoryview(o);
  15446. tmp = ((PyObject*)p->from_object);
  15447. p->from_object = Py_None; Py_INCREF(Py_None);
  15448. Py_XDECREF(tmp);
  15449. __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  15450. return 0;
  15451. }
  15452. static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  15453. return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
  15454. }
  15455. static PyMethodDef __pyx_methods__memoryviewslice[] = {
  15456. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  15457. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  15458. {0, 0, 0, 0}
  15459. };
  15460. static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  15461. {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  15462. {0, 0, 0, 0, 0}
  15463. };
  15464. static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  15465. PyVarObject_HEAD_INIT(0, 0)
  15466. "ArtNetProcessor_cy_pi._memoryviewslice", /*tp_name*/
  15467. sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  15468. 0, /*tp_itemsize*/
  15469. __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  15470. #if PY_VERSION_HEX < 0x030800b4
  15471. 0, /*tp_print*/
  15472. #endif
  15473. #if PY_VERSION_HEX >= 0x030800b4
  15474. 0, /*tp_vectorcall_offset*/
  15475. #endif
  15476. 0, /*tp_getattr*/
  15477. 0, /*tp_setattr*/
  15478. #if PY_MAJOR_VERSION < 3
  15479. 0, /*tp_compare*/
  15480. #endif
  15481. #if PY_MAJOR_VERSION >= 3
  15482. 0, /*tp_as_async*/
  15483. #endif
  15484. #if CYTHON_COMPILING_IN_PYPY
  15485. __pyx_memoryview___repr__, /*tp_repr*/
  15486. #else
  15487. 0, /*tp_repr*/
  15488. #endif
  15489. 0, /*tp_as_number*/
  15490. 0, /*tp_as_sequence*/
  15491. 0, /*tp_as_mapping*/
  15492. 0, /*tp_hash*/
  15493. 0, /*tp_call*/
  15494. #if CYTHON_COMPILING_IN_PYPY
  15495. __pyx_memoryview___str__, /*tp_str*/
  15496. #else
  15497. 0, /*tp_str*/
  15498. #endif
  15499. 0, /*tp_getattro*/
  15500. 0, /*tp_setattro*/
  15501. 0, /*tp_as_buffer*/
  15502. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15503. "Internal class for passing memoryview slices to Python", /*tp_doc*/
  15504. __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  15505. __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  15506. 0, /*tp_richcompare*/
  15507. 0, /*tp_weaklistoffset*/
  15508. 0, /*tp_iter*/
  15509. 0, /*tp_iternext*/
  15510. __pyx_methods__memoryviewslice, /*tp_methods*/
  15511. 0, /*tp_members*/
  15512. __pyx_getsets__memoryviewslice, /*tp_getset*/
  15513. 0, /*tp_base*/
  15514. 0, /*tp_dict*/
  15515. 0, /*tp_descr_get*/
  15516. 0, /*tp_descr_set*/
  15517. 0, /*tp_dictoffset*/
  15518. 0, /*tp_init*/
  15519. 0, /*tp_alloc*/
  15520. __pyx_tp_new__memoryviewslice, /*tp_new*/
  15521. 0, /*tp_free*/
  15522. 0, /*tp_is_gc*/
  15523. 0, /*tp_bases*/
  15524. 0, /*tp_mro*/
  15525. 0, /*tp_cache*/
  15526. 0, /*tp_subclasses*/
  15527. 0, /*tp_weaklist*/
  15528. 0, /*tp_del*/
  15529. 0, /*tp_version_tag*/
  15530. #if PY_VERSION_HEX >= 0x030400a1
  15531. 0, /*tp_finalize*/
  15532. #endif
  15533. #if PY_VERSION_HEX >= 0x030800b1
  15534. 0, /*tp_vectorcall*/
  15535. #endif
  15536. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15537. 0, /*tp_print*/
  15538. #endif
  15539. };
  15540. static PyMethodDef __pyx_methods[] = {
  15541. {0, 0, 0, 0}
  15542. };
  15543. #if PY_MAJOR_VERSION >= 3
  15544. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15545. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  15546. static int __pyx_pymod_exec_ArtNetProcessor_cy_pi(PyObject* module); /*proto*/
  15547. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  15548. {Py_mod_create, (void*)__pyx_pymod_create},
  15549. {Py_mod_exec, (void*)__pyx_pymod_exec_ArtNetProcessor_cy_pi},
  15550. {0, NULL}
  15551. };
  15552. #endif
  15553. static struct PyModuleDef __pyx_moduledef = {
  15554. PyModuleDef_HEAD_INIT,
  15555. "ArtNetProcessor_cy_pi",
  15556. 0, /* m_doc */
  15557. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15558. 0, /* m_size */
  15559. #else
  15560. -1, /* m_size */
  15561. #endif
  15562. __pyx_methods /* m_methods */,
  15563. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15564. __pyx_moduledef_slots, /* m_slots */
  15565. #else
  15566. NULL, /* m_reload */
  15567. #endif
  15568. NULL, /* m_traverse */
  15569. NULL, /* m_clear */
  15570. NULL /* m_free */
  15571. };
  15572. #endif
  15573. #ifndef CYTHON_SMALL_CODE
  15574. #if defined(__clang__)
  15575. #define CYTHON_SMALL_CODE
  15576. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  15577. #define CYTHON_SMALL_CODE __attribute__((cold))
  15578. #else
  15579. #define CYTHON_SMALL_CODE
  15580. #endif
  15581. #endif
  15582. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  15583. {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  15584. {&__pyx_n_s_ArtNetProcessor_cy_pi, __pyx_k_ArtNetProcessor_cy_pi, sizeof(__pyx_k_ArtNetProcessor_cy_pi), 0, 0, 1, 1},
  15585. {&__pyx_kp_s_ArtNetProcessor_cy_pi_pyx, __pyx_k_ArtNetProcessor_cy_pi_pyx, sizeof(__pyx_k_ArtNetProcessor_cy_pi_pyx), 0, 0, 1, 0},
  15586. {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
  15587. {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
  15588. {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
  15589. {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
  15590. {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
  15591. {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  15592. {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
  15593. {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
  15594. {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  15595. {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  15596. {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
  15597. {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
  15598. {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  15599. {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
  15600. {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  15601. {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  15602. {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
  15603. {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  15604. {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  15605. {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
  15606. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  15607. {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  15608. {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  15609. {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  15610. {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  15611. {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  15612. {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  15613. {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  15614. {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  15615. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  15616. {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  15617. {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  15618. {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  15619. {&__pyx_n_s_dmx, __pyx_k_dmx, sizeof(__pyx_k_dmx), 0, 0, 1, 1},
  15620. {&__pyx_n_s_dmxnew, __pyx_k_dmxnew, sizeof(__pyx_k_dmxnew), 0, 0, 1, 1},
  15621. {&__pyx_n_s_dmxold, __pyx_k_dmxold, sizeof(__pyx_k_dmxold), 0, 0, 1, 1},
  15622. {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  15623. {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  15624. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  15625. {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  15626. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  15627. {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  15628. {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  15629. {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  15630. {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  15631. {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
  15632. {&__pyx_n_s_hostindex, __pyx_k_hostindex, sizeof(__pyx_k_hostindex), 0, 0, 1, 1},
  15633. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  15634. {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  15635. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  15636. {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  15637. {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
  15638. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  15639. {&__pyx_n_s_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 0, 0, 1, 1},
  15640. {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  15641. {&__pyx_n_s_merge, __pyx_k_merge, sizeof(__pyx_k_merge), 0, 0, 1, 1},
  15642. {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  15643. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  15644. {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  15645. {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  15646. {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  15647. {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  15648. {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  15649. {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  15650. {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  15651. {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  15652. {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  15653. {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  15654. {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  15655. {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  15656. {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  15657. {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  15658. {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  15659. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  15660. {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  15661. {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  15662. {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  15663. {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  15664. {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  15665. {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  15666. {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  15667. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  15668. {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  15669. {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  15670. {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  15671. {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
  15672. {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  15673. {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  15674. {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  15675. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  15676. {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
  15677. {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
  15678. {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  15679. {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  15680. {&__pyx_n_s_update_flag, __pyx_k_update_flag, sizeof(__pyx_k_update_flag), 0, 0, 1, 1},
  15681. {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  15682. {0, 0, 0, 0, 0, 0, 0}
  15683. };
  15684. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  15685. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 11, __pyx_L1_error)
  15686. __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 109, __pyx_L1_error)
  15687. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error)
  15688. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(2, 180, __pyx_L1_error)
  15689. __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
  15690. __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
  15691. __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
  15692. __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
  15693. return 0;
  15694. __pyx_L1_error:;
  15695. return -1;
  15696. }
  15697. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  15698. __Pyx_RefNannyDeclarations
  15699. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  15700. /* "View.MemoryView":133
  15701. *
  15702. * if not self.ndim:
  15703. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  15704. *
  15705. * if itemsize <= 0:
  15706. */
  15707. __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple_)) __PYX_ERR(2, 133, __pyx_L1_error)
  15708. __Pyx_GOTREF(__pyx_tuple_);
  15709. __Pyx_GIVEREF(__pyx_tuple_);
  15710. /* "View.MemoryView":136
  15711. *
  15712. * if itemsize <= 0:
  15713. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  15714. *
  15715. * if not isinstance(format, bytes):
  15716. */
  15717. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(2, 136, __pyx_L1_error)
  15718. __Pyx_GOTREF(__pyx_tuple__2);
  15719. __Pyx_GIVEREF(__pyx_tuple__2);
  15720. /* "View.MemoryView":148
  15721. *
  15722. * if not self._shape:
  15723. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  15724. *
  15725. *
  15726. */
  15727. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 148, __pyx_L1_error)
  15728. __Pyx_GOTREF(__pyx_tuple__3);
  15729. __Pyx_GIVEREF(__pyx_tuple__3);
  15730. /* "View.MemoryView":176
  15731. * self.data = <char *>malloc(self.len)
  15732. * if not self.data:
  15733. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  15734. *
  15735. * if self.dtype_is_object:
  15736. */
  15737. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 176, __pyx_L1_error)
  15738. __Pyx_GOTREF(__pyx_tuple__4);
  15739. __Pyx_GIVEREF(__pyx_tuple__4);
  15740. /* "View.MemoryView":192
  15741. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  15742. * if not (flags & bufmode):
  15743. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  15744. * info.buf = self.data
  15745. * info.len = self.len
  15746. */
  15747. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 192, __pyx_L1_error)
  15748. __Pyx_GOTREF(__pyx_tuple__5);
  15749. __Pyx_GIVEREF(__pyx_tuple__5);
  15750. /* "(tree fragment)":2
  15751. * def __reduce_cython__(self):
  15752. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15753. * def __setstate_cython__(self, __pyx_state):
  15754. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15755. */
  15756. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 2, __pyx_L1_error)
  15757. __Pyx_GOTREF(__pyx_tuple__6);
  15758. __Pyx_GIVEREF(__pyx_tuple__6);
  15759. /* "(tree fragment)":4
  15760. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15761. * def __setstate_cython__(self, __pyx_state):
  15762. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15763. */
  15764. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 4, __pyx_L1_error)
  15765. __Pyx_GOTREF(__pyx_tuple__7);
  15766. __Pyx_GIVEREF(__pyx_tuple__7);
  15767. /* "View.MemoryView":418
  15768. * def __setitem__(memoryview self, object index, object value):
  15769. * if self.view.readonly:
  15770. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  15771. *
  15772. * have_slices, index = _unellipsify(index, self.view.ndim)
  15773. */
  15774. __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 418, __pyx_L1_error)
  15775. __Pyx_GOTREF(__pyx_tuple__8);
  15776. __Pyx_GIVEREF(__pyx_tuple__8);
  15777. /* "View.MemoryView":495
  15778. * result = struct.unpack(self.view.format, bytesitem)
  15779. * except struct.error:
  15780. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  15781. * else:
  15782. * if len(self.view.format) == 1:
  15783. */
  15784. __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 495, __pyx_L1_error)
  15785. __Pyx_GOTREF(__pyx_tuple__9);
  15786. __Pyx_GIVEREF(__pyx_tuple__9);
  15787. /* "View.MemoryView":520
  15788. * def __getbuffer__(self, Py_buffer *info, int flags):
  15789. * if flags & PyBUF_WRITABLE and self.view.readonly:
  15790. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  15791. *
  15792. * if flags & PyBUF_ND:
  15793. */
  15794. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 520, __pyx_L1_error)
  15795. __Pyx_GOTREF(__pyx_tuple__10);
  15796. __Pyx_GIVEREF(__pyx_tuple__10);
  15797. /* "View.MemoryView":570
  15798. * if self.view.strides == NULL:
  15799. *
  15800. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  15801. *
  15802. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  15803. */
  15804. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 570, __pyx_L1_error)
  15805. __Pyx_GOTREF(__pyx_tuple__11);
  15806. __Pyx_GIVEREF(__pyx_tuple__11);
  15807. /* "View.MemoryView":577
  15808. * def suboffsets(self):
  15809. * if self.view.suboffsets == NULL:
  15810. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  15811. *
  15812. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  15813. */
  15814. __pyx_tuple__12 = PyTuple_New(1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 577, __pyx_L1_error)
  15815. __Pyx_GOTREF(__pyx_tuple__12);
  15816. __Pyx_INCREF(__pyx_int_neg_1);
  15817. __Pyx_GIVEREF(__pyx_int_neg_1);
  15818. PyTuple_SET_ITEM(__pyx_tuple__12, 0, __pyx_int_neg_1);
  15819. __Pyx_GIVEREF(__pyx_tuple__12);
  15820. /* "(tree fragment)":2
  15821. * def __reduce_cython__(self):
  15822. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15823. * def __setstate_cython__(self, __pyx_state):
  15824. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15825. */
  15826. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 2, __pyx_L1_error)
  15827. __Pyx_GOTREF(__pyx_tuple__13);
  15828. __Pyx_GIVEREF(__pyx_tuple__13);
  15829. /* "(tree fragment)":4
  15830. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15831. * def __setstate_cython__(self, __pyx_state):
  15832. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15833. */
  15834. __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 4, __pyx_L1_error)
  15835. __Pyx_GOTREF(__pyx_tuple__14);
  15836. __Pyx_GIVEREF(__pyx_tuple__14);
  15837. /* "View.MemoryView":682
  15838. * if item is Ellipsis:
  15839. * if not seen_ellipsis:
  15840. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  15841. * seen_ellipsis = True
  15842. * else:
  15843. */
  15844. __pyx_slice__15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(2, 682, __pyx_L1_error)
  15845. __Pyx_GOTREF(__pyx_slice__15);
  15846. __Pyx_GIVEREF(__pyx_slice__15);
  15847. /* "View.MemoryView":703
  15848. * for suboffset in suboffsets[:ndim]:
  15849. * if suboffset >= 0:
  15850. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  15851. *
  15852. *
  15853. */
  15854. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 703, __pyx_L1_error)
  15855. __Pyx_GOTREF(__pyx_tuple__16);
  15856. __Pyx_GIVEREF(__pyx_tuple__16);
  15857. /* "(tree fragment)":2
  15858. * def __reduce_cython__(self):
  15859. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15860. * def __setstate_cython__(self, __pyx_state):
  15861. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15862. */
  15863. __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error)
  15864. __Pyx_GOTREF(__pyx_tuple__17);
  15865. __Pyx_GIVEREF(__pyx_tuple__17);
  15866. /* "(tree fragment)":4
  15867. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15868. * def __setstate_cython__(self, __pyx_state):
  15869. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15870. */
  15871. __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error)
  15872. __Pyx_GOTREF(__pyx_tuple__18);
  15873. __Pyx_GIVEREF(__pyx_tuple__18);
  15874. /* "ArtNetProcessor_cy_pi.pyx":4
  15875. * import array
  15876. *
  15877. * def merge( dmxold, dmxnew , matrix, hostindex): # <<<<<<<<<<<<<<
  15878. * cdef int i = 0
  15879. * cdef int v = 0
  15880. */
  15881. __pyx_tuple__19 = PyTuple_Pack(9, __pyx_n_s_dmxold, __pyx_n_s_dmxnew, __pyx_n_s_matrix, __pyx_n_s_hostindex, __pyx_n_s_i, __pyx_n_s_v, __pyx_n_s_update_flag, __pyx_n_s_a, __pyx_n_s_dmx); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 4, __pyx_L1_error)
  15882. __Pyx_GOTREF(__pyx_tuple__19);
  15883. __Pyx_GIVEREF(__pyx_tuple__19);
  15884. __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ArtNetProcessor_cy_pi_pyx, __pyx_n_s_merge, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 4, __pyx_L1_error)
  15885. /* "View.MemoryView":286
  15886. * return self.name
  15887. *
  15888. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  15889. * cdef strided = Enum("<strided and direct>") # default
  15890. * cdef indirect = Enum("<strided and indirect>")
  15891. */
  15892. __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 286, __pyx_L1_error)
  15893. __Pyx_GOTREF(__pyx_tuple__21);
  15894. __Pyx_GIVEREF(__pyx_tuple__21);
  15895. /* "View.MemoryView":287
  15896. *
  15897. * cdef generic = Enum("<strided and direct or indirect>")
  15898. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  15899. * cdef indirect = Enum("<strided and indirect>")
  15900. *
  15901. */
  15902. __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 287, __pyx_L1_error)
  15903. __Pyx_GOTREF(__pyx_tuple__22);
  15904. __Pyx_GIVEREF(__pyx_tuple__22);
  15905. /* "View.MemoryView":288
  15906. * cdef generic = Enum("<strided and direct or indirect>")
  15907. * cdef strided = Enum("<strided and direct>") # default
  15908. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  15909. *
  15910. *
  15911. */
  15912. __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 288, __pyx_L1_error)
  15913. __Pyx_GOTREF(__pyx_tuple__23);
  15914. __Pyx_GIVEREF(__pyx_tuple__23);
  15915. /* "View.MemoryView":291
  15916. *
  15917. *
  15918. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  15919. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  15920. *
  15921. */
  15922. __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 291, __pyx_L1_error)
  15923. __Pyx_GOTREF(__pyx_tuple__24);
  15924. __Pyx_GIVEREF(__pyx_tuple__24);
  15925. /* "View.MemoryView":292
  15926. *
  15927. * cdef contiguous = Enum("<contiguous and direct>")
  15928. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  15929. *
  15930. *
  15931. */
  15932. __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 292, __pyx_L1_error)
  15933. __Pyx_GOTREF(__pyx_tuple__25);
  15934. __Pyx_GIVEREF(__pyx_tuple__25);
  15935. /* "(tree fragment)":1
  15936. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  15937. * cdef object __pyx_PickleError
  15938. * cdef object __pyx_result
  15939. */
  15940. __pyx_tuple__26 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 1, __pyx_L1_error)
  15941. __Pyx_GOTREF(__pyx_tuple__26);
  15942. __Pyx_GIVEREF(__pyx_tuple__26);
  15943. __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(2, 1, __pyx_L1_error)
  15944. __Pyx_RefNannyFinishContext();
  15945. return 0;
  15946. __pyx_L1_error:;
  15947. __Pyx_RefNannyFinishContext();
  15948. return -1;
  15949. }
  15950. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  15951. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  15952. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  15953. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  15954. __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
  15955. __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  15956. return 0;
  15957. __pyx_L1_error:;
  15958. return -1;
  15959. }
  15960. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  15961. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  15962. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  15963. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  15964. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  15965. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  15966. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  15967. static int __Pyx_modinit_global_init_code(void) {
  15968. __Pyx_RefNannyDeclarations
  15969. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  15970. /*--- Global init code ---*/
  15971. generic = Py_None; Py_INCREF(Py_None);
  15972. strided = Py_None; Py_INCREF(Py_None);
  15973. indirect = Py_None; Py_INCREF(Py_None);
  15974. contiguous = Py_None; Py_INCREF(Py_None);
  15975. indirect_contiguous = Py_None; Py_INCREF(Py_None);
  15976. __Pyx_RefNannyFinishContext();
  15977. return 0;
  15978. }
  15979. static int __Pyx_modinit_variable_export_code(void) {
  15980. __Pyx_RefNannyDeclarations
  15981. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  15982. /*--- Variable export code ---*/
  15983. __Pyx_RefNannyFinishContext();
  15984. return 0;
  15985. }
  15986. static int __Pyx_modinit_function_export_code(void) {
  15987. __Pyx_RefNannyDeclarations
  15988. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  15989. /*--- Function export code ---*/
  15990. __Pyx_RefNannyFinishContext();
  15991. return 0;
  15992. }
  15993. static int __Pyx_modinit_type_init_code(void) {
  15994. __Pyx_RefNannyDeclarations
  15995. int __pyx_lineno = 0;
  15996. const char *__pyx_filename = NULL;
  15997. int __pyx_clineno = 0;
  15998. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  15999. /*--- Type init code ---*/
  16000. __pyx_vtabptr_array = &__pyx_vtable_array;
  16001. __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  16002. if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  16003. #if PY_VERSION_HEX < 0x030800B1
  16004. __pyx_type___pyx_array.tp_print = 0;
  16005. #endif
  16006. if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  16007. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  16008. __pyx_array_type = &__pyx_type___pyx_array;
  16009. if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
  16010. #if PY_VERSION_HEX < 0x030800B1
  16011. __pyx_type___pyx_MemviewEnum.tp_print = 0;
  16012. #endif
  16013. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
  16014. __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16015. }
  16016. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
  16017. __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  16018. __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  16019. __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  16020. __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  16021. __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  16022. __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  16023. __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  16024. __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  16025. __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  16026. if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  16027. #if PY_VERSION_HEX < 0x030800B1
  16028. __pyx_type___pyx_memoryview.tp_print = 0;
  16029. #endif
  16030. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
  16031. __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16032. }
  16033. if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  16034. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  16035. __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  16036. __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  16037. __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  16038. __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  16039. __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  16040. __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  16041. if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  16042. #if PY_VERSION_HEX < 0x030800B1
  16043. __pyx_type___pyx_memoryviewslice.tp_print = 0;
  16044. #endif
  16045. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
  16046. __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16047. }
  16048. if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  16049. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  16050. __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  16051. __Pyx_RefNannyFinishContext();
  16052. return 0;
  16053. __pyx_L1_error:;
  16054. __Pyx_RefNannyFinishContext();
  16055. return -1;
  16056. }
  16057. static int __Pyx_modinit_type_import_code(void) {
  16058. __Pyx_RefNannyDeclarations
  16059. PyObject *__pyx_t_1 = NULL;
  16060. int __pyx_lineno = 0;
  16061. const char *__pyx_filename = NULL;
  16062. int __pyx_clineno = 0;
  16063. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  16064. /*--- Type import code ---*/
  16065. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  16066. __Pyx_GOTREF(__pyx_t_1);
  16067. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  16068. #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  16069. sizeof(PyTypeObject),
  16070. #else
  16071. sizeof(PyHeapTypeObject),
  16072. #endif
  16073. __Pyx_ImportType_CheckSize_Warn);
  16074. if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  16075. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16076. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
  16077. __Pyx_GOTREF(__pyx_t_1);
  16078. __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
  16079. if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error)
  16080. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16081. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error)
  16082. __Pyx_GOTREF(__pyx_t_1);
  16083. __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
  16084. if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error)
  16085. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16086. __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 58, __pyx_L1_error)
  16087. __Pyx_GOTREF(__pyx_t_1);
  16088. __pyx_ptype_7cpython_5array_array = __Pyx_ImportType(__pyx_t_1, "array", "array", sizeof(arrayobject), __Pyx_ImportType_CheckSize_Warn);
  16089. if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(1, 58, __pyx_L1_error)
  16090. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16091. __Pyx_RefNannyFinishContext();
  16092. return 0;
  16093. __pyx_L1_error:;
  16094. __Pyx_XDECREF(__pyx_t_1);
  16095. __Pyx_RefNannyFinishContext();
  16096. return -1;
  16097. }
  16098. static int __Pyx_modinit_variable_import_code(void) {
  16099. __Pyx_RefNannyDeclarations
  16100. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  16101. /*--- Variable import code ---*/
  16102. __Pyx_RefNannyFinishContext();
  16103. return 0;
  16104. }
  16105. static int __Pyx_modinit_function_import_code(void) {
  16106. __Pyx_RefNannyDeclarations
  16107. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  16108. /*--- Function import code ---*/
  16109. __Pyx_RefNannyFinishContext();
  16110. return 0;
  16111. }
  16112. #ifndef CYTHON_NO_PYINIT_EXPORT
  16113. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  16114. #elif PY_MAJOR_VERSION < 3
  16115. #ifdef __cplusplus
  16116. #define __Pyx_PyMODINIT_FUNC extern "C" void
  16117. #else
  16118. #define __Pyx_PyMODINIT_FUNC void
  16119. #endif
  16120. #else
  16121. #ifdef __cplusplus
  16122. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  16123. #else
  16124. #define __Pyx_PyMODINIT_FUNC PyObject *
  16125. #endif
  16126. #endif
  16127. #if PY_MAJOR_VERSION < 3
  16128. __Pyx_PyMODINIT_FUNC initArtNetProcessor_cy_pi(void) CYTHON_SMALL_CODE; /*proto*/
  16129. __Pyx_PyMODINIT_FUNC initArtNetProcessor_cy_pi(void)
  16130. #else
  16131. __Pyx_PyMODINIT_FUNC PyInit_ArtNetProcessor_cy_pi(void) CYTHON_SMALL_CODE; /*proto*/
  16132. __Pyx_PyMODINIT_FUNC PyInit_ArtNetProcessor_cy_pi(void)
  16133. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16134. {
  16135. return PyModuleDef_Init(&__pyx_moduledef);
  16136. }
  16137. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  16138. #if PY_VERSION_HEX >= 0x030700A1
  16139. static PY_INT64_T main_interpreter_id = -1;
  16140. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  16141. if (main_interpreter_id == -1) {
  16142. main_interpreter_id = current_id;
  16143. return (unlikely(current_id == -1)) ? -1 : 0;
  16144. } else if (unlikely(main_interpreter_id != current_id))
  16145. #else
  16146. static PyInterpreterState *main_interpreter = NULL;
  16147. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  16148. if (!main_interpreter) {
  16149. main_interpreter = current_interpreter;
  16150. } else if (unlikely(main_interpreter != current_interpreter))
  16151. #endif
  16152. {
  16153. PyErr_SetString(
  16154. PyExc_ImportError,
  16155. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  16156. return -1;
  16157. }
  16158. return 0;
  16159. }
  16160. 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) {
  16161. PyObject *value = PyObject_GetAttrString(spec, from_name);
  16162. int result = 0;
  16163. if (likely(value)) {
  16164. if (allow_none || value != Py_None) {
  16165. result = PyDict_SetItemString(moddict, to_name, value);
  16166. }
  16167. Py_DECREF(value);
  16168. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  16169. PyErr_Clear();
  16170. } else {
  16171. result = -1;
  16172. }
  16173. return result;
  16174. }
  16175. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  16176. PyObject *module = NULL, *moddict, *modname;
  16177. if (__Pyx_check_single_interpreter())
  16178. return NULL;
  16179. if (__pyx_m)
  16180. return __Pyx_NewRef(__pyx_m);
  16181. modname = PyObject_GetAttrString(spec, "name");
  16182. if (unlikely(!modname)) goto bad;
  16183. module = PyModule_NewObject(modname);
  16184. Py_DECREF(modname);
  16185. if (unlikely(!module)) goto bad;
  16186. moddict = PyModule_GetDict(module);
  16187. if (unlikely(!moddict)) goto bad;
  16188. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  16189. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  16190. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  16191. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  16192. return module;
  16193. bad:
  16194. Py_XDECREF(module);
  16195. return NULL;
  16196. }
  16197. static CYTHON_SMALL_CODE int __pyx_pymod_exec_ArtNetProcessor_cy_pi(PyObject *__pyx_pyinit_module)
  16198. #endif
  16199. #endif
  16200. {
  16201. PyObject *__pyx_t_1 = NULL;
  16202. static PyThread_type_lock __pyx_t_2[8];
  16203. int __pyx_lineno = 0;
  16204. const char *__pyx_filename = NULL;
  16205. int __pyx_clineno = 0;
  16206. __Pyx_RefNannyDeclarations
  16207. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16208. if (__pyx_m) {
  16209. if (__pyx_m == __pyx_pyinit_module) return 0;
  16210. PyErr_SetString(PyExc_RuntimeError, "Module 'ArtNetProcessor_cy_pi' has already been imported. Re-initialisation is not supported.");
  16211. return -1;
  16212. }
  16213. #elif PY_MAJOR_VERSION >= 3
  16214. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  16215. #endif
  16216. #if CYTHON_REFNANNY
  16217. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  16218. if (!__Pyx_RefNanny) {
  16219. PyErr_Clear();
  16220. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  16221. if (!__Pyx_RefNanny)
  16222. Py_FatalError("failed to import 'refnanny' module");
  16223. }
  16224. #endif
  16225. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_ArtNetProcessor_cy_pi(void)", 0);
  16226. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16227. #ifdef __Pxy_PyFrame_Initialize_Offsets
  16228. __Pxy_PyFrame_Initialize_Offsets();
  16229. #endif
  16230. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  16231. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  16232. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  16233. #ifdef __Pyx_CyFunction_USED
  16234. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16235. #endif
  16236. #ifdef __Pyx_FusedFunction_USED
  16237. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16238. #endif
  16239. #ifdef __Pyx_Coroutine_USED
  16240. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16241. #endif
  16242. #ifdef __Pyx_Generator_USED
  16243. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16244. #endif
  16245. #ifdef __Pyx_AsyncGen_USED
  16246. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16247. #endif
  16248. #ifdef __Pyx_StopAsyncIteration_USED
  16249. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16250. #endif
  16251. /*--- Library function declarations ---*/
  16252. /*--- Threads initialization code ---*/
  16253. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  16254. #ifdef WITH_THREAD /* Python build with threading support? */
  16255. PyEval_InitThreads();
  16256. #endif
  16257. #endif
  16258. /*--- Module creation code ---*/
  16259. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16260. __pyx_m = __pyx_pyinit_module;
  16261. Py_INCREF(__pyx_m);
  16262. #else
  16263. #if PY_MAJOR_VERSION < 3
  16264. __pyx_m = Py_InitModule4("ArtNetProcessor_cy_pi", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  16265. #else
  16266. __pyx_m = PyModule_Create(&__pyx_moduledef);
  16267. #endif
  16268. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  16269. #endif
  16270. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  16271. Py_INCREF(__pyx_d);
  16272. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  16273. Py_INCREF(__pyx_b);
  16274. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  16275. Py_INCREF(__pyx_cython_runtime);
  16276. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  16277. /*--- Initialize various global constants etc. ---*/
  16278. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16279. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  16280. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16281. #endif
  16282. if (__pyx_module_is_main_ArtNetProcessor_cy_pi) {
  16283. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16284. }
  16285. #if PY_MAJOR_VERSION >= 3
  16286. {
  16287. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  16288. if (!PyDict_GetItemString(modules, "ArtNetProcessor_cy_pi")) {
  16289. if (unlikely(PyDict_SetItemString(modules, "ArtNetProcessor_cy_pi", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  16290. }
  16291. }
  16292. #endif
  16293. /*--- Builtin init code ---*/
  16294. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16295. /*--- Constants init code ---*/
  16296. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16297. /*--- Global type/function init code ---*/
  16298. (void)__Pyx_modinit_global_init_code();
  16299. (void)__Pyx_modinit_variable_export_code();
  16300. (void)__Pyx_modinit_function_export_code();
  16301. if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  16302. if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  16303. (void)__Pyx_modinit_variable_import_code();
  16304. (void)__Pyx_modinit_function_import_code();
  16305. /*--- Execution code ---*/
  16306. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  16307. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16308. #endif
  16309. /* "ArtNetProcessor_cy_pi.pyx":2
  16310. * from cpython cimport array
  16311. * import array # <<<<<<<<<<<<<<
  16312. *
  16313. * def merge( dmxold, dmxnew , matrix, hostindex):
  16314. */
  16315. __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  16316. __Pyx_GOTREF(__pyx_t_1);
  16317. if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  16318. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16319. /* "ArtNetProcessor_cy_pi.pyx":4
  16320. * import array
  16321. *
  16322. * def merge( dmxold, dmxnew , matrix, hostindex): # <<<<<<<<<<<<<<
  16323. * cdef int i = 0
  16324. * cdef int v = 0
  16325. */
  16326. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_21ArtNetProcessor_cy_pi_1merge, NULL, __pyx_n_s_ArtNetProcessor_cy_pi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  16327. __Pyx_GOTREF(__pyx_t_1);
  16328. if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  16329. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16330. /* "ArtNetProcessor_cy_pi.pyx":1
  16331. * from cpython cimport array # <<<<<<<<<<<<<<
  16332. * import array
  16333. *
  16334. */
  16335. __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  16336. __Pyx_GOTREF(__pyx_t_1);
  16337. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16338. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16339. /* "View.MemoryView":209
  16340. * info.obj = self
  16341. *
  16342. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  16343. *
  16344. * def __dealloc__(array self):
  16345. */
  16346. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
  16347. __Pyx_GOTREF(__pyx_t_1);
  16348. if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
  16349. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16350. PyType_Modified(__pyx_array_type);
  16351. /* "View.MemoryView":286
  16352. * return self.name
  16353. *
  16354. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  16355. * cdef strided = Enum("<strided and direct>") # default
  16356. * cdef indirect = Enum("<strided and indirect>")
  16357. */
  16358. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
  16359. __Pyx_GOTREF(__pyx_t_1);
  16360. __Pyx_XGOTREF(generic);
  16361. __Pyx_DECREF_SET(generic, __pyx_t_1);
  16362. __Pyx_GIVEREF(__pyx_t_1);
  16363. __pyx_t_1 = 0;
  16364. /* "View.MemoryView":287
  16365. *
  16366. * cdef generic = Enum("<strided and direct or indirect>")
  16367. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  16368. * cdef indirect = Enum("<strided and indirect>")
  16369. *
  16370. */
  16371. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
  16372. __Pyx_GOTREF(__pyx_t_1);
  16373. __Pyx_XGOTREF(strided);
  16374. __Pyx_DECREF_SET(strided, __pyx_t_1);
  16375. __Pyx_GIVEREF(__pyx_t_1);
  16376. __pyx_t_1 = 0;
  16377. /* "View.MemoryView":288
  16378. * cdef generic = Enum("<strided and direct or indirect>")
  16379. * cdef strided = Enum("<strided and direct>") # default
  16380. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  16381. *
  16382. *
  16383. */
  16384. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
  16385. __Pyx_GOTREF(__pyx_t_1);
  16386. __Pyx_XGOTREF(indirect);
  16387. __Pyx_DECREF_SET(indirect, __pyx_t_1);
  16388. __Pyx_GIVEREF(__pyx_t_1);
  16389. __pyx_t_1 = 0;
  16390. /* "View.MemoryView":291
  16391. *
  16392. *
  16393. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  16394. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  16395. *
  16396. */
  16397. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
  16398. __Pyx_GOTREF(__pyx_t_1);
  16399. __Pyx_XGOTREF(contiguous);
  16400. __Pyx_DECREF_SET(contiguous, __pyx_t_1);
  16401. __Pyx_GIVEREF(__pyx_t_1);
  16402. __pyx_t_1 = 0;
  16403. /* "View.MemoryView":292
  16404. *
  16405. * cdef contiguous = Enum("<contiguous and direct>")
  16406. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  16407. *
  16408. *
  16409. */
  16410. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
  16411. __Pyx_GOTREF(__pyx_t_1);
  16412. __Pyx_XGOTREF(indirect_contiguous);
  16413. __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
  16414. __Pyx_GIVEREF(__pyx_t_1);
  16415. __pyx_t_1 = 0;
  16416. /* "View.MemoryView":316
  16417. *
  16418. * DEF THREAD_LOCKS_PREALLOCATED = 8
  16419. * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
  16420. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
  16421. * PyThread_allocate_lock(),
  16422. */
  16423. __pyx_memoryview_thread_locks_used = 0;
  16424. /* "View.MemoryView":317
  16425. * DEF THREAD_LOCKS_PREALLOCATED = 8
  16426. * cdef int __pyx_memoryview_thread_locks_used = 0
  16427. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
  16428. * PyThread_allocate_lock(),
  16429. * PyThread_allocate_lock(),
  16430. */
  16431. __pyx_t_2[0] = PyThread_allocate_lock();
  16432. __pyx_t_2[1] = PyThread_allocate_lock();
  16433. __pyx_t_2[2] = PyThread_allocate_lock();
  16434. __pyx_t_2[3] = PyThread_allocate_lock();
  16435. __pyx_t_2[4] = PyThread_allocate_lock();
  16436. __pyx_t_2[5] = PyThread_allocate_lock();
  16437. __pyx_t_2[6] = PyThread_allocate_lock();
  16438. __pyx_t_2[7] = PyThread_allocate_lock();
  16439. memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
  16440. /* "View.MemoryView":549
  16441. * info.obj = self
  16442. *
  16443. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  16444. *
  16445. *
  16446. */
  16447. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
  16448. __Pyx_GOTREF(__pyx_t_1);
  16449. if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
  16450. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16451. PyType_Modified(__pyx_memoryview_type);
  16452. /* "View.MemoryView":995
  16453. * return self.from_object
  16454. *
  16455. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  16456. *
  16457. *
  16458. */
  16459. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error)
  16460. __Pyx_GOTREF(__pyx_t_1);
  16461. if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
  16462. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16463. PyType_Modified(__pyx_memoryviewslice_type);
  16464. /* "(tree fragment)":1
  16465. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  16466. * cdef object __pyx_PickleError
  16467. * cdef object __pyx_result
  16468. */
  16469. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
  16470. __Pyx_GOTREF(__pyx_t_1);
  16471. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  16472. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16473. /* "(tree fragment)":11
  16474. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  16475. * return __pyx_result
  16476. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  16477. * __pyx_result.name = __pyx_state[0]
  16478. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  16479. */
  16480. /*--- Wrapped vars code ---*/
  16481. goto __pyx_L0;
  16482. __pyx_L1_error:;
  16483. __Pyx_XDECREF(__pyx_t_1);
  16484. if (__pyx_m) {
  16485. if (__pyx_d) {
  16486. __Pyx_AddTraceback("init ArtNetProcessor_cy_pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16487. }
  16488. Py_CLEAR(__pyx_m);
  16489. } else if (!PyErr_Occurred()) {
  16490. PyErr_SetString(PyExc_ImportError, "init ArtNetProcessor_cy_pi");
  16491. }
  16492. __pyx_L0:;
  16493. __Pyx_RefNannyFinishContext();
  16494. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16495. return (__pyx_m != NULL) ? 0 : -1;
  16496. #elif PY_MAJOR_VERSION >= 3
  16497. return __pyx_m;
  16498. #else
  16499. return;
  16500. #endif
  16501. }
  16502. /* --- Runtime support code --- */
  16503. /* Refnanny */
  16504. #if CYTHON_REFNANNY
  16505. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  16506. PyObject *m = NULL, *p = NULL;
  16507. void *r = NULL;
  16508. m = PyImport_ImportModule(modname);
  16509. if (!m) goto end;
  16510. p = PyObject_GetAttrString(m, "RefNannyAPI");
  16511. if (!p) goto end;
  16512. r = PyLong_AsVoidPtr(p);
  16513. end:
  16514. Py_XDECREF(p);
  16515. Py_XDECREF(m);
  16516. return (__Pyx_RefNannyAPIStruct *)r;
  16517. }
  16518. #endif
  16519. /* PyObjectGetAttrStr */
  16520. #if CYTHON_USE_TYPE_SLOTS
  16521. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  16522. PyTypeObject* tp = Py_TYPE(obj);
  16523. if (likely(tp->tp_getattro))
  16524. return tp->tp_getattro(obj, attr_name);
  16525. #if PY_MAJOR_VERSION < 3
  16526. if (likely(tp->tp_getattr))
  16527. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  16528. #endif
  16529. return PyObject_GetAttr(obj, attr_name);
  16530. }
  16531. #endif
  16532. /* GetBuiltinName */
  16533. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  16534. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  16535. if (unlikely(!result)) {
  16536. PyErr_Format(PyExc_NameError,
  16537. #if PY_MAJOR_VERSION >= 3
  16538. "name '%U' is not defined", name);
  16539. #else
  16540. "name '%.200s' is not defined", PyString_AS_STRING(name));
  16541. #endif
  16542. }
  16543. return result;
  16544. }
  16545. /* RaiseArgTupleInvalid */
  16546. static void __Pyx_RaiseArgtupleInvalid(
  16547. const char* func_name,
  16548. int exact,
  16549. Py_ssize_t num_min,
  16550. Py_ssize_t num_max,
  16551. Py_ssize_t num_found)
  16552. {
  16553. Py_ssize_t num_expected;
  16554. const char *more_or_less;
  16555. if (num_found < num_min) {
  16556. num_expected = num_min;
  16557. more_or_less = "at least";
  16558. } else {
  16559. num_expected = num_max;
  16560. more_or_less = "at most";
  16561. }
  16562. if (exact) {
  16563. more_or_less = "exactly";
  16564. }
  16565. PyErr_Format(PyExc_TypeError,
  16566. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  16567. func_name, more_or_less, num_expected,
  16568. (num_expected == 1) ? "" : "s", num_found);
  16569. }
  16570. /* RaiseDoubleKeywords */
  16571. static void __Pyx_RaiseDoubleKeywordsError(
  16572. const char* func_name,
  16573. PyObject* kw_name)
  16574. {
  16575. PyErr_Format(PyExc_TypeError,
  16576. #if PY_MAJOR_VERSION >= 3
  16577. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  16578. #else
  16579. "%s() got multiple values for keyword argument '%s'", func_name,
  16580. PyString_AsString(kw_name));
  16581. #endif
  16582. }
  16583. /* ParseKeywords */
  16584. static int __Pyx_ParseOptionalKeywords(
  16585. PyObject *kwds,
  16586. PyObject **argnames[],
  16587. PyObject *kwds2,
  16588. PyObject *values[],
  16589. Py_ssize_t num_pos_args,
  16590. const char* function_name)
  16591. {
  16592. PyObject *key = 0, *value = 0;
  16593. Py_ssize_t pos = 0;
  16594. PyObject*** name;
  16595. PyObject*** first_kw_arg = argnames + num_pos_args;
  16596. while (PyDict_Next(kwds, &pos, &key, &value)) {
  16597. name = first_kw_arg;
  16598. while (*name && (**name != key)) name++;
  16599. if (*name) {
  16600. values[name-argnames] = value;
  16601. continue;
  16602. }
  16603. name = first_kw_arg;
  16604. #if PY_MAJOR_VERSION < 3
  16605. if (likely(PyString_Check(key))) {
  16606. while (*name) {
  16607. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  16608. && _PyString_Eq(**name, key)) {
  16609. values[name-argnames] = value;
  16610. break;
  16611. }
  16612. name++;
  16613. }
  16614. if (*name) continue;
  16615. else {
  16616. PyObject*** argname = argnames;
  16617. while (argname != first_kw_arg) {
  16618. if ((**argname == key) || (
  16619. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  16620. && _PyString_Eq(**argname, key))) {
  16621. goto arg_passed_twice;
  16622. }
  16623. argname++;
  16624. }
  16625. }
  16626. } else
  16627. #endif
  16628. if (likely(PyUnicode_Check(key))) {
  16629. while (*name) {
  16630. int cmp = (**name == key) ? 0 :
  16631. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  16632. (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  16633. #endif
  16634. PyUnicode_Compare(**name, key);
  16635. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  16636. if (cmp == 0) {
  16637. values[name-argnames] = value;
  16638. break;
  16639. }
  16640. name++;
  16641. }
  16642. if (*name) continue;
  16643. else {
  16644. PyObject*** argname = argnames;
  16645. while (argname != first_kw_arg) {
  16646. int cmp = (**argname == key) ? 0 :
  16647. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  16648. (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
  16649. #endif
  16650. PyUnicode_Compare(**argname, key);
  16651. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  16652. if (cmp == 0) goto arg_passed_twice;
  16653. argname++;
  16654. }
  16655. }
  16656. } else
  16657. goto invalid_keyword_type;
  16658. if (kwds2) {
  16659. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  16660. } else {
  16661. goto invalid_keyword;
  16662. }
  16663. }
  16664. return 0;
  16665. arg_passed_twice:
  16666. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  16667. goto bad;
  16668. invalid_keyword_type:
  16669. PyErr_Format(PyExc_TypeError,
  16670. "%.200s() keywords must be strings", function_name);
  16671. goto bad;
  16672. invalid_keyword:
  16673. PyErr_Format(PyExc_TypeError,
  16674. #if PY_MAJOR_VERSION < 3
  16675. "%.200s() got an unexpected keyword argument '%.200s'",
  16676. function_name, PyString_AsString(key));
  16677. #else
  16678. "%s() got an unexpected keyword argument '%U'",
  16679. function_name, key);
  16680. #endif
  16681. bad:
  16682. return -1;
  16683. }
  16684. /* PyObjectCall */
  16685. #if CYTHON_COMPILING_IN_CPYTHON
  16686. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  16687. PyObject *result;
  16688. ternaryfunc call = func->ob_type->tp_call;
  16689. if (unlikely(!call))
  16690. return PyObject_Call(func, arg, kw);
  16691. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  16692. return NULL;
  16693. result = (*call)(func, arg, kw);
  16694. Py_LeaveRecursiveCall();
  16695. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  16696. PyErr_SetString(
  16697. PyExc_SystemError,
  16698. "NULL result without error in PyObject_Call");
  16699. }
  16700. return result;
  16701. }
  16702. #endif
  16703. /* GetItemInt */
  16704. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  16705. PyObject *r;
  16706. if (!j) return NULL;
  16707. r = PyObject_GetItem(o, j);
  16708. Py_DECREF(j);
  16709. return r;
  16710. }
  16711. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  16712. CYTHON_NCP_UNUSED int wraparound,
  16713. CYTHON_NCP_UNUSED int boundscheck) {
  16714. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16715. Py_ssize_t wrapped_i = i;
  16716. if (wraparound & unlikely(i < 0)) {
  16717. wrapped_i += PyList_GET_SIZE(o);
  16718. }
  16719. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  16720. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  16721. Py_INCREF(r);
  16722. return r;
  16723. }
  16724. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  16725. #else
  16726. return PySequence_GetItem(o, i);
  16727. #endif
  16728. }
  16729. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  16730. CYTHON_NCP_UNUSED int wraparound,
  16731. CYTHON_NCP_UNUSED int boundscheck) {
  16732. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16733. Py_ssize_t wrapped_i = i;
  16734. if (wraparound & unlikely(i < 0)) {
  16735. wrapped_i += PyTuple_GET_SIZE(o);
  16736. }
  16737. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  16738. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  16739. Py_INCREF(r);
  16740. return r;
  16741. }
  16742. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  16743. #else
  16744. return PySequence_GetItem(o, i);
  16745. #endif
  16746. }
  16747. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  16748. CYTHON_NCP_UNUSED int wraparound,
  16749. CYTHON_NCP_UNUSED int boundscheck) {
  16750. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  16751. if (is_list || PyList_CheckExact(o)) {
  16752. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  16753. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  16754. PyObject *r = PyList_GET_ITEM(o, n);
  16755. Py_INCREF(r);
  16756. return r;
  16757. }
  16758. }
  16759. else if (PyTuple_CheckExact(o)) {
  16760. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  16761. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  16762. PyObject *r = PyTuple_GET_ITEM(o, n);
  16763. Py_INCREF(r);
  16764. return r;
  16765. }
  16766. } else {
  16767. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  16768. if (likely(m && m->sq_item)) {
  16769. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  16770. Py_ssize_t l = m->sq_length(o);
  16771. if (likely(l >= 0)) {
  16772. i += l;
  16773. } else {
  16774. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  16775. return NULL;
  16776. PyErr_Clear();
  16777. }
  16778. }
  16779. return m->sq_item(o, i);
  16780. }
  16781. }
  16782. #else
  16783. if (is_list || PySequence_Check(o)) {
  16784. return PySequence_GetItem(o, i);
  16785. }
  16786. #endif
  16787. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  16788. }
  16789. /* SetItemInt */
  16790. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  16791. int r;
  16792. if (!j) return -1;
  16793. r = PyObject_SetItem(o, j, v);
  16794. Py_DECREF(j);
  16795. return r;
  16796. }
  16797. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  16798. CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
  16799. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  16800. if (is_list || PyList_CheckExact(o)) {
  16801. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  16802. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  16803. PyObject* old = PyList_GET_ITEM(o, n);
  16804. Py_INCREF(v);
  16805. PyList_SET_ITEM(o, n, v);
  16806. Py_DECREF(old);
  16807. return 1;
  16808. }
  16809. } else {
  16810. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  16811. if (likely(m && m->sq_ass_item)) {
  16812. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  16813. Py_ssize_t l = m->sq_length(o);
  16814. if (likely(l >= 0)) {
  16815. i += l;
  16816. } else {
  16817. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  16818. return -1;
  16819. PyErr_Clear();
  16820. }
  16821. }
  16822. return m->sq_ass_item(o, i, v);
  16823. }
  16824. }
  16825. #else
  16826. #if CYTHON_COMPILING_IN_PYPY
  16827. if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
  16828. #else
  16829. if (is_list || PySequence_Check(o))
  16830. #endif
  16831. {
  16832. return PySequence_SetItem(o, i, v);
  16833. }
  16834. #endif
  16835. return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
  16836. }
  16837. /* BufferIndexError */
  16838. static void __Pyx_RaiseBufferIndexError(int axis) {
  16839. PyErr_Format(PyExc_IndexError,
  16840. "Out of bounds on buffer access (axis %d)", axis);
  16841. }
  16842. /* MemviewSliceInit */
  16843. static int
  16844. __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
  16845. int ndim,
  16846. __Pyx_memviewslice *memviewslice,
  16847. int memview_is_new_reference)
  16848. {
  16849. __Pyx_RefNannyDeclarations
  16850. int i, retval=-1;
  16851. Py_buffer *buf = &memview->view;
  16852. __Pyx_RefNannySetupContext("init_memviewslice", 0);
  16853. if (unlikely(memviewslice->memview || memviewslice->data)) {
  16854. PyErr_SetString(PyExc_ValueError,
  16855. "memviewslice is already initialized!");
  16856. goto fail;
  16857. }
  16858. if (buf->strides) {
  16859. for (i = 0; i < ndim; i++) {
  16860. memviewslice->strides[i] = buf->strides[i];
  16861. }
  16862. } else {
  16863. Py_ssize_t stride = buf->itemsize;
  16864. for (i = ndim - 1; i >= 0; i--) {
  16865. memviewslice->strides[i] = stride;
  16866. stride *= buf->shape[i];
  16867. }
  16868. }
  16869. for (i = 0; i < ndim; i++) {
  16870. memviewslice->shape[i] = buf->shape[i];
  16871. if (buf->suboffsets) {
  16872. memviewslice->suboffsets[i] = buf->suboffsets[i];
  16873. } else {
  16874. memviewslice->suboffsets[i] = -1;
  16875. }
  16876. }
  16877. memviewslice->memview = memview;
  16878. memviewslice->data = (char *)buf->buf;
  16879. if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
  16880. Py_INCREF(memview);
  16881. }
  16882. retval = 0;
  16883. goto no_fail;
  16884. fail:
  16885. memviewslice->memview = 0;
  16886. memviewslice->data = 0;
  16887. retval = -1;
  16888. no_fail:
  16889. __Pyx_RefNannyFinishContext();
  16890. return retval;
  16891. }
  16892. #ifndef Py_NO_RETURN
  16893. #define Py_NO_RETURN
  16894. #endif
  16895. static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
  16896. va_list vargs;
  16897. char msg[200];
  16898. #ifdef HAVE_STDARG_PROTOTYPES
  16899. va_start(vargs, fmt);
  16900. #else
  16901. va_start(vargs);
  16902. #endif
  16903. vsnprintf(msg, 200, fmt, vargs);
  16904. va_end(vargs);
  16905. Py_FatalError(msg);
  16906. }
  16907. static CYTHON_INLINE int
  16908. __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  16909. PyThread_type_lock lock)
  16910. {
  16911. int result;
  16912. PyThread_acquire_lock(lock, 1);
  16913. result = (*acquisition_count)++;
  16914. PyThread_release_lock(lock);
  16915. return result;
  16916. }
  16917. static CYTHON_INLINE int
  16918. __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  16919. PyThread_type_lock lock)
  16920. {
  16921. int result;
  16922. PyThread_acquire_lock(lock, 1);
  16923. result = (*acquisition_count)--;
  16924. PyThread_release_lock(lock);
  16925. return result;
  16926. }
  16927. static CYTHON_INLINE void
  16928. __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
  16929. {
  16930. int first_time;
  16931. struct __pyx_memoryview_obj *memview = memslice->memview;
  16932. if (unlikely(!memview || (PyObject *) memview == Py_None))
  16933. return;
  16934. if (unlikely(__pyx_get_slice_count(memview) < 0))
  16935. __pyx_fatalerror("Acquisition count is %d (line %d)",
  16936. __pyx_get_slice_count(memview), lineno);
  16937. first_time = __pyx_add_acquisition_count(memview) == 0;
  16938. if (unlikely(first_time)) {
  16939. if (have_gil) {
  16940. Py_INCREF((PyObject *) memview);
  16941. } else {
  16942. PyGILState_STATE _gilstate = PyGILState_Ensure();
  16943. Py_INCREF((PyObject *) memview);
  16944. PyGILState_Release(_gilstate);
  16945. }
  16946. }
  16947. }
  16948. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
  16949. int have_gil, int lineno) {
  16950. int last_time;
  16951. struct __pyx_memoryview_obj *memview = memslice->memview;
  16952. if (unlikely(!memview || (PyObject *) memview == Py_None)) {
  16953. memslice->memview = NULL;
  16954. return;
  16955. }
  16956. if (unlikely(__pyx_get_slice_count(memview) <= 0))
  16957. __pyx_fatalerror("Acquisition count is %d (line %d)",
  16958. __pyx_get_slice_count(memview), lineno);
  16959. last_time = __pyx_sub_acquisition_count(memview) == 1;
  16960. memslice->data = NULL;
  16961. if (unlikely(last_time)) {
  16962. if (have_gil) {
  16963. Py_CLEAR(memslice->memview);
  16964. } else {
  16965. PyGILState_STATE _gilstate = PyGILState_Ensure();
  16966. Py_CLEAR(memslice->memview);
  16967. PyGILState_Release(_gilstate);
  16968. }
  16969. } else {
  16970. memslice->memview = NULL;
  16971. }
  16972. }
  16973. /* ArgTypeTest */
  16974. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  16975. {
  16976. if (unlikely(!type)) {
  16977. PyErr_SetString(PyExc_SystemError, "Missing type object");
  16978. return 0;
  16979. }
  16980. else if (exact) {
  16981. #if PY_MAJOR_VERSION == 2
  16982. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  16983. #endif
  16984. }
  16985. else {
  16986. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  16987. }
  16988. PyErr_Format(PyExc_TypeError,
  16989. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  16990. name, type->tp_name, Py_TYPE(obj)->tp_name);
  16991. return 0;
  16992. }
  16993. /* PyErrFetchRestore */
  16994. #if CYTHON_FAST_THREAD_STATE
  16995. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  16996. PyObject *tmp_type, *tmp_value, *tmp_tb;
  16997. tmp_type = tstate->curexc_type;
  16998. tmp_value = tstate->curexc_value;
  16999. tmp_tb = tstate->curexc_traceback;
  17000. tstate->curexc_type = type;
  17001. tstate->curexc_value = value;
  17002. tstate->curexc_traceback = tb;
  17003. Py_XDECREF(tmp_type);
  17004. Py_XDECREF(tmp_value);
  17005. Py_XDECREF(tmp_tb);
  17006. }
  17007. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17008. *type = tstate->curexc_type;
  17009. *value = tstate->curexc_value;
  17010. *tb = tstate->curexc_traceback;
  17011. tstate->curexc_type = 0;
  17012. tstate->curexc_value = 0;
  17013. tstate->curexc_traceback = 0;
  17014. }
  17015. #endif
  17016. /* RaiseException */
  17017. #if PY_MAJOR_VERSION < 3
  17018. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  17019. CYTHON_UNUSED PyObject *cause) {
  17020. __Pyx_PyThreadState_declare
  17021. Py_XINCREF(type);
  17022. if (!value || value == Py_None)
  17023. value = NULL;
  17024. else
  17025. Py_INCREF(value);
  17026. if (!tb || tb == Py_None)
  17027. tb = NULL;
  17028. else {
  17029. Py_INCREF(tb);
  17030. if (!PyTraceBack_Check(tb)) {
  17031. PyErr_SetString(PyExc_TypeError,
  17032. "raise: arg 3 must be a traceback or None");
  17033. goto raise_error;
  17034. }
  17035. }
  17036. if (PyType_Check(type)) {
  17037. #if CYTHON_COMPILING_IN_PYPY
  17038. if (!value) {
  17039. Py_INCREF(Py_None);
  17040. value = Py_None;
  17041. }
  17042. #endif
  17043. PyErr_NormalizeException(&type, &value, &tb);
  17044. } else {
  17045. if (value) {
  17046. PyErr_SetString(PyExc_TypeError,
  17047. "instance exception may not have a separate value");
  17048. goto raise_error;
  17049. }
  17050. value = type;
  17051. type = (PyObject*) Py_TYPE(type);
  17052. Py_INCREF(type);
  17053. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  17054. PyErr_SetString(PyExc_TypeError,
  17055. "raise: exception class must be a subclass of BaseException");
  17056. goto raise_error;
  17057. }
  17058. }
  17059. __Pyx_PyThreadState_assign
  17060. __Pyx_ErrRestore(type, value, tb);
  17061. return;
  17062. raise_error:
  17063. Py_XDECREF(value);
  17064. Py_XDECREF(type);
  17065. Py_XDECREF(tb);
  17066. return;
  17067. }
  17068. #else
  17069. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  17070. PyObject* owned_instance = NULL;
  17071. if (tb == Py_None) {
  17072. tb = 0;
  17073. } else if (tb && !PyTraceBack_Check(tb)) {
  17074. PyErr_SetString(PyExc_TypeError,
  17075. "raise: arg 3 must be a traceback or None");
  17076. goto bad;
  17077. }
  17078. if (value == Py_None)
  17079. value = 0;
  17080. if (PyExceptionInstance_Check(type)) {
  17081. if (value) {
  17082. PyErr_SetString(PyExc_TypeError,
  17083. "instance exception may not have a separate value");
  17084. goto bad;
  17085. }
  17086. value = type;
  17087. type = (PyObject*) Py_TYPE(value);
  17088. } else if (PyExceptionClass_Check(type)) {
  17089. PyObject *instance_class = NULL;
  17090. if (value && PyExceptionInstance_Check(value)) {
  17091. instance_class = (PyObject*) Py_TYPE(value);
  17092. if (instance_class != type) {
  17093. int is_subclass = PyObject_IsSubclass(instance_class, type);
  17094. if (!is_subclass) {
  17095. instance_class = NULL;
  17096. } else if (unlikely(is_subclass == -1)) {
  17097. goto bad;
  17098. } else {
  17099. type = instance_class;
  17100. }
  17101. }
  17102. }
  17103. if (!instance_class) {
  17104. PyObject *args;
  17105. if (!value)
  17106. args = PyTuple_New(0);
  17107. else if (PyTuple_Check(value)) {
  17108. Py_INCREF(value);
  17109. args = value;
  17110. } else
  17111. args = PyTuple_Pack(1, value);
  17112. if (!args)
  17113. goto bad;
  17114. owned_instance = PyObject_Call(type, args, NULL);
  17115. Py_DECREF(args);
  17116. if (!owned_instance)
  17117. goto bad;
  17118. value = owned_instance;
  17119. if (!PyExceptionInstance_Check(value)) {
  17120. PyErr_Format(PyExc_TypeError,
  17121. "calling %R should have returned an instance of "
  17122. "BaseException, not %R",
  17123. type, Py_TYPE(value));
  17124. goto bad;
  17125. }
  17126. }
  17127. } else {
  17128. PyErr_SetString(PyExc_TypeError,
  17129. "raise: exception class must be a subclass of BaseException");
  17130. goto bad;
  17131. }
  17132. if (cause) {
  17133. PyObject *fixed_cause;
  17134. if (cause == Py_None) {
  17135. fixed_cause = NULL;
  17136. } else if (PyExceptionClass_Check(cause)) {
  17137. fixed_cause = PyObject_CallObject(cause, NULL);
  17138. if (fixed_cause == NULL)
  17139. goto bad;
  17140. } else if (PyExceptionInstance_Check(cause)) {
  17141. fixed_cause = cause;
  17142. Py_INCREF(fixed_cause);
  17143. } else {
  17144. PyErr_SetString(PyExc_TypeError,
  17145. "exception causes must derive from "
  17146. "BaseException");
  17147. goto bad;
  17148. }
  17149. PyException_SetCause(value, fixed_cause);
  17150. }
  17151. PyErr_SetObject(type, value);
  17152. if (tb) {
  17153. #if CYTHON_COMPILING_IN_PYPY
  17154. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17155. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  17156. Py_INCREF(tb);
  17157. PyErr_Restore(tmp_type, tmp_value, tb);
  17158. Py_XDECREF(tmp_tb);
  17159. #else
  17160. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  17161. PyObject* tmp_tb = tstate->curexc_traceback;
  17162. if (tb != tmp_tb) {
  17163. Py_INCREF(tb);
  17164. tstate->curexc_traceback = tb;
  17165. Py_XDECREF(tmp_tb);
  17166. }
  17167. #endif
  17168. }
  17169. bad:
  17170. Py_XDECREF(owned_instance);
  17171. return;
  17172. }
  17173. #endif
  17174. /* PyCFunctionFastCall */
  17175. #if CYTHON_FAST_PYCCALL
  17176. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  17177. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  17178. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  17179. PyObject *self = PyCFunction_GET_SELF(func);
  17180. int flags = PyCFunction_GET_FLAGS(func);
  17181. assert(PyCFunction_Check(func));
  17182. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
  17183. assert(nargs >= 0);
  17184. assert(nargs == 0 || args != NULL);
  17185. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  17186. because it may clear it (directly or indirectly) and so the
  17187. caller loses its exception */
  17188. assert(!PyErr_Occurred());
  17189. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  17190. return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
  17191. } else {
  17192. return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
  17193. }
  17194. }
  17195. #endif
  17196. /* PyFunctionFastCall */
  17197. #if CYTHON_FAST_PYCALL
  17198. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  17199. PyObject *globals) {
  17200. PyFrameObject *f;
  17201. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  17202. PyObject **fastlocals;
  17203. Py_ssize_t i;
  17204. PyObject *result;
  17205. assert(globals != NULL);
  17206. /* XXX Perhaps we should create a specialized
  17207. PyFrame_New() that doesn't take locals, but does
  17208. take builtins without sanity checking them.
  17209. */
  17210. assert(tstate != NULL);
  17211. f = PyFrame_New(tstate, co, globals, NULL);
  17212. if (f == NULL) {
  17213. return NULL;
  17214. }
  17215. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  17216. for (i = 0; i < na; i++) {
  17217. Py_INCREF(*args);
  17218. fastlocals[i] = *args++;
  17219. }
  17220. result = PyEval_EvalFrameEx(f,0);
  17221. ++tstate->recursion_depth;
  17222. Py_DECREF(f);
  17223. --tstate->recursion_depth;
  17224. return result;
  17225. }
  17226. #if 1 || PY_VERSION_HEX < 0x030600B1
  17227. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
  17228. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  17229. PyObject *globals = PyFunction_GET_GLOBALS(func);
  17230. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  17231. PyObject *closure;
  17232. #if PY_MAJOR_VERSION >= 3
  17233. PyObject *kwdefs;
  17234. #endif
  17235. PyObject *kwtuple, **k;
  17236. PyObject **d;
  17237. Py_ssize_t nd;
  17238. Py_ssize_t nk;
  17239. PyObject *result;
  17240. assert(kwargs == NULL || PyDict_Check(kwargs));
  17241. nk = kwargs ? PyDict_Size(kwargs) : 0;
  17242. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  17243. return NULL;
  17244. }
  17245. if (
  17246. #if PY_MAJOR_VERSION >= 3
  17247. co->co_kwonlyargcount == 0 &&
  17248. #endif
  17249. likely(kwargs == NULL || nk == 0) &&
  17250. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  17251. if (argdefs == NULL && co->co_argcount == nargs) {
  17252. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  17253. goto done;
  17254. }
  17255. else if (nargs == 0 && argdefs != NULL
  17256. && co->co_argcount == Py_SIZE(argdefs)) {
  17257. /* function called with no arguments, but all parameters have
  17258. a default value: use default values as arguments .*/
  17259. args = &PyTuple_GET_ITEM(argdefs, 0);
  17260. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  17261. goto done;
  17262. }
  17263. }
  17264. if (kwargs != NULL) {
  17265. Py_ssize_t pos, i;
  17266. kwtuple = PyTuple_New(2 * nk);
  17267. if (kwtuple == NULL) {
  17268. result = NULL;
  17269. goto done;
  17270. }
  17271. k = &PyTuple_GET_ITEM(kwtuple, 0);
  17272. pos = i = 0;
  17273. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  17274. Py_INCREF(k[i]);
  17275. Py_INCREF(k[i+1]);
  17276. i += 2;
  17277. }
  17278. nk = i / 2;
  17279. }
  17280. else {
  17281. kwtuple = NULL;
  17282. k = NULL;
  17283. }
  17284. closure = PyFunction_GET_CLOSURE(func);
  17285. #if PY_MAJOR_VERSION >= 3
  17286. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  17287. #endif
  17288. if (argdefs != NULL) {
  17289. d = &PyTuple_GET_ITEM(argdefs, 0);
  17290. nd = Py_SIZE(argdefs);
  17291. }
  17292. else {
  17293. d = NULL;
  17294. nd = 0;
  17295. }
  17296. #if PY_MAJOR_VERSION >= 3
  17297. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  17298. args, (int)nargs,
  17299. k, (int)nk,
  17300. d, (int)nd, kwdefs, closure);
  17301. #else
  17302. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  17303. args, (int)nargs,
  17304. k, (int)nk,
  17305. d, (int)nd, closure);
  17306. #endif
  17307. Py_XDECREF(kwtuple);
  17308. done:
  17309. Py_LeaveRecursiveCall();
  17310. return result;
  17311. }
  17312. #endif
  17313. #endif
  17314. /* PyObjectCall2Args */
  17315. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  17316. PyObject *args, *result = NULL;
  17317. #if CYTHON_FAST_PYCALL
  17318. if (PyFunction_Check(function)) {
  17319. PyObject *args[2] = {arg1, arg2};
  17320. return __Pyx_PyFunction_FastCall(function, args, 2);
  17321. }
  17322. #endif
  17323. #if CYTHON_FAST_PYCCALL
  17324. if (__Pyx_PyFastCFunction_Check(function)) {
  17325. PyObject *args[2] = {arg1, arg2};
  17326. return __Pyx_PyCFunction_FastCall(function, args, 2);
  17327. }
  17328. #endif
  17329. args = PyTuple_New(2);
  17330. if (unlikely(!args)) goto done;
  17331. Py_INCREF(arg1);
  17332. PyTuple_SET_ITEM(args, 0, arg1);
  17333. Py_INCREF(arg2);
  17334. PyTuple_SET_ITEM(args, 1, arg2);
  17335. Py_INCREF(function);
  17336. result = __Pyx_PyObject_Call(function, args, NULL);
  17337. Py_DECREF(args);
  17338. Py_DECREF(function);
  17339. done:
  17340. return result;
  17341. }
  17342. /* PyObjectCallMethO */
  17343. #if CYTHON_COMPILING_IN_CPYTHON
  17344. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  17345. PyObject *self, *result;
  17346. PyCFunction cfunc;
  17347. cfunc = PyCFunction_GET_FUNCTION(func);
  17348. self = PyCFunction_GET_SELF(func);
  17349. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  17350. return NULL;
  17351. result = cfunc(self, arg);
  17352. Py_LeaveRecursiveCall();
  17353. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  17354. PyErr_SetString(
  17355. PyExc_SystemError,
  17356. "NULL result without error in PyObject_Call");
  17357. }
  17358. return result;
  17359. }
  17360. #endif
  17361. /* PyObjectCallOneArg */
  17362. #if CYTHON_COMPILING_IN_CPYTHON
  17363. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  17364. PyObject *result;
  17365. PyObject *args = PyTuple_New(1);
  17366. if (unlikely(!args)) return NULL;
  17367. Py_INCREF(arg);
  17368. PyTuple_SET_ITEM(args, 0, arg);
  17369. result = __Pyx_PyObject_Call(func, args, NULL);
  17370. Py_DECREF(args);
  17371. return result;
  17372. }
  17373. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  17374. #if CYTHON_FAST_PYCALL
  17375. if (PyFunction_Check(func)) {
  17376. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  17377. }
  17378. #endif
  17379. if (likely(PyCFunction_Check(func))) {
  17380. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  17381. return __Pyx_PyObject_CallMethO(func, arg);
  17382. #if CYTHON_FAST_PYCCALL
  17383. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  17384. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  17385. #endif
  17386. }
  17387. }
  17388. return __Pyx__PyObject_CallOneArg(func, arg);
  17389. }
  17390. #else
  17391. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  17392. PyObject *result;
  17393. PyObject *args = PyTuple_Pack(1, arg);
  17394. if (unlikely(!args)) return NULL;
  17395. result = __Pyx_PyObject_Call(func, args, NULL);
  17396. Py_DECREF(args);
  17397. return result;
  17398. }
  17399. #endif
  17400. /* BytesEquals */
  17401. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  17402. #if CYTHON_COMPILING_IN_PYPY
  17403. return PyObject_RichCompareBool(s1, s2, equals);
  17404. #else
  17405. if (s1 == s2) {
  17406. return (equals == Py_EQ);
  17407. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  17408. const char *ps1, *ps2;
  17409. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  17410. if (length != PyBytes_GET_SIZE(s2))
  17411. return (equals == Py_NE);
  17412. ps1 = PyBytes_AS_STRING(s1);
  17413. ps2 = PyBytes_AS_STRING(s2);
  17414. if (ps1[0] != ps2[0]) {
  17415. return (equals == Py_NE);
  17416. } else if (length == 1) {
  17417. return (equals == Py_EQ);
  17418. } else {
  17419. int result;
  17420. #if CYTHON_USE_UNICODE_INTERNALS
  17421. Py_hash_t hash1, hash2;
  17422. hash1 = ((PyBytesObject*)s1)->ob_shash;
  17423. hash2 = ((PyBytesObject*)s2)->ob_shash;
  17424. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  17425. return (equals == Py_NE);
  17426. }
  17427. #endif
  17428. result = memcmp(ps1, ps2, (size_t)length);
  17429. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  17430. }
  17431. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  17432. return (equals == Py_NE);
  17433. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  17434. return (equals == Py_NE);
  17435. } else {
  17436. int result;
  17437. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  17438. if (!py_result)
  17439. return -1;
  17440. result = __Pyx_PyObject_IsTrue(py_result);
  17441. Py_DECREF(py_result);
  17442. return result;
  17443. }
  17444. #endif
  17445. }
  17446. /* UnicodeEquals */
  17447. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  17448. #if CYTHON_COMPILING_IN_PYPY
  17449. return PyObject_RichCompareBool(s1, s2, equals);
  17450. #else
  17451. #if PY_MAJOR_VERSION < 3
  17452. PyObject* owned_ref = NULL;
  17453. #endif
  17454. int s1_is_unicode, s2_is_unicode;
  17455. if (s1 == s2) {
  17456. goto return_eq;
  17457. }
  17458. s1_is_unicode = PyUnicode_CheckExact(s1);
  17459. s2_is_unicode = PyUnicode_CheckExact(s2);
  17460. #if PY_MAJOR_VERSION < 3
  17461. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  17462. owned_ref = PyUnicode_FromObject(s2);
  17463. if (unlikely(!owned_ref))
  17464. return -1;
  17465. s2 = owned_ref;
  17466. s2_is_unicode = 1;
  17467. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  17468. owned_ref = PyUnicode_FromObject(s1);
  17469. if (unlikely(!owned_ref))
  17470. return -1;
  17471. s1 = owned_ref;
  17472. s1_is_unicode = 1;
  17473. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  17474. return __Pyx_PyBytes_Equals(s1, s2, equals);
  17475. }
  17476. #endif
  17477. if (s1_is_unicode & s2_is_unicode) {
  17478. Py_ssize_t length;
  17479. int kind;
  17480. void *data1, *data2;
  17481. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  17482. return -1;
  17483. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  17484. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  17485. goto return_ne;
  17486. }
  17487. #if CYTHON_USE_UNICODE_INTERNALS
  17488. {
  17489. Py_hash_t hash1, hash2;
  17490. #if CYTHON_PEP393_ENABLED
  17491. hash1 = ((PyASCIIObject*)s1)->hash;
  17492. hash2 = ((PyASCIIObject*)s2)->hash;
  17493. #else
  17494. hash1 = ((PyUnicodeObject*)s1)->hash;
  17495. hash2 = ((PyUnicodeObject*)s2)->hash;
  17496. #endif
  17497. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  17498. goto return_ne;
  17499. }
  17500. }
  17501. #endif
  17502. kind = __Pyx_PyUnicode_KIND(s1);
  17503. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  17504. goto return_ne;
  17505. }
  17506. data1 = __Pyx_PyUnicode_DATA(s1);
  17507. data2 = __Pyx_PyUnicode_DATA(s2);
  17508. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  17509. goto return_ne;
  17510. } else if (length == 1) {
  17511. goto return_eq;
  17512. } else {
  17513. int result = memcmp(data1, data2, (size_t)(length * kind));
  17514. #if PY_MAJOR_VERSION < 3
  17515. Py_XDECREF(owned_ref);
  17516. #endif
  17517. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  17518. }
  17519. } else if ((s1 == Py_None) & s2_is_unicode) {
  17520. goto return_ne;
  17521. } else if ((s2 == Py_None) & s1_is_unicode) {
  17522. goto return_ne;
  17523. } else {
  17524. int result;
  17525. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  17526. #if PY_MAJOR_VERSION < 3
  17527. Py_XDECREF(owned_ref);
  17528. #endif
  17529. if (!py_result)
  17530. return -1;
  17531. result = __Pyx_PyObject_IsTrue(py_result);
  17532. Py_DECREF(py_result);
  17533. return result;
  17534. }
  17535. return_eq:
  17536. #if PY_MAJOR_VERSION < 3
  17537. Py_XDECREF(owned_ref);
  17538. #endif
  17539. return (equals == Py_EQ);
  17540. return_ne:
  17541. #if PY_MAJOR_VERSION < 3
  17542. Py_XDECREF(owned_ref);
  17543. #endif
  17544. return (equals == Py_NE);
  17545. #endif
  17546. }
  17547. /* None */
  17548. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
  17549. Py_ssize_t q = a / b;
  17550. Py_ssize_t r = a - q*b;
  17551. q -= ((r != 0) & ((r ^ b) < 0));
  17552. return q;
  17553. }
  17554. /* GetAttr */
  17555. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
  17556. #if CYTHON_USE_TYPE_SLOTS
  17557. #if PY_MAJOR_VERSION >= 3
  17558. if (likely(PyUnicode_Check(n)))
  17559. #else
  17560. if (likely(PyString_Check(n)))
  17561. #endif
  17562. return __Pyx_PyObject_GetAttrStr(o, n);
  17563. #endif
  17564. return PyObject_GetAttr(o, n);
  17565. }
  17566. /* ObjectGetItem */
  17567. #if CYTHON_USE_TYPE_SLOTS
  17568. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
  17569. PyObject *runerr;
  17570. Py_ssize_t key_value;
  17571. PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
  17572. if (unlikely(!(m && m->sq_item))) {
  17573. PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
  17574. return NULL;
  17575. }
  17576. key_value = __Pyx_PyIndex_AsSsize_t(index);
  17577. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  17578. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  17579. }
  17580. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  17581. PyErr_Clear();
  17582. PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
  17583. }
  17584. return NULL;
  17585. }
  17586. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
  17587. PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
  17588. if (likely(m && m->mp_subscript)) {
  17589. return m->mp_subscript(obj, key);
  17590. }
  17591. return __Pyx_PyObject_GetIndex(obj, key);
  17592. }
  17593. #endif
  17594. /* decode_c_string */
  17595. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  17596. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  17597. const char* encoding, const char* errors,
  17598. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
  17599. Py_ssize_t length;
  17600. if (unlikely((start < 0) | (stop < 0))) {
  17601. size_t slen = strlen(cstring);
  17602. if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
  17603. PyErr_SetString(PyExc_OverflowError,
  17604. "c-string too long to convert to Python");
  17605. return NULL;
  17606. }
  17607. length = (Py_ssize_t) slen;
  17608. if (start < 0) {
  17609. start += length;
  17610. if (start < 0)
  17611. start = 0;
  17612. }
  17613. if (stop < 0)
  17614. stop += length;
  17615. }
  17616. if (unlikely(stop <= start))
  17617. return __Pyx_NewRef(__pyx_empty_unicode);
  17618. length = stop - start;
  17619. cstring += start;
  17620. if (decode_func) {
  17621. return decode_func(cstring, length, errors);
  17622. } else {
  17623. return PyUnicode_Decode(cstring, length, encoding, errors);
  17624. }
  17625. }
  17626. /* PyErrExceptionMatches */
  17627. #if CYTHON_FAST_THREAD_STATE
  17628. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  17629. Py_ssize_t i, n;
  17630. n = PyTuple_GET_SIZE(tuple);
  17631. #if PY_MAJOR_VERSION >= 3
  17632. for (i=0; i<n; i++) {
  17633. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  17634. }
  17635. #endif
  17636. for (i=0; i<n; i++) {
  17637. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  17638. }
  17639. return 0;
  17640. }
  17641. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  17642. PyObject *exc_type = tstate->curexc_type;
  17643. if (exc_type == err) return 1;
  17644. if (unlikely(!exc_type)) return 0;
  17645. if (unlikely(PyTuple_Check(err)))
  17646. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  17647. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  17648. }
  17649. #endif
  17650. /* GetAttr3 */
  17651. static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
  17652. __Pyx_PyThreadState_declare
  17653. __Pyx_PyThreadState_assign
  17654. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  17655. return NULL;
  17656. __Pyx_PyErr_Clear();
  17657. Py_INCREF(d);
  17658. return d;
  17659. }
  17660. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  17661. PyObject *r = __Pyx_GetAttr(o, n);
  17662. return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
  17663. }
  17664. /* PyDictVersioning */
  17665. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  17666. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  17667. PyObject *dict = Py_TYPE(obj)->tp_dict;
  17668. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  17669. }
  17670. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  17671. PyObject **dictptr = NULL;
  17672. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  17673. if (offset) {
  17674. #if CYTHON_COMPILING_IN_CPYTHON
  17675. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  17676. #else
  17677. dictptr = _PyObject_GetDictPtr(obj);
  17678. #endif
  17679. }
  17680. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  17681. }
  17682. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  17683. PyObject *dict = Py_TYPE(obj)->tp_dict;
  17684. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  17685. return 0;
  17686. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  17687. }
  17688. #endif
  17689. /* GetModuleGlobalName */
  17690. #if CYTHON_USE_DICT_VERSIONS
  17691. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  17692. #else
  17693. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  17694. #endif
  17695. {
  17696. PyObject *result;
  17697. #if !CYTHON_AVOID_BORROWED_REFS
  17698. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  17699. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  17700. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17701. if (likely(result)) {
  17702. return __Pyx_NewRef(result);
  17703. } else if (unlikely(PyErr_Occurred())) {
  17704. return NULL;
  17705. }
  17706. #else
  17707. result = PyDict_GetItem(__pyx_d, name);
  17708. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17709. if (likely(result)) {
  17710. return __Pyx_NewRef(result);
  17711. }
  17712. #endif
  17713. #else
  17714. result = PyObject_GetItem(__pyx_d, name);
  17715. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17716. if (likely(result)) {
  17717. return __Pyx_NewRef(result);
  17718. }
  17719. PyErr_Clear();
  17720. #endif
  17721. return __Pyx_GetBuiltinName(name);
  17722. }
  17723. /* RaiseTooManyValuesToUnpack */
  17724. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  17725. PyErr_Format(PyExc_ValueError,
  17726. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  17727. }
  17728. /* RaiseNeedMoreValuesToUnpack */
  17729. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  17730. PyErr_Format(PyExc_ValueError,
  17731. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  17732. index, (index == 1) ? "" : "s");
  17733. }
  17734. /* RaiseNoneIterError */
  17735. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  17736. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  17737. }
  17738. /* ExtTypeTest */
  17739. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  17740. if (unlikely(!type)) {
  17741. PyErr_SetString(PyExc_SystemError, "Missing type object");
  17742. return 0;
  17743. }
  17744. if (likely(__Pyx_TypeCheck(obj, type)))
  17745. return 1;
  17746. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  17747. Py_TYPE(obj)->tp_name, type->tp_name);
  17748. return 0;
  17749. }
  17750. /* GetTopmostException */
  17751. #if CYTHON_USE_EXC_INFO_STACK
  17752. static _PyErr_StackItem *
  17753. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  17754. {
  17755. _PyErr_StackItem *exc_info = tstate->exc_info;
  17756. while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  17757. exc_info->previous_item != NULL)
  17758. {
  17759. exc_info = exc_info->previous_item;
  17760. }
  17761. return exc_info;
  17762. }
  17763. #endif
  17764. /* SaveResetException */
  17765. #if CYTHON_FAST_THREAD_STATE
  17766. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17767. #if CYTHON_USE_EXC_INFO_STACK
  17768. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  17769. *type = exc_info->exc_type;
  17770. *value = exc_info->exc_value;
  17771. *tb = exc_info->exc_traceback;
  17772. #else
  17773. *type = tstate->exc_type;
  17774. *value = tstate->exc_value;
  17775. *tb = tstate->exc_traceback;
  17776. #endif
  17777. Py_XINCREF(*type);
  17778. Py_XINCREF(*value);
  17779. Py_XINCREF(*tb);
  17780. }
  17781. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  17782. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17783. #if CYTHON_USE_EXC_INFO_STACK
  17784. _PyErr_StackItem *exc_info = tstate->exc_info;
  17785. tmp_type = exc_info->exc_type;
  17786. tmp_value = exc_info->exc_value;
  17787. tmp_tb = exc_info->exc_traceback;
  17788. exc_info->exc_type = type;
  17789. exc_info->exc_value = value;
  17790. exc_info->exc_traceback = tb;
  17791. #else
  17792. tmp_type = tstate->exc_type;
  17793. tmp_value = tstate->exc_value;
  17794. tmp_tb = tstate->exc_traceback;
  17795. tstate->exc_type = type;
  17796. tstate->exc_value = value;
  17797. tstate->exc_traceback = tb;
  17798. #endif
  17799. Py_XDECREF(tmp_type);
  17800. Py_XDECREF(tmp_value);
  17801. Py_XDECREF(tmp_tb);
  17802. }
  17803. #endif
  17804. /* GetException */
  17805. #if CYTHON_FAST_THREAD_STATE
  17806. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  17807. #else
  17808. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  17809. #endif
  17810. {
  17811. PyObject *local_type, *local_value, *local_tb;
  17812. #if CYTHON_FAST_THREAD_STATE
  17813. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17814. local_type = tstate->curexc_type;
  17815. local_value = tstate->curexc_value;
  17816. local_tb = tstate->curexc_traceback;
  17817. tstate->curexc_type = 0;
  17818. tstate->curexc_value = 0;
  17819. tstate->curexc_traceback = 0;
  17820. #else
  17821. PyErr_Fetch(&local_type, &local_value, &local_tb);
  17822. #endif
  17823. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  17824. #if CYTHON_FAST_THREAD_STATE
  17825. if (unlikely(tstate->curexc_type))
  17826. #else
  17827. if (unlikely(PyErr_Occurred()))
  17828. #endif
  17829. goto bad;
  17830. #if PY_MAJOR_VERSION >= 3
  17831. if (local_tb) {
  17832. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  17833. goto bad;
  17834. }
  17835. #endif
  17836. Py_XINCREF(local_tb);
  17837. Py_XINCREF(local_type);
  17838. Py_XINCREF(local_value);
  17839. *type = local_type;
  17840. *value = local_value;
  17841. *tb = local_tb;
  17842. #if CYTHON_FAST_THREAD_STATE
  17843. #if CYTHON_USE_EXC_INFO_STACK
  17844. {
  17845. _PyErr_StackItem *exc_info = tstate->exc_info;
  17846. tmp_type = exc_info->exc_type;
  17847. tmp_value = exc_info->exc_value;
  17848. tmp_tb = exc_info->exc_traceback;
  17849. exc_info->exc_type = local_type;
  17850. exc_info->exc_value = local_value;
  17851. exc_info->exc_traceback = local_tb;
  17852. }
  17853. #else
  17854. tmp_type = tstate->exc_type;
  17855. tmp_value = tstate->exc_value;
  17856. tmp_tb = tstate->exc_traceback;
  17857. tstate->exc_type = local_type;
  17858. tstate->exc_value = local_value;
  17859. tstate->exc_traceback = local_tb;
  17860. #endif
  17861. Py_XDECREF(tmp_type);
  17862. Py_XDECREF(tmp_value);
  17863. Py_XDECREF(tmp_tb);
  17864. #else
  17865. PyErr_SetExcInfo(local_type, local_value, local_tb);
  17866. #endif
  17867. return 0;
  17868. bad:
  17869. *type = 0;
  17870. *value = 0;
  17871. *tb = 0;
  17872. Py_XDECREF(local_type);
  17873. Py_XDECREF(local_value);
  17874. Py_XDECREF(local_tb);
  17875. return -1;
  17876. }
  17877. /* SwapException */
  17878. #if CYTHON_FAST_THREAD_STATE
  17879. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  17880. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17881. #if CYTHON_USE_EXC_INFO_STACK
  17882. _PyErr_StackItem *exc_info = tstate->exc_info;
  17883. tmp_type = exc_info->exc_type;
  17884. tmp_value = exc_info->exc_value;
  17885. tmp_tb = exc_info->exc_traceback;
  17886. exc_info->exc_type = *type;
  17887. exc_info->exc_value = *value;
  17888. exc_info->exc_traceback = *tb;
  17889. #else
  17890. tmp_type = tstate->exc_type;
  17891. tmp_value = tstate->exc_value;
  17892. tmp_tb = tstate->exc_traceback;
  17893. tstate->exc_type = *type;
  17894. tstate->exc_value = *value;
  17895. tstate->exc_traceback = *tb;
  17896. #endif
  17897. *type = tmp_type;
  17898. *value = tmp_value;
  17899. *tb = tmp_tb;
  17900. }
  17901. #else
  17902. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  17903. PyObject *tmp_type, *tmp_value, *tmp_tb;
  17904. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  17905. PyErr_SetExcInfo(*type, *value, *tb);
  17906. *type = tmp_type;
  17907. *value = tmp_value;
  17908. *tb = tmp_tb;
  17909. }
  17910. #endif
  17911. /* Import */
  17912. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  17913. PyObject *empty_list = 0;
  17914. PyObject *module = 0;
  17915. PyObject *global_dict = 0;
  17916. PyObject *empty_dict = 0;
  17917. PyObject *list;
  17918. #if PY_MAJOR_VERSION < 3
  17919. PyObject *py_import;
  17920. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  17921. if (!py_import)
  17922. goto bad;
  17923. #endif
  17924. if (from_list)
  17925. list = from_list;
  17926. else {
  17927. empty_list = PyList_New(0);
  17928. if (!empty_list)
  17929. goto bad;
  17930. list = empty_list;
  17931. }
  17932. global_dict = PyModule_GetDict(__pyx_m);
  17933. if (!global_dict)
  17934. goto bad;
  17935. empty_dict = PyDict_New();
  17936. if (!empty_dict)
  17937. goto bad;
  17938. {
  17939. #if PY_MAJOR_VERSION >= 3
  17940. if (level == -1) {
  17941. if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
  17942. module = PyImport_ImportModuleLevelObject(
  17943. name, global_dict, empty_dict, list, 1);
  17944. if (!module) {
  17945. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  17946. goto bad;
  17947. PyErr_Clear();
  17948. }
  17949. }
  17950. level = 0;
  17951. }
  17952. #endif
  17953. if (!module) {
  17954. #if PY_MAJOR_VERSION < 3
  17955. PyObject *py_level = PyInt_FromLong(level);
  17956. if (!py_level)
  17957. goto bad;
  17958. module = PyObject_CallFunctionObjArgs(py_import,
  17959. name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  17960. Py_DECREF(py_level);
  17961. #else
  17962. module = PyImport_ImportModuleLevelObject(
  17963. name, global_dict, empty_dict, list, level);
  17964. #endif
  17965. }
  17966. }
  17967. bad:
  17968. #if PY_MAJOR_VERSION < 3
  17969. Py_XDECREF(py_import);
  17970. #endif
  17971. Py_XDECREF(empty_list);
  17972. Py_XDECREF(empty_dict);
  17973. return module;
  17974. }
  17975. /* FastTypeChecks */
  17976. #if CYTHON_COMPILING_IN_CPYTHON
  17977. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  17978. while (a) {
  17979. a = a->tp_base;
  17980. if (a == b)
  17981. return 1;
  17982. }
  17983. return b == &PyBaseObject_Type;
  17984. }
  17985. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  17986. PyObject *mro;
  17987. if (a == b) return 1;
  17988. mro = a->tp_mro;
  17989. if (likely(mro)) {
  17990. Py_ssize_t i, n;
  17991. n = PyTuple_GET_SIZE(mro);
  17992. for (i = 0; i < n; i++) {
  17993. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  17994. return 1;
  17995. }
  17996. return 0;
  17997. }
  17998. return __Pyx_InBases(a, b);
  17999. }
  18000. #if PY_MAJOR_VERSION == 2
  18001. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  18002. PyObject *exception, *value, *tb;
  18003. int res;
  18004. __Pyx_PyThreadState_declare
  18005. __Pyx_PyThreadState_assign
  18006. __Pyx_ErrFetch(&exception, &value, &tb);
  18007. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  18008. if (unlikely(res == -1)) {
  18009. PyErr_WriteUnraisable(err);
  18010. res = 0;
  18011. }
  18012. if (!res) {
  18013. res = PyObject_IsSubclass(err, exc_type2);
  18014. if (unlikely(res == -1)) {
  18015. PyErr_WriteUnraisable(err);
  18016. res = 0;
  18017. }
  18018. }
  18019. __Pyx_ErrRestore(exception, value, tb);
  18020. return res;
  18021. }
  18022. #else
  18023. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  18024. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  18025. if (!res) {
  18026. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  18027. }
  18028. return res;
  18029. }
  18030. #endif
  18031. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  18032. Py_ssize_t i, n;
  18033. assert(PyExceptionClass_Check(exc_type));
  18034. n = PyTuple_GET_SIZE(tuple);
  18035. #if PY_MAJOR_VERSION >= 3
  18036. for (i=0; i<n; i++) {
  18037. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  18038. }
  18039. #endif
  18040. for (i=0; i<n; i++) {
  18041. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  18042. #if PY_MAJOR_VERSION < 3
  18043. if (likely(exc_type == t)) return 1;
  18044. #endif
  18045. if (likely(PyExceptionClass_Check(t))) {
  18046. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  18047. } else {
  18048. }
  18049. }
  18050. return 0;
  18051. }
  18052. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  18053. if (likely(err == exc_type)) return 1;
  18054. if (likely(PyExceptionClass_Check(err))) {
  18055. if (likely(PyExceptionClass_Check(exc_type))) {
  18056. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  18057. } else if (likely(PyTuple_Check(exc_type))) {
  18058. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  18059. } else {
  18060. }
  18061. }
  18062. return PyErr_GivenExceptionMatches(err, exc_type);
  18063. }
  18064. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  18065. assert(PyExceptionClass_Check(exc_type1));
  18066. assert(PyExceptionClass_Check(exc_type2));
  18067. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  18068. if (likely(PyExceptionClass_Check(err))) {
  18069. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  18070. }
  18071. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  18072. }
  18073. #endif
  18074. /* PyIntBinop */
  18075. #if !CYTHON_COMPILING_IN_PYPY
  18076. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
  18077. (void)inplace;
  18078. (void)zerodivision_check;
  18079. #if PY_MAJOR_VERSION < 3
  18080. if (likely(PyInt_CheckExact(op1))) {
  18081. const long b = intval;
  18082. long x;
  18083. long a = PyInt_AS_LONG(op1);
  18084. x = (long)((unsigned long)a + b);
  18085. if (likely((x^a) >= 0 || (x^b) >= 0))
  18086. return PyInt_FromLong(x);
  18087. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  18088. }
  18089. #endif
  18090. #if CYTHON_USE_PYLONG_INTERNALS
  18091. if (likely(PyLong_CheckExact(op1))) {
  18092. const long b = intval;
  18093. long a, x;
  18094. #ifdef HAVE_LONG_LONG
  18095. const PY_LONG_LONG llb = intval;
  18096. PY_LONG_LONG lla, llx;
  18097. #endif
  18098. const digit* digits = ((PyLongObject*)op1)->ob_digit;
  18099. const Py_ssize_t size = Py_SIZE(op1);
  18100. if (likely(__Pyx_sst_abs(size) <= 1)) {
  18101. a = likely(size) ? digits[0] : 0;
  18102. if (size == -1) a = -a;
  18103. } else {
  18104. switch (size) {
  18105. case -2:
  18106. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  18107. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18108. break;
  18109. #ifdef HAVE_LONG_LONG
  18110. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  18111. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  18112. goto long_long;
  18113. #endif
  18114. }
  18115. CYTHON_FALLTHROUGH;
  18116. case 2:
  18117. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  18118. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18119. break;
  18120. #ifdef HAVE_LONG_LONG
  18121. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  18122. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  18123. goto long_long;
  18124. #endif
  18125. }
  18126. CYTHON_FALLTHROUGH;
  18127. case -3:
  18128. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  18129. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18130. break;
  18131. #ifdef HAVE_LONG_LONG
  18132. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  18133. 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]));
  18134. goto long_long;
  18135. #endif
  18136. }
  18137. CYTHON_FALLTHROUGH;
  18138. case 3:
  18139. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  18140. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18141. break;
  18142. #ifdef HAVE_LONG_LONG
  18143. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  18144. 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]));
  18145. goto long_long;
  18146. #endif
  18147. }
  18148. CYTHON_FALLTHROUGH;
  18149. case -4:
  18150. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  18151. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18152. break;
  18153. #ifdef HAVE_LONG_LONG
  18154. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  18155. 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]));
  18156. goto long_long;
  18157. #endif
  18158. }
  18159. CYTHON_FALLTHROUGH;
  18160. case 4:
  18161. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  18162. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  18163. break;
  18164. #ifdef HAVE_LONG_LONG
  18165. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  18166. 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]));
  18167. goto long_long;
  18168. #endif
  18169. }
  18170. CYTHON_FALLTHROUGH;
  18171. default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  18172. }
  18173. }
  18174. x = a + b;
  18175. return PyLong_FromLong(x);
  18176. #ifdef HAVE_LONG_LONG
  18177. long_long:
  18178. llx = lla + llb;
  18179. return PyLong_FromLongLong(llx);
  18180. #endif
  18181. }
  18182. #endif
  18183. if (PyFloat_CheckExact(op1)) {
  18184. const long b = intval;
  18185. double a = PyFloat_AS_DOUBLE(op1);
  18186. double result;
  18187. PyFPE_START_PROTECT("add", return NULL)
  18188. result = ((double)a) + (double)b;
  18189. PyFPE_END_PROTECT(result)
  18190. return PyFloat_FromDouble(result);
  18191. }
  18192. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  18193. }
  18194. #endif
  18195. /* None */
  18196. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  18197. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  18198. }
  18199. /* None */
  18200. static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
  18201. long q = a / b;
  18202. long r = a - q*b;
  18203. q -= ((r != 0) & ((r ^ b) < 0));
  18204. return q;
  18205. }
  18206. /* ImportFrom */
  18207. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  18208. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  18209. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  18210. PyErr_Format(PyExc_ImportError,
  18211. #if PY_MAJOR_VERSION < 3
  18212. "cannot import name %.230s", PyString_AS_STRING(name));
  18213. #else
  18214. "cannot import name %S", name);
  18215. #endif
  18216. }
  18217. return value;
  18218. }
  18219. /* HasAttr */
  18220. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  18221. PyObject *r;
  18222. if (unlikely(!__Pyx_PyBaseString_Check(n))) {
  18223. PyErr_SetString(PyExc_TypeError,
  18224. "hasattr(): attribute name must be string");
  18225. return -1;
  18226. }
  18227. r = __Pyx_GetAttr(o, n);
  18228. if (unlikely(!r)) {
  18229. PyErr_Clear();
  18230. return 0;
  18231. } else {
  18232. Py_DECREF(r);
  18233. return 1;
  18234. }
  18235. }
  18236. /* PyObject_GenericGetAttrNoDict */
  18237. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  18238. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  18239. PyErr_Format(PyExc_AttributeError,
  18240. #if PY_MAJOR_VERSION >= 3
  18241. "'%.50s' object has no attribute '%U'",
  18242. tp->tp_name, attr_name);
  18243. #else
  18244. "'%.50s' object has no attribute '%.400s'",
  18245. tp->tp_name, PyString_AS_STRING(attr_name));
  18246. #endif
  18247. return NULL;
  18248. }
  18249. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  18250. PyObject *descr;
  18251. PyTypeObject *tp = Py_TYPE(obj);
  18252. if (unlikely(!PyString_Check(attr_name))) {
  18253. return PyObject_GenericGetAttr(obj, attr_name);
  18254. }
  18255. assert(!tp->tp_dictoffset);
  18256. descr = _PyType_Lookup(tp, attr_name);
  18257. if (unlikely(!descr)) {
  18258. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  18259. }
  18260. Py_INCREF(descr);
  18261. #if PY_MAJOR_VERSION < 3
  18262. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  18263. #endif
  18264. {
  18265. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  18266. if (unlikely(f)) {
  18267. PyObject *res = f(descr, obj, (PyObject *)tp);
  18268. Py_DECREF(descr);
  18269. return res;
  18270. }
  18271. }
  18272. return descr;
  18273. }
  18274. #endif
  18275. /* PyObject_GenericGetAttr */
  18276. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  18277. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
  18278. if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
  18279. return PyObject_GenericGetAttr(obj, attr_name);
  18280. }
  18281. return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
  18282. }
  18283. #endif
  18284. /* SetVTable */
  18285. static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
  18286. #if PY_VERSION_HEX >= 0x02070000
  18287. PyObject *ob = PyCapsule_New(vtable, 0, 0);
  18288. #else
  18289. PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
  18290. #endif
  18291. if (!ob)
  18292. goto bad;
  18293. if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
  18294. goto bad;
  18295. Py_DECREF(ob);
  18296. return 0;
  18297. bad:
  18298. Py_XDECREF(ob);
  18299. return -1;
  18300. }
  18301. /* PyObjectGetAttrStrNoError */
  18302. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  18303. __Pyx_PyThreadState_declare
  18304. __Pyx_PyThreadState_assign
  18305. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  18306. __Pyx_PyErr_Clear();
  18307. }
  18308. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  18309. PyObject *result;
  18310. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
  18311. PyTypeObject* tp = Py_TYPE(obj);
  18312. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  18313. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  18314. }
  18315. #endif
  18316. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  18317. if (unlikely(!result)) {
  18318. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  18319. }
  18320. return result;
  18321. }
  18322. /* SetupReduce */
  18323. static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  18324. int ret;
  18325. PyObject *name_attr;
  18326. name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  18327. if (likely(name_attr)) {
  18328. ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  18329. } else {
  18330. ret = -1;
  18331. }
  18332. if (unlikely(ret < 0)) {
  18333. PyErr_Clear();
  18334. ret = 0;
  18335. }
  18336. Py_XDECREF(name_attr);
  18337. return ret;
  18338. }
  18339. static int __Pyx_setup_reduce(PyObject* type_obj) {
  18340. int ret = 0;
  18341. PyObject *object_reduce = NULL;
  18342. PyObject *object_reduce_ex = NULL;
  18343. PyObject *reduce = NULL;
  18344. PyObject *reduce_ex = NULL;
  18345. PyObject *reduce_cython = NULL;
  18346. PyObject *setstate = NULL;
  18347. PyObject *setstate_cython = NULL;
  18348. #if CYTHON_USE_PYTYPE_LOOKUP
  18349. if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  18350. #else
  18351. if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  18352. #endif
  18353. #if CYTHON_USE_PYTYPE_LOOKUP
  18354. object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  18355. #else
  18356. object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  18357. #endif
  18358. reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
  18359. if (reduce_ex == object_reduce_ex) {
  18360. #if CYTHON_USE_PYTYPE_LOOKUP
  18361. object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  18362. #else
  18363. object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  18364. #endif
  18365. reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
  18366. if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
  18367. reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
  18368. if (likely(reduce_cython)) {
  18369. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  18370. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  18371. } else if (reduce == object_reduce || PyErr_Occurred()) {
  18372. goto __PYX_BAD;
  18373. }
  18374. setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
  18375. if (!setstate) PyErr_Clear();
  18376. if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
  18377. setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
  18378. if (likely(setstate_cython)) {
  18379. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  18380. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  18381. } else if (!setstate || PyErr_Occurred()) {
  18382. goto __PYX_BAD;
  18383. }
  18384. }
  18385. PyType_Modified((PyTypeObject*)type_obj);
  18386. }
  18387. }
  18388. goto __PYX_GOOD;
  18389. __PYX_BAD:
  18390. if (!PyErr_Occurred())
  18391. PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
  18392. ret = -1;
  18393. __PYX_GOOD:
  18394. #if !CYTHON_USE_PYTYPE_LOOKUP
  18395. Py_XDECREF(object_reduce);
  18396. Py_XDECREF(object_reduce_ex);
  18397. #endif
  18398. Py_XDECREF(reduce);
  18399. Py_XDECREF(reduce_ex);
  18400. Py_XDECREF(reduce_cython);
  18401. Py_XDECREF(setstate);
  18402. Py_XDECREF(setstate_cython);
  18403. return ret;
  18404. }
  18405. /* TypeImport */
  18406. #ifndef __PYX_HAVE_RT_ImportType
  18407. #define __PYX_HAVE_RT_ImportType
  18408. static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
  18409. size_t size, enum __Pyx_ImportType_CheckSize check_size)
  18410. {
  18411. PyObject *result = 0;
  18412. char warning[200];
  18413. Py_ssize_t basicsize;
  18414. #ifdef Py_LIMITED_API
  18415. PyObject *py_basicsize;
  18416. #endif
  18417. result = PyObject_GetAttrString(module, class_name);
  18418. if (!result)
  18419. goto bad;
  18420. if (!PyType_Check(result)) {
  18421. PyErr_Format(PyExc_TypeError,
  18422. "%.200s.%.200s is not a type object",
  18423. module_name, class_name);
  18424. goto bad;
  18425. }
  18426. #ifndef Py_LIMITED_API
  18427. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  18428. #else
  18429. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  18430. if (!py_basicsize)
  18431. goto bad;
  18432. basicsize = PyLong_AsSsize_t(py_basicsize);
  18433. Py_DECREF(py_basicsize);
  18434. py_basicsize = 0;
  18435. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  18436. goto bad;
  18437. #endif
  18438. if ((size_t)basicsize < size) {
  18439. PyErr_Format(PyExc_ValueError,
  18440. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  18441. "Expected %zd from C header, got %zd from PyObject",
  18442. module_name, class_name, size, basicsize);
  18443. goto bad;
  18444. }
  18445. if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
  18446. PyErr_Format(PyExc_ValueError,
  18447. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  18448. "Expected %zd from C header, got %zd from PyObject",
  18449. module_name, class_name, size, basicsize);
  18450. goto bad;
  18451. }
  18452. else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
  18453. PyOS_snprintf(warning, sizeof(warning),
  18454. "%s.%s size changed, may indicate binary incompatibility. "
  18455. "Expected %zd from C header, got %zd from PyObject",
  18456. module_name, class_name, size, basicsize);
  18457. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  18458. }
  18459. return (PyTypeObject *)result;
  18460. bad:
  18461. Py_XDECREF(result);
  18462. return NULL;
  18463. }
  18464. #endif
  18465. /* CLineInTraceback */
  18466. #ifndef CYTHON_CLINE_IN_TRACEBACK
  18467. static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
  18468. PyObject *use_cline;
  18469. PyObject *ptype, *pvalue, *ptraceback;
  18470. #if CYTHON_COMPILING_IN_CPYTHON
  18471. PyObject **cython_runtime_dict;
  18472. #endif
  18473. if (unlikely(!__pyx_cython_runtime)) {
  18474. return c_line;
  18475. }
  18476. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  18477. #if CYTHON_COMPILING_IN_CPYTHON
  18478. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  18479. if (likely(cython_runtime_dict)) {
  18480. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  18481. use_cline, *cython_runtime_dict,
  18482. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  18483. } else
  18484. #endif
  18485. {
  18486. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  18487. if (use_cline_obj) {
  18488. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  18489. Py_DECREF(use_cline_obj);
  18490. } else {
  18491. PyErr_Clear();
  18492. use_cline = NULL;
  18493. }
  18494. }
  18495. if (!use_cline) {
  18496. c_line = 0;
  18497. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  18498. }
  18499. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  18500. c_line = 0;
  18501. }
  18502. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  18503. return c_line;
  18504. }
  18505. #endif
  18506. /* CodeObjectCache */
  18507. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  18508. int start = 0, mid = 0, end = count - 1;
  18509. if (end >= 0 && code_line > entries[end].code_line) {
  18510. return count;
  18511. }
  18512. while (start < end) {
  18513. mid = start + (end - start) / 2;
  18514. if (code_line < entries[mid].code_line) {
  18515. end = mid;
  18516. } else if (code_line > entries[mid].code_line) {
  18517. start = mid + 1;
  18518. } else {
  18519. return mid;
  18520. }
  18521. }
  18522. if (code_line <= entries[mid].code_line) {
  18523. return mid;
  18524. } else {
  18525. return mid + 1;
  18526. }
  18527. }
  18528. static PyCodeObject *__pyx_find_code_object(int code_line) {
  18529. PyCodeObject* code_object;
  18530. int pos;
  18531. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  18532. return NULL;
  18533. }
  18534. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  18535. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  18536. return NULL;
  18537. }
  18538. code_object = __pyx_code_cache.entries[pos].code_object;
  18539. Py_INCREF(code_object);
  18540. return code_object;
  18541. }
  18542. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  18543. int pos, i;
  18544. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  18545. if (unlikely(!code_line)) {
  18546. return;
  18547. }
  18548. if (unlikely(!entries)) {
  18549. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  18550. if (likely(entries)) {
  18551. __pyx_code_cache.entries = entries;
  18552. __pyx_code_cache.max_count = 64;
  18553. __pyx_code_cache.count = 1;
  18554. entries[0].code_line = code_line;
  18555. entries[0].code_object = code_object;
  18556. Py_INCREF(code_object);
  18557. }
  18558. return;
  18559. }
  18560. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  18561. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  18562. PyCodeObject* tmp = entries[pos].code_object;
  18563. entries[pos].code_object = code_object;
  18564. Py_DECREF(tmp);
  18565. return;
  18566. }
  18567. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  18568. int new_max = __pyx_code_cache.max_count + 64;
  18569. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  18570. __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  18571. if (unlikely(!entries)) {
  18572. return;
  18573. }
  18574. __pyx_code_cache.entries = entries;
  18575. __pyx_code_cache.max_count = new_max;
  18576. }
  18577. for (i=__pyx_code_cache.count; i>pos; i--) {
  18578. entries[i] = entries[i-1];
  18579. }
  18580. entries[pos].code_line = code_line;
  18581. entries[pos].code_object = code_object;
  18582. __pyx_code_cache.count++;
  18583. Py_INCREF(code_object);
  18584. }
  18585. /* AddTraceback */
  18586. #include "compile.h"
  18587. #include "frameobject.h"
  18588. #include "traceback.h"
  18589. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  18590. const char *funcname, int c_line,
  18591. int py_line, const char *filename) {
  18592. PyCodeObject *py_code = 0;
  18593. PyObject *py_srcfile = 0;
  18594. PyObject *py_funcname = 0;
  18595. #if PY_MAJOR_VERSION < 3
  18596. py_srcfile = PyString_FromString(filename);
  18597. #else
  18598. py_srcfile = PyUnicode_FromString(filename);
  18599. #endif
  18600. if (!py_srcfile) goto bad;
  18601. if (c_line) {
  18602. #if PY_MAJOR_VERSION < 3
  18603. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  18604. #else
  18605. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  18606. #endif
  18607. }
  18608. else {
  18609. #if PY_MAJOR_VERSION < 3
  18610. py_funcname = PyString_FromString(funcname);
  18611. #else
  18612. py_funcname = PyUnicode_FromString(funcname);
  18613. #endif
  18614. }
  18615. if (!py_funcname) goto bad;
  18616. py_code = __Pyx_PyCode_New(
  18617. 0,
  18618. 0,
  18619. 0,
  18620. 0,
  18621. 0,
  18622. __pyx_empty_bytes, /*PyObject *code,*/
  18623. __pyx_empty_tuple, /*PyObject *consts,*/
  18624. __pyx_empty_tuple, /*PyObject *names,*/
  18625. __pyx_empty_tuple, /*PyObject *varnames,*/
  18626. __pyx_empty_tuple, /*PyObject *freevars,*/
  18627. __pyx_empty_tuple, /*PyObject *cellvars,*/
  18628. py_srcfile, /*PyObject *filename,*/
  18629. py_funcname, /*PyObject *name,*/
  18630. py_line,
  18631. __pyx_empty_bytes /*PyObject *lnotab*/
  18632. );
  18633. Py_DECREF(py_srcfile);
  18634. Py_DECREF(py_funcname);
  18635. return py_code;
  18636. bad:
  18637. Py_XDECREF(py_srcfile);
  18638. Py_XDECREF(py_funcname);
  18639. return NULL;
  18640. }
  18641. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  18642. int py_line, const char *filename) {
  18643. PyCodeObject *py_code = 0;
  18644. PyFrameObject *py_frame = 0;
  18645. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  18646. if (c_line) {
  18647. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  18648. }
  18649. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  18650. if (!py_code) {
  18651. py_code = __Pyx_CreateCodeObjectForTraceback(
  18652. funcname, c_line, py_line, filename);
  18653. if (!py_code) goto bad;
  18654. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  18655. }
  18656. py_frame = PyFrame_New(
  18657. tstate, /*PyThreadState *tstate,*/
  18658. py_code, /*PyCodeObject *code,*/
  18659. __pyx_d, /*PyObject *globals,*/
  18660. 0 /*PyObject *locals*/
  18661. );
  18662. if (!py_frame) goto bad;
  18663. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  18664. PyTraceBack_Here(py_frame);
  18665. bad:
  18666. Py_XDECREF(py_code);
  18667. Py_XDECREF(py_frame);
  18668. }
  18669. #if PY_MAJOR_VERSION < 3
  18670. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  18671. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  18672. if (__Pyx_TypeCheck(obj, __pyx_ptype_7cpython_5array_array)) return __pyx_pw_7cpython_5array_5array_1__getbuffer__(obj, view, flags);
  18673. if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
  18674. if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
  18675. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  18676. return -1;
  18677. }
  18678. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  18679. PyObject *obj = view->obj;
  18680. if (!obj) return;
  18681. if (PyObject_CheckBuffer(obj)) {
  18682. PyBuffer_Release(view);
  18683. return;
  18684. }
  18685. if ((0)) {}
  18686. else if (__Pyx_TypeCheck(obj, __pyx_ptype_7cpython_5array_array)) __pyx_pw_7cpython_5array_5array_3__releasebuffer__(obj, view);
  18687. view->obj = NULL;
  18688. Py_DECREF(obj);
  18689. }
  18690. #endif
  18691. /* MemviewSliceIsContig */
  18692. static int
  18693. __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
  18694. {
  18695. int i, index, step, start;
  18696. Py_ssize_t itemsize = mvs.memview->view.itemsize;
  18697. if (order == 'F') {
  18698. step = 1;
  18699. start = 0;
  18700. } else {
  18701. step = -1;
  18702. start = ndim - 1;
  18703. }
  18704. for (i = 0; i < ndim; i++) {
  18705. index = start + step * i;
  18706. if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
  18707. return 0;
  18708. itemsize *= mvs.shape[index];
  18709. }
  18710. return 1;
  18711. }
  18712. /* OverlappingSlices */
  18713. static void
  18714. __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
  18715. void **out_start, void **out_end,
  18716. int ndim, size_t itemsize)
  18717. {
  18718. char *start, *end;
  18719. int i;
  18720. start = end = slice->data;
  18721. for (i = 0; i < ndim; i++) {
  18722. Py_ssize_t stride = slice->strides[i];
  18723. Py_ssize_t extent = slice->shape[i];
  18724. if (extent == 0) {
  18725. *out_start = *out_end = start;
  18726. return;
  18727. } else {
  18728. if (stride > 0)
  18729. end += stride * (extent - 1);
  18730. else
  18731. start += stride * (extent - 1);
  18732. }
  18733. }
  18734. *out_start = start;
  18735. *out_end = end + itemsize;
  18736. }
  18737. static int
  18738. __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  18739. __Pyx_memviewslice *slice2,
  18740. int ndim, size_t itemsize)
  18741. {
  18742. void *start1, *end1, *start2, *end2;
  18743. __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
  18744. __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
  18745. return (start1 < end2) && (start2 < end1);
  18746. }
  18747. /* Capsule */
  18748. static CYTHON_INLINE PyObject *
  18749. __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
  18750. {
  18751. PyObject *cobj;
  18752. #if PY_VERSION_HEX >= 0x02070000
  18753. cobj = PyCapsule_New(p, sig, NULL);
  18754. #else
  18755. cobj = PyCObject_FromVoidPtr(p, NULL);
  18756. #endif
  18757. return cobj;
  18758. }
  18759. /* CIntFromPyVerify */
  18760. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  18761. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  18762. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  18763. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  18764. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  18765. {\
  18766. func_type value = func_value;\
  18767. if (sizeof(target_type) < sizeof(func_type)) {\
  18768. if (unlikely(value != (func_type) (target_type) value)) {\
  18769. func_type zero = 0;\
  18770. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  18771. return (target_type) -1;\
  18772. if (is_unsigned && unlikely(value < zero))\
  18773. goto raise_neg_overflow;\
  18774. else\
  18775. goto raise_overflow;\
  18776. }\
  18777. }\
  18778. return (target_type) value;\
  18779. }
  18780. /* CIntToPy */
  18781. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  18782. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  18783. const int is_unsigned = neg_one > const_zero;
  18784. if (is_unsigned) {
  18785. if (sizeof(int) < sizeof(long)) {
  18786. return PyInt_FromLong((long) value);
  18787. } else if (sizeof(int) <= sizeof(unsigned long)) {
  18788. return PyLong_FromUnsignedLong((unsigned long) value);
  18789. #ifdef HAVE_LONG_LONG
  18790. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  18791. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  18792. #endif
  18793. }
  18794. } else {
  18795. if (sizeof(int) <= sizeof(long)) {
  18796. return PyInt_FromLong((long) value);
  18797. #ifdef HAVE_LONG_LONG
  18798. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  18799. return PyLong_FromLongLong((PY_LONG_LONG) value);
  18800. #endif
  18801. }
  18802. }
  18803. {
  18804. int one = 1; int little = (int)*(unsigned char *)&one;
  18805. unsigned char *bytes = (unsigned char *)&value;
  18806. return _PyLong_FromByteArray(bytes, sizeof(int),
  18807. little, !is_unsigned);
  18808. }
  18809. }
  18810. /* MemviewDtypeToObject */
  18811. static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
  18812. return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
  18813. }
  18814. static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
  18815. int value = __Pyx_PyInt_As_int(obj);
  18816. if ((value == (int)-1) && PyErr_Occurred())
  18817. return 0;
  18818. *(int *) itemp = value;
  18819. return 1;
  18820. }
  18821. /* MemviewSliceCopyTemplate */
  18822. static __Pyx_memviewslice
  18823. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  18824. const char *mode, int ndim,
  18825. size_t sizeof_dtype, int contig_flag,
  18826. int dtype_is_object)
  18827. {
  18828. __Pyx_RefNannyDeclarations
  18829. int i;
  18830. __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
  18831. struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
  18832. Py_buffer *buf = &from_memview->view;
  18833. PyObject *shape_tuple = NULL;
  18834. PyObject *temp_int = NULL;
  18835. struct __pyx_array_obj *array_obj = NULL;
  18836. struct __pyx_memoryview_obj *memview_obj = NULL;
  18837. __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
  18838. for (i = 0; i < ndim; i++) {
  18839. if (unlikely(from_mvs->suboffsets[i] >= 0)) {
  18840. PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
  18841. "indirect dimensions (axis %d)", i);
  18842. goto fail;
  18843. }
  18844. }
  18845. shape_tuple = PyTuple_New(ndim);
  18846. if (unlikely(!shape_tuple)) {
  18847. goto fail;
  18848. }
  18849. __Pyx_GOTREF(shape_tuple);
  18850. for(i = 0; i < ndim; i++) {
  18851. temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
  18852. if(unlikely(!temp_int)) {
  18853. goto fail;
  18854. } else {
  18855. PyTuple_SET_ITEM(shape_tuple, i, temp_int);
  18856. temp_int = NULL;
  18857. }
  18858. }
  18859. array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
  18860. if (unlikely(!array_obj)) {
  18861. goto fail;
  18862. }
  18863. __Pyx_GOTREF(array_obj);
  18864. memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  18865. (PyObject *) array_obj, contig_flag,
  18866. dtype_is_object,
  18867. from_mvs->memview->typeinfo);
  18868. if (unlikely(!memview_obj))
  18869. goto fail;
  18870. if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
  18871. goto fail;
  18872. if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
  18873. dtype_is_object) < 0))
  18874. goto fail;
  18875. goto no_fail;
  18876. fail:
  18877. __Pyx_XDECREF(new_mvs.memview);
  18878. new_mvs.memview = NULL;
  18879. new_mvs.data = NULL;
  18880. no_fail:
  18881. __Pyx_XDECREF(shape_tuple);
  18882. __Pyx_XDECREF(temp_int);
  18883. __Pyx_XDECREF(array_obj);
  18884. __Pyx_RefNannyFinishContext();
  18885. return new_mvs;
  18886. }
  18887. /* CIntFromPy */
  18888. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  18889. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  18890. const int is_unsigned = neg_one > const_zero;
  18891. #if PY_MAJOR_VERSION < 3
  18892. if (likely(PyInt_Check(x))) {
  18893. if (sizeof(int) < sizeof(long)) {
  18894. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  18895. } else {
  18896. long val = PyInt_AS_LONG(x);
  18897. if (is_unsigned && unlikely(val < 0)) {
  18898. goto raise_neg_overflow;
  18899. }
  18900. return (int) val;
  18901. }
  18902. } else
  18903. #endif
  18904. if (likely(PyLong_Check(x))) {
  18905. if (is_unsigned) {
  18906. #if CYTHON_USE_PYLONG_INTERNALS
  18907. const digit* digits = ((PyLongObject*)x)->ob_digit;
  18908. switch (Py_SIZE(x)) {
  18909. case 0: return (int) 0;
  18910. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  18911. case 2:
  18912. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  18913. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  18914. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18915. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  18916. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  18917. }
  18918. }
  18919. break;
  18920. case 3:
  18921. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  18922. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  18923. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18924. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  18925. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  18926. }
  18927. }
  18928. break;
  18929. case 4:
  18930. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  18931. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  18932. __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])))
  18933. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  18934. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  18935. }
  18936. }
  18937. break;
  18938. }
  18939. #endif
  18940. #if CYTHON_COMPILING_IN_CPYTHON
  18941. if (unlikely(Py_SIZE(x) < 0)) {
  18942. goto raise_neg_overflow;
  18943. }
  18944. #else
  18945. {
  18946. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  18947. if (unlikely(result < 0))
  18948. return (int) -1;
  18949. if (unlikely(result == 1))
  18950. goto raise_neg_overflow;
  18951. }
  18952. #endif
  18953. if (sizeof(int) <= sizeof(unsigned long)) {
  18954. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  18955. #ifdef HAVE_LONG_LONG
  18956. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  18957. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  18958. #endif
  18959. }
  18960. } else {
  18961. #if CYTHON_USE_PYLONG_INTERNALS
  18962. const digit* digits = ((PyLongObject*)x)->ob_digit;
  18963. switch (Py_SIZE(x)) {
  18964. case 0: return (int) 0;
  18965. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  18966. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  18967. case -2:
  18968. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  18969. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  18970. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18971. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  18972. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  18973. }
  18974. }
  18975. break;
  18976. case 2:
  18977. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  18978. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  18979. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18980. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  18981. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  18982. }
  18983. }
  18984. break;
  18985. case -3:
  18986. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  18987. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  18988. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18989. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  18990. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  18991. }
  18992. }
  18993. break;
  18994. case 3:
  18995. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  18996. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  18997. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  18998. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  18999. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  19000. }
  19001. }
  19002. break;
  19003. case -4:
  19004. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  19005. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19006. __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])))
  19007. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  19008. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  19009. }
  19010. }
  19011. break;
  19012. case 4:
  19013. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  19014. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19015. __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])))
  19016. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  19017. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  19018. }
  19019. }
  19020. break;
  19021. }
  19022. #endif
  19023. if (sizeof(int) <= sizeof(long)) {
  19024. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  19025. #ifdef HAVE_LONG_LONG
  19026. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  19027. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  19028. #endif
  19029. }
  19030. }
  19031. {
  19032. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  19033. PyErr_SetString(PyExc_RuntimeError,
  19034. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  19035. #else
  19036. int val;
  19037. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  19038. #if PY_MAJOR_VERSION < 3
  19039. if (likely(v) && !PyLong_Check(v)) {
  19040. PyObject *tmp = v;
  19041. v = PyNumber_Long(tmp);
  19042. Py_DECREF(tmp);
  19043. }
  19044. #endif
  19045. if (likely(v)) {
  19046. int one = 1; int is_little = (int)*(unsigned char *)&one;
  19047. unsigned char *bytes = (unsigned char *)&val;
  19048. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  19049. bytes, sizeof(val),
  19050. is_little, !is_unsigned);
  19051. Py_DECREF(v);
  19052. if (likely(!ret))
  19053. return val;
  19054. }
  19055. #endif
  19056. return (int) -1;
  19057. }
  19058. } else {
  19059. int val;
  19060. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  19061. if (!tmp) return (int) -1;
  19062. val = __Pyx_PyInt_As_int(tmp);
  19063. Py_DECREF(tmp);
  19064. return val;
  19065. }
  19066. raise_overflow:
  19067. PyErr_SetString(PyExc_OverflowError,
  19068. "value too large to convert to int");
  19069. return (int) -1;
  19070. raise_neg_overflow:
  19071. PyErr_SetString(PyExc_OverflowError,
  19072. "can't convert negative value to int");
  19073. return (int) -1;
  19074. }
  19075. /* CIntFromPy */
  19076. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  19077. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  19078. const int is_unsigned = neg_one > const_zero;
  19079. #if PY_MAJOR_VERSION < 3
  19080. if (likely(PyInt_Check(x))) {
  19081. if (sizeof(long) < sizeof(long)) {
  19082. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  19083. } else {
  19084. long val = PyInt_AS_LONG(x);
  19085. if (is_unsigned && unlikely(val < 0)) {
  19086. goto raise_neg_overflow;
  19087. }
  19088. return (long) val;
  19089. }
  19090. } else
  19091. #endif
  19092. if (likely(PyLong_Check(x))) {
  19093. if (is_unsigned) {
  19094. #if CYTHON_USE_PYLONG_INTERNALS
  19095. const digit* digits = ((PyLongObject*)x)->ob_digit;
  19096. switch (Py_SIZE(x)) {
  19097. case 0: return (long) 0;
  19098. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  19099. case 2:
  19100. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  19101. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19102. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19103. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  19104. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  19105. }
  19106. }
  19107. break;
  19108. case 3:
  19109. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  19110. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19111. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19112. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  19113. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  19114. }
  19115. }
  19116. break;
  19117. case 4:
  19118. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  19119. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19120. __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])))
  19121. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  19122. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  19123. }
  19124. }
  19125. break;
  19126. }
  19127. #endif
  19128. #if CYTHON_COMPILING_IN_CPYTHON
  19129. if (unlikely(Py_SIZE(x) < 0)) {
  19130. goto raise_neg_overflow;
  19131. }
  19132. #else
  19133. {
  19134. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  19135. if (unlikely(result < 0))
  19136. return (long) -1;
  19137. if (unlikely(result == 1))
  19138. goto raise_neg_overflow;
  19139. }
  19140. #endif
  19141. if (sizeof(long) <= sizeof(unsigned long)) {
  19142. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  19143. #ifdef HAVE_LONG_LONG
  19144. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  19145. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  19146. #endif
  19147. }
  19148. } else {
  19149. #if CYTHON_USE_PYLONG_INTERNALS
  19150. const digit* digits = ((PyLongObject*)x)->ob_digit;
  19151. switch (Py_SIZE(x)) {
  19152. case 0: return (long) 0;
  19153. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  19154. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  19155. case -2:
  19156. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  19157. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19158. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19159. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  19160. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19161. }
  19162. }
  19163. break;
  19164. case 2:
  19165. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  19166. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19167. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19168. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  19169. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19170. }
  19171. }
  19172. break;
  19173. case -3:
  19174. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  19175. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19176. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19177. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  19178. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19179. }
  19180. }
  19181. break;
  19182. case 3:
  19183. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  19184. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19185. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19186. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  19187. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19188. }
  19189. }
  19190. break;
  19191. case -4:
  19192. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  19193. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19194. __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])))
  19195. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  19196. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19197. }
  19198. }
  19199. break;
  19200. case 4:
  19201. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  19202. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19203. __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])))
  19204. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  19205. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  19206. }
  19207. }
  19208. break;
  19209. }
  19210. #endif
  19211. if (sizeof(long) <= sizeof(long)) {
  19212. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  19213. #ifdef HAVE_LONG_LONG
  19214. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  19215. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  19216. #endif
  19217. }
  19218. }
  19219. {
  19220. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  19221. PyErr_SetString(PyExc_RuntimeError,
  19222. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  19223. #else
  19224. long val;
  19225. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  19226. #if PY_MAJOR_VERSION < 3
  19227. if (likely(v) && !PyLong_Check(v)) {
  19228. PyObject *tmp = v;
  19229. v = PyNumber_Long(tmp);
  19230. Py_DECREF(tmp);
  19231. }
  19232. #endif
  19233. if (likely(v)) {
  19234. int one = 1; int is_little = (int)*(unsigned char *)&one;
  19235. unsigned char *bytes = (unsigned char *)&val;
  19236. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  19237. bytes, sizeof(val),
  19238. is_little, !is_unsigned);
  19239. Py_DECREF(v);
  19240. if (likely(!ret))
  19241. return val;
  19242. }
  19243. #endif
  19244. return (long) -1;
  19245. }
  19246. } else {
  19247. long val;
  19248. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  19249. if (!tmp) return (long) -1;
  19250. val = __Pyx_PyInt_As_long(tmp);
  19251. Py_DECREF(tmp);
  19252. return val;
  19253. }
  19254. raise_overflow:
  19255. PyErr_SetString(PyExc_OverflowError,
  19256. "value too large to convert to long");
  19257. return (long) -1;
  19258. raise_neg_overflow:
  19259. PyErr_SetString(PyExc_OverflowError,
  19260. "can't convert negative value to long");
  19261. return (long) -1;
  19262. }
  19263. /* CIntToPy */
  19264. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  19265. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  19266. const int is_unsigned = neg_one > const_zero;
  19267. if (is_unsigned) {
  19268. if (sizeof(long) < sizeof(long)) {
  19269. return PyInt_FromLong((long) value);
  19270. } else if (sizeof(long) <= sizeof(unsigned long)) {
  19271. return PyLong_FromUnsignedLong((unsigned long) value);
  19272. #ifdef HAVE_LONG_LONG
  19273. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  19274. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  19275. #endif
  19276. }
  19277. } else {
  19278. if (sizeof(long) <= sizeof(long)) {
  19279. return PyInt_FromLong((long) value);
  19280. #ifdef HAVE_LONG_LONG
  19281. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  19282. return PyLong_FromLongLong((PY_LONG_LONG) value);
  19283. #endif
  19284. }
  19285. }
  19286. {
  19287. int one = 1; int little = (int)*(unsigned char *)&one;
  19288. unsigned char *bytes = (unsigned char *)&value;
  19289. return _PyLong_FromByteArray(bytes, sizeof(long),
  19290. little, !is_unsigned);
  19291. }
  19292. }
  19293. /* CIntFromPy */
  19294. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
  19295. const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
  19296. const int is_unsigned = neg_one > const_zero;
  19297. #if PY_MAJOR_VERSION < 3
  19298. if (likely(PyInt_Check(x))) {
  19299. if (sizeof(char) < sizeof(long)) {
  19300. __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
  19301. } else {
  19302. long val = PyInt_AS_LONG(x);
  19303. if (is_unsigned && unlikely(val < 0)) {
  19304. goto raise_neg_overflow;
  19305. }
  19306. return (char) val;
  19307. }
  19308. } else
  19309. #endif
  19310. if (likely(PyLong_Check(x))) {
  19311. if (is_unsigned) {
  19312. #if CYTHON_USE_PYLONG_INTERNALS
  19313. const digit* digits = ((PyLongObject*)x)->ob_digit;
  19314. switch (Py_SIZE(x)) {
  19315. case 0: return (char) 0;
  19316. case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
  19317. case 2:
  19318. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  19319. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19320. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19321. } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
  19322. return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  19323. }
  19324. }
  19325. break;
  19326. case 3:
  19327. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  19328. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19329. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19330. } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
  19331. return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  19332. }
  19333. }
  19334. break;
  19335. case 4:
  19336. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  19337. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19338. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19339. } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
  19340. return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  19341. }
  19342. }
  19343. break;
  19344. }
  19345. #endif
  19346. #if CYTHON_COMPILING_IN_CPYTHON
  19347. if (unlikely(Py_SIZE(x) < 0)) {
  19348. goto raise_neg_overflow;
  19349. }
  19350. #else
  19351. {
  19352. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  19353. if (unlikely(result < 0))
  19354. return (char) -1;
  19355. if (unlikely(result == 1))
  19356. goto raise_neg_overflow;
  19357. }
  19358. #endif
  19359. if (sizeof(char) <= sizeof(unsigned long)) {
  19360. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
  19361. #ifdef HAVE_LONG_LONG
  19362. } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
  19363. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  19364. #endif
  19365. }
  19366. } else {
  19367. #if CYTHON_USE_PYLONG_INTERNALS
  19368. const digit* digits = ((PyLongObject*)x)->ob_digit;
  19369. switch (Py_SIZE(x)) {
  19370. case 0: return (char) 0;
  19371. case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
  19372. case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
  19373. case -2:
  19374. if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
  19375. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19376. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19377. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  19378. return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19379. }
  19380. }
  19381. break;
  19382. case 2:
  19383. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  19384. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  19385. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19386. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  19387. return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19388. }
  19389. }
  19390. break;
  19391. case -3:
  19392. if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  19393. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19394. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19395. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  19396. return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19397. }
  19398. }
  19399. break;
  19400. case 3:
  19401. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  19402. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  19403. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19404. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  19405. return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19406. }
  19407. }
  19408. break;
  19409. case -4:
  19410. if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  19411. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19412. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19413. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  19414. return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19415. }
  19416. }
  19417. break;
  19418. case 4:
  19419. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  19420. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  19421. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  19422. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  19423. return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  19424. }
  19425. }
  19426. break;
  19427. }
  19428. #endif
  19429. if (sizeof(char) <= sizeof(long)) {
  19430. __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
  19431. #ifdef HAVE_LONG_LONG
  19432. } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
  19433. __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
  19434. #endif
  19435. }
  19436. }
  19437. {
  19438. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  19439. PyErr_SetString(PyExc_RuntimeError,
  19440. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  19441. #else
  19442. char val;
  19443. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  19444. #if PY_MAJOR_VERSION < 3
  19445. if (likely(v) && !PyLong_Check(v)) {
  19446. PyObject *tmp = v;
  19447. v = PyNumber_Long(tmp);
  19448. Py_DECREF(tmp);
  19449. }
  19450. #endif
  19451. if (likely(v)) {
  19452. int one = 1; int is_little = (int)*(unsigned char *)&one;
  19453. unsigned char *bytes = (unsigned char *)&val;
  19454. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  19455. bytes, sizeof(val),
  19456. is_little, !is_unsigned);
  19457. Py_DECREF(v);
  19458. if (likely(!ret))
  19459. return val;
  19460. }
  19461. #endif
  19462. return (char) -1;
  19463. }
  19464. } else {
  19465. char val;
  19466. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  19467. if (!tmp) return (char) -1;
  19468. val = __Pyx_PyInt_As_char(tmp);
  19469. Py_DECREF(tmp);
  19470. return val;
  19471. }
  19472. raise_overflow:
  19473. PyErr_SetString(PyExc_OverflowError,
  19474. "value too large to convert to char");
  19475. return (char) -1;
  19476. raise_neg_overflow:
  19477. PyErr_SetString(PyExc_OverflowError,
  19478. "can't convert negative value to char");
  19479. return (char) -1;
  19480. }
  19481. /* IsLittleEndian */
  19482. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  19483. {
  19484. union {
  19485. uint32_t u32;
  19486. uint8_t u8[4];
  19487. } S;
  19488. S.u32 = 0x01020304;
  19489. return S.u8[0] == 4;
  19490. }
  19491. /* BufferFormatCheck */
  19492. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  19493. __Pyx_BufFmt_StackElem* stack,
  19494. __Pyx_TypeInfo* type) {
  19495. stack[0].field = &ctx->root;
  19496. stack[0].parent_offset = 0;
  19497. ctx->root.type = type;
  19498. ctx->root.name = "buffer dtype";
  19499. ctx->root.offset = 0;
  19500. ctx->head = stack;
  19501. ctx->head->field = &ctx->root;
  19502. ctx->fmt_offset = 0;
  19503. ctx->head->parent_offset = 0;
  19504. ctx->new_packmode = '@';
  19505. ctx->enc_packmode = '@';
  19506. ctx->new_count = 1;
  19507. ctx->enc_count = 0;
  19508. ctx->enc_type = 0;
  19509. ctx->is_complex = 0;
  19510. ctx->is_valid_array = 0;
  19511. ctx->struct_alignment = 0;
  19512. while (type->typegroup == 'S') {
  19513. ++ctx->head;
  19514. ctx->head->field = type->fields;
  19515. ctx->head->parent_offset = 0;
  19516. type = type->fields->type;
  19517. }
  19518. }
  19519. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  19520. int count;
  19521. const char* t = *ts;
  19522. if (*t < '0' || *t > '9') {
  19523. return -1;
  19524. } else {
  19525. count = *t++ - '0';
  19526. while (*t >= '0' && *t <= '9') {
  19527. count *= 10;
  19528. count += *t++ - '0';
  19529. }
  19530. }
  19531. *ts = t;
  19532. return count;
  19533. }
  19534. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  19535. int number = __Pyx_BufFmt_ParseNumber(ts);
  19536. if (number == -1)
  19537. PyErr_Format(PyExc_ValueError,\
  19538. "Does not understand character buffer dtype format string ('%c')", **ts);
  19539. return number;
  19540. }
  19541. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  19542. PyErr_Format(PyExc_ValueError,
  19543. "Unexpected format string character: '%c'", ch);
  19544. }
  19545. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  19546. switch (ch) {
  19547. case '?': return "'bool'";
  19548. case 'c': return "'char'";
  19549. case 'b': return "'signed char'";
  19550. case 'B': return "'unsigned char'";
  19551. case 'h': return "'short'";
  19552. case 'H': return "'unsigned short'";
  19553. case 'i': return "'int'";
  19554. case 'I': return "'unsigned int'";
  19555. case 'l': return "'long'";
  19556. case 'L': return "'unsigned long'";
  19557. case 'q': return "'long long'";
  19558. case 'Q': return "'unsigned long long'";
  19559. case 'f': return (is_complex ? "'complex float'" : "'float'");
  19560. case 'd': return (is_complex ? "'complex double'" : "'double'");
  19561. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  19562. case 'T': return "a struct";
  19563. case 'O': return "Python object";
  19564. case 'P': return "a pointer";
  19565. case 's': case 'p': return "a string";
  19566. case 0: return "end";
  19567. default: return "unparseable format string";
  19568. }
  19569. }
  19570. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  19571. switch (ch) {
  19572. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  19573. case 'h': case 'H': return 2;
  19574. case 'i': case 'I': case 'l': case 'L': return 4;
  19575. case 'q': case 'Q': return 8;
  19576. case 'f': return (is_complex ? 8 : 4);
  19577. case 'd': return (is_complex ? 16 : 8);
  19578. case 'g': {
  19579. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  19580. return 0;
  19581. }
  19582. case 'O': case 'P': return sizeof(void*);
  19583. default:
  19584. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  19585. return 0;
  19586. }
  19587. }
  19588. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  19589. switch (ch) {
  19590. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  19591. case 'h': case 'H': return sizeof(short);
  19592. case 'i': case 'I': return sizeof(int);
  19593. case 'l': case 'L': return sizeof(long);
  19594. #ifdef HAVE_LONG_LONG
  19595. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  19596. #endif
  19597. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  19598. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  19599. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  19600. case 'O': case 'P': return sizeof(void*);
  19601. default: {
  19602. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  19603. return 0;
  19604. }
  19605. }
  19606. }
  19607. typedef struct { char c; short x; } __Pyx_st_short;
  19608. typedef struct { char c; int x; } __Pyx_st_int;
  19609. typedef struct { char c; long x; } __Pyx_st_long;
  19610. typedef struct { char c; float x; } __Pyx_st_float;
  19611. typedef struct { char c; double x; } __Pyx_st_double;
  19612. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  19613. typedef struct { char c; void *x; } __Pyx_st_void_p;
  19614. #ifdef HAVE_LONG_LONG
  19615. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  19616. #endif
  19617. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  19618. switch (ch) {
  19619. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  19620. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  19621. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  19622. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  19623. #ifdef HAVE_LONG_LONG
  19624. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  19625. #endif
  19626. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  19627. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  19628. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  19629. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  19630. default:
  19631. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  19632. return 0;
  19633. }
  19634. }
  19635. /* These are for computing the padding at the end of the struct to align
  19636. on the first member of the struct. This will probably the same as above,
  19637. but we don't have any guarantees.
  19638. */
  19639. typedef struct { short x; char c; } __Pyx_pad_short;
  19640. typedef struct { int x; char c; } __Pyx_pad_int;
  19641. typedef struct { long x; char c; } __Pyx_pad_long;
  19642. typedef struct { float x; char c; } __Pyx_pad_float;
  19643. typedef struct { double x; char c; } __Pyx_pad_double;
  19644. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  19645. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  19646. #ifdef HAVE_LONG_LONG
  19647. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  19648. #endif
  19649. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  19650. switch (ch) {
  19651. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  19652. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  19653. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  19654. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  19655. #ifdef HAVE_LONG_LONG
  19656. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  19657. #endif
  19658. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  19659. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  19660. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  19661. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  19662. default:
  19663. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  19664. return 0;
  19665. }
  19666. }
  19667. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  19668. switch (ch) {
  19669. case 'c':
  19670. return 'H';
  19671. case 'b': case 'h': case 'i':
  19672. case 'l': case 'q': case 's': case 'p':
  19673. return 'I';
  19674. case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
  19675. return 'U';
  19676. case 'f': case 'd': case 'g':
  19677. return (is_complex ? 'C' : 'R');
  19678. case 'O':
  19679. return 'O';
  19680. case 'P':
  19681. return 'P';
  19682. default: {
  19683. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  19684. return 0;
  19685. }
  19686. }
  19687. }
  19688. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  19689. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  19690. const char* expected;
  19691. const char* quote;
  19692. if (ctx->head == NULL) {
  19693. expected = "end";
  19694. quote = "";
  19695. } else {
  19696. expected = ctx->head->field->type->name;
  19697. quote = "'";
  19698. }
  19699. PyErr_Format(PyExc_ValueError,
  19700. "Buffer dtype mismatch, expected %s%s%s but got %s",
  19701. quote, expected, quote,
  19702. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  19703. } else {
  19704. __Pyx_StructField* field = ctx->head->field;
  19705. __Pyx_StructField* parent = (ctx->head - 1)->field;
  19706. PyErr_Format(PyExc_ValueError,
  19707. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  19708. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  19709. parent->type->name, field->name);
  19710. }
  19711. }
  19712. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  19713. char group;
  19714. size_t size, offset, arraysize = 1;
  19715. if (ctx->enc_type == 0) return 0;
  19716. if (ctx->head->field->type->arraysize[0]) {
  19717. int i, ndim = 0;
  19718. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  19719. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  19720. ndim = 1;
  19721. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  19722. PyErr_Format(PyExc_ValueError,
  19723. "Expected a dimension of size %zu, got %zu",
  19724. ctx->head->field->type->arraysize[0], ctx->enc_count);
  19725. return -1;
  19726. }
  19727. }
  19728. if (!ctx->is_valid_array) {
  19729. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  19730. ctx->head->field->type->ndim, ndim);
  19731. return -1;
  19732. }
  19733. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  19734. arraysize *= ctx->head->field->type->arraysize[i];
  19735. }
  19736. ctx->is_valid_array = 0;
  19737. ctx->enc_count = 1;
  19738. }
  19739. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  19740. do {
  19741. __Pyx_StructField* field = ctx->head->field;
  19742. __Pyx_TypeInfo* type = field->type;
  19743. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  19744. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  19745. } else {
  19746. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  19747. }
  19748. if (ctx->enc_packmode == '@') {
  19749. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  19750. size_t align_mod_offset;
  19751. if (align_at == 0) return -1;
  19752. align_mod_offset = ctx->fmt_offset % align_at;
  19753. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  19754. if (ctx->struct_alignment == 0)
  19755. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  19756. ctx->is_complex);
  19757. }
  19758. if (type->size != size || type->typegroup != group) {
  19759. if (type->typegroup == 'C' && type->fields != NULL) {
  19760. size_t parent_offset = ctx->head->parent_offset + field->offset;
  19761. ++ctx->head;
  19762. ctx->head->field = type->fields;
  19763. ctx->head->parent_offset = parent_offset;
  19764. continue;
  19765. }
  19766. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  19767. } else {
  19768. __Pyx_BufFmt_RaiseExpected(ctx);
  19769. return -1;
  19770. }
  19771. }
  19772. offset = ctx->head->parent_offset + field->offset;
  19773. if (ctx->fmt_offset != offset) {
  19774. PyErr_Format(PyExc_ValueError,
  19775. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  19776. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  19777. return -1;
  19778. }
  19779. ctx->fmt_offset += size;
  19780. if (arraysize)
  19781. ctx->fmt_offset += (arraysize - 1) * size;
  19782. --ctx->enc_count;
  19783. while (1) {
  19784. if (field == &ctx->root) {
  19785. ctx->head = NULL;
  19786. if (ctx->enc_count != 0) {
  19787. __Pyx_BufFmt_RaiseExpected(ctx);
  19788. return -1;
  19789. }
  19790. break;
  19791. }
  19792. ctx->head->field = ++field;
  19793. if (field->type == NULL) {
  19794. --ctx->head;
  19795. field = ctx->head->field;
  19796. continue;
  19797. } else if (field->type->typegroup == 'S') {
  19798. size_t parent_offset = ctx->head->parent_offset + field->offset;
  19799. if (field->type->fields->type == NULL) continue;
  19800. field = field->type->fields;
  19801. ++ctx->head;
  19802. ctx->head->field = field;
  19803. ctx->head->parent_offset = parent_offset;
  19804. break;
  19805. } else {
  19806. break;
  19807. }
  19808. }
  19809. } while (ctx->enc_count);
  19810. ctx->enc_type = 0;
  19811. ctx->is_complex = 0;
  19812. return 0;
  19813. }
  19814. static PyObject *
  19815. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  19816. {
  19817. const char *ts = *tsp;
  19818. int i = 0, number, ndim;
  19819. ++ts;
  19820. if (ctx->new_count != 1) {
  19821. PyErr_SetString(PyExc_ValueError,
  19822. "Cannot handle repeated arrays in format string");
  19823. return NULL;
  19824. }
  19825. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19826. ndim = ctx->head->field->type->ndim;
  19827. while (*ts && *ts != ')') {
  19828. switch (*ts) {
  19829. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  19830. default: break;
  19831. }
  19832. number = __Pyx_BufFmt_ExpectNumber(&ts);
  19833. if (number == -1) return NULL;
  19834. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  19835. return PyErr_Format(PyExc_ValueError,
  19836. "Expected a dimension of size %zu, got %d",
  19837. ctx->head->field->type->arraysize[i], number);
  19838. if (*ts != ',' && *ts != ')')
  19839. return PyErr_Format(PyExc_ValueError,
  19840. "Expected a comma in format string, got '%c'", *ts);
  19841. if (*ts == ',') ts++;
  19842. i++;
  19843. }
  19844. if (i != ndim)
  19845. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  19846. ctx->head->field->type->ndim, i);
  19847. if (!*ts) {
  19848. PyErr_SetString(PyExc_ValueError,
  19849. "Unexpected end of format string, expected ')'");
  19850. return NULL;
  19851. }
  19852. ctx->is_valid_array = 1;
  19853. ctx->new_count = 1;
  19854. *tsp = ++ts;
  19855. return Py_None;
  19856. }
  19857. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  19858. int got_Z = 0;
  19859. while (1) {
  19860. switch(*ts) {
  19861. case 0:
  19862. if (ctx->enc_type != 0 && ctx->head == NULL) {
  19863. __Pyx_BufFmt_RaiseExpected(ctx);
  19864. return NULL;
  19865. }
  19866. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19867. if (ctx->head != NULL) {
  19868. __Pyx_BufFmt_RaiseExpected(ctx);
  19869. return NULL;
  19870. }
  19871. return ts;
  19872. case ' ':
  19873. case '\r':
  19874. case '\n':
  19875. ++ts;
  19876. break;
  19877. case '<':
  19878. if (!__Pyx_Is_Little_Endian()) {
  19879. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  19880. return NULL;
  19881. }
  19882. ctx->new_packmode = '=';
  19883. ++ts;
  19884. break;
  19885. case '>':
  19886. case '!':
  19887. if (__Pyx_Is_Little_Endian()) {
  19888. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  19889. return NULL;
  19890. }
  19891. ctx->new_packmode = '=';
  19892. ++ts;
  19893. break;
  19894. case '=':
  19895. case '@':
  19896. case '^':
  19897. ctx->new_packmode = *ts++;
  19898. break;
  19899. case 'T':
  19900. {
  19901. const char* ts_after_sub;
  19902. size_t i, struct_count = ctx->new_count;
  19903. size_t struct_alignment = ctx->struct_alignment;
  19904. ctx->new_count = 1;
  19905. ++ts;
  19906. if (*ts != '{') {
  19907. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  19908. return NULL;
  19909. }
  19910. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19911. ctx->enc_type = 0;
  19912. ctx->enc_count = 0;
  19913. ctx->struct_alignment = 0;
  19914. ++ts;
  19915. ts_after_sub = ts;
  19916. for (i = 0; i != struct_count; ++i) {
  19917. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  19918. if (!ts_after_sub) return NULL;
  19919. }
  19920. ts = ts_after_sub;
  19921. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  19922. }
  19923. break;
  19924. case '}':
  19925. {
  19926. size_t alignment = ctx->struct_alignment;
  19927. ++ts;
  19928. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19929. ctx->enc_type = 0;
  19930. if (alignment && ctx->fmt_offset % alignment) {
  19931. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  19932. }
  19933. }
  19934. return ts;
  19935. case 'x':
  19936. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19937. ctx->fmt_offset += ctx->new_count;
  19938. ctx->new_count = 1;
  19939. ctx->enc_count = 0;
  19940. ctx->enc_type = 0;
  19941. ctx->enc_packmode = ctx->new_packmode;
  19942. ++ts;
  19943. break;
  19944. case 'Z':
  19945. got_Z = 1;
  19946. ++ts;
  19947. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  19948. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  19949. return NULL;
  19950. }
  19951. CYTHON_FALLTHROUGH;
  19952. case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  19953. case 'l': case 'L': case 'q': case 'Q':
  19954. case 'f': case 'd': case 'g':
  19955. case 'O': case 'p':
  19956. if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
  19957. (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
  19958. ctx->enc_count += ctx->new_count;
  19959. ctx->new_count = 1;
  19960. got_Z = 0;
  19961. ++ts;
  19962. break;
  19963. }
  19964. CYTHON_FALLTHROUGH;
  19965. case 's':
  19966. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  19967. ctx->enc_count = ctx->new_count;
  19968. ctx->enc_packmode = ctx->new_packmode;
  19969. ctx->enc_type = *ts;
  19970. ctx->is_complex = got_Z;
  19971. ++ts;
  19972. ctx->new_count = 1;
  19973. got_Z = 0;
  19974. break;
  19975. case ':':
  19976. ++ts;
  19977. while(*ts != ':') ++ts;
  19978. ++ts;
  19979. break;
  19980. case '(':
  19981. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  19982. break;
  19983. default:
  19984. {
  19985. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  19986. if (number == -1) return NULL;
  19987. ctx->new_count = (size_t)number;
  19988. }
  19989. }
  19990. }
  19991. }
  19992. /* TypeInfoCompare */
  19993. static int
  19994. __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
  19995. {
  19996. int i;
  19997. if (!a || !b)
  19998. return 0;
  19999. if (a == b)
  20000. return 1;
  20001. if (a->size != b->size || a->typegroup != b->typegroup ||
  20002. a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
  20003. if (a->typegroup == 'H' || b->typegroup == 'H') {
  20004. return a->size == b->size;
  20005. } else {
  20006. return 0;
  20007. }
  20008. }
  20009. if (a->ndim) {
  20010. for (i = 0; i < a->ndim; i++)
  20011. if (a->arraysize[i] != b->arraysize[i])
  20012. return 0;
  20013. }
  20014. if (a->typegroup == 'S') {
  20015. if (a->flags != b->flags)
  20016. return 0;
  20017. if (a->fields || b->fields) {
  20018. if (!(a->fields && b->fields))
  20019. return 0;
  20020. for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
  20021. __Pyx_StructField *field_a = a->fields + i;
  20022. __Pyx_StructField *field_b = b->fields + i;
  20023. if (field_a->offset != field_b->offset ||
  20024. !__pyx_typeinfo_cmp(field_a->type, field_b->type))
  20025. return 0;
  20026. }
  20027. return !a->fields[i].type && !b->fields[i].type;
  20028. }
  20029. }
  20030. return 1;
  20031. }
  20032. /* MemviewSliceValidateAndInit */
  20033. static int
  20034. __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
  20035. {
  20036. if (buf->shape[dim] <= 1)
  20037. return 1;
  20038. if (buf->strides) {
  20039. if (spec & __Pyx_MEMVIEW_CONTIG) {
  20040. if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
  20041. if (unlikely(buf->strides[dim] != sizeof(void *))) {
  20042. PyErr_Format(PyExc_ValueError,
  20043. "Buffer is not indirectly contiguous "
  20044. "in dimension %d.", dim);
  20045. goto fail;
  20046. }
  20047. } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
  20048. PyErr_SetString(PyExc_ValueError,
  20049. "Buffer and memoryview are not contiguous "
  20050. "in the same dimension.");
  20051. goto fail;
  20052. }
  20053. }
  20054. if (spec & __Pyx_MEMVIEW_FOLLOW) {
  20055. Py_ssize_t stride = buf->strides[dim];
  20056. if (stride < 0)
  20057. stride = -stride;
  20058. if (unlikely(stride < buf->itemsize)) {
  20059. PyErr_SetString(PyExc_ValueError,
  20060. "Buffer and memoryview are not contiguous "
  20061. "in the same dimension.");
  20062. goto fail;
  20063. }
  20064. }
  20065. } else {
  20066. if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
  20067. PyErr_Format(PyExc_ValueError,
  20068. "C-contiguous buffer is not contiguous in "
  20069. "dimension %d", dim);
  20070. goto fail;
  20071. } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
  20072. PyErr_Format(PyExc_ValueError,
  20073. "C-contiguous buffer is not indirect in "
  20074. "dimension %d", dim);
  20075. goto fail;
  20076. } else if (unlikely(buf->suboffsets)) {
  20077. PyErr_SetString(PyExc_ValueError,
  20078. "Buffer exposes suboffsets but no strides");
  20079. goto fail;
  20080. }
  20081. }
  20082. return 1;
  20083. fail:
  20084. return 0;
  20085. }
  20086. static int
  20087. __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
  20088. {
  20089. if (spec & __Pyx_MEMVIEW_DIRECT) {
  20090. if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
  20091. PyErr_Format(PyExc_ValueError,
  20092. "Buffer not compatible with direct access "
  20093. "in dimension %d.", dim);
  20094. goto fail;
  20095. }
  20096. }
  20097. if (spec & __Pyx_MEMVIEW_PTR) {
  20098. if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
  20099. PyErr_Format(PyExc_ValueError,
  20100. "Buffer is not indirectly accessible "
  20101. "in dimension %d.", dim);
  20102. goto fail;
  20103. }
  20104. }
  20105. return 1;
  20106. fail:
  20107. return 0;
  20108. }
  20109. static int
  20110. __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
  20111. {
  20112. int i;
  20113. if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
  20114. Py_ssize_t stride = 1;
  20115. for (i = 0; i < ndim; i++) {
  20116. if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
  20117. PyErr_SetString(PyExc_ValueError,
  20118. "Buffer not fortran contiguous.");
  20119. goto fail;
  20120. }
  20121. stride = stride * buf->shape[i];
  20122. }
  20123. } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
  20124. Py_ssize_t stride = 1;
  20125. for (i = ndim - 1; i >- 1; i--) {
  20126. if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
  20127. PyErr_SetString(PyExc_ValueError,
  20128. "Buffer not C contiguous.");
  20129. goto fail;
  20130. }
  20131. stride = stride * buf->shape[i];
  20132. }
  20133. }
  20134. return 1;
  20135. fail:
  20136. return 0;
  20137. }
  20138. static int __Pyx_ValidateAndInit_memviewslice(
  20139. int *axes_specs,
  20140. int c_or_f_flag,
  20141. int buf_flags,
  20142. int ndim,
  20143. __Pyx_TypeInfo *dtype,
  20144. __Pyx_BufFmt_StackElem stack[],
  20145. __Pyx_memviewslice *memviewslice,
  20146. PyObject *original_obj)
  20147. {
  20148. struct __pyx_memoryview_obj *memview, *new_memview;
  20149. __Pyx_RefNannyDeclarations
  20150. Py_buffer *buf;
  20151. int i, spec = 0, retval = -1;
  20152. __Pyx_BufFmt_Context ctx;
  20153. int from_memoryview = __pyx_memoryview_check(original_obj);
  20154. __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
  20155. if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
  20156. original_obj)->typeinfo)) {
  20157. memview = (struct __pyx_memoryview_obj *) original_obj;
  20158. new_memview = NULL;
  20159. } else {
  20160. memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  20161. original_obj, buf_flags, 0, dtype);
  20162. new_memview = memview;
  20163. if (unlikely(!memview))
  20164. goto fail;
  20165. }
  20166. buf = &memview->view;
  20167. if (unlikely(buf->ndim != ndim)) {
  20168. PyErr_Format(PyExc_ValueError,
  20169. "Buffer has wrong number of dimensions (expected %d, got %d)",
  20170. ndim, buf->ndim);
  20171. goto fail;
  20172. }
  20173. if (new_memview) {
  20174. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  20175. if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
  20176. }
  20177. if (unlikely((unsigned) buf->itemsize != dtype->size)) {
  20178. PyErr_Format(PyExc_ValueError,
  20179. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
  20180. "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
  20181. buf->itemsize,
  20182. (buf->itemsize > 1) ? "s" : "",
  20183. dtype->name,
  20184. dtype->size,
  20185. (dtype->size > 1) ? "s" : "");
  20186. goto fail;
  20187. }
  20188. if (buf->len > 0) {
  20189. for (i = 0; i < ndim; i++) {
  20190. spec = axes_specs[i];
  20191. if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
  20192. goto fail;
  20193. if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
  20194. goto fail;
  20195. }
  20196. if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
  20197. goto fail;
  20198. }
  20199. if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
  20200. new_memview != NULL) == -1)) {
  20201. goto fail;
  20202. }
  20203. retval = 0;
  20204. goto no_fail;
  20205. fail:
  20206. Py_XDECREF(new_memview);
  20207. retval = -1;
  20208. no_fail:
  20209. __Pyx_RefNannyFinishContext();
  20210. return retval;
  20211. }
  20212. /* ObjectToMemviewSlice */
  20213. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) {
  20214. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  20215. __Pyx_BufFmt_StackElem stack[1];
  20216. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  20217. int retcode;
  20218. if (obj == Py_None) {
  20219. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  20220. return result;
  20221. }
  20222. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  20223. PyBUF_RECORDS_RO | writable_flag, 1,
  20224. &__Pyx_TypeInfo_int, stack,
  20225. &result, obj);
  20226. if (unlikely(retcode == -1))
  20227. goto __pyx_fail;
  20228. return result;
  20229. __pyx_fail:
  20230. result.memview = NULL;
  20231. result.data = NULL;
  20232. return result;
  20233. }
  20234. /* CheckBinaryVersion */
  20235. static int __Pyx_check_binary_version(void) {
  20236. char ctversion[4], rtversion[4];
  20237. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  20238. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  20239. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  20240. char message[200];
  20241. PyOS_snprintf(message, sizeof(message),
  20242. "compiletime version %s of module '%.100s' "
  20243. "does not match runtime version %s",
  20244. ctversion, __Pyx_MODULE_NAME, rtversion);
  20245. return PyErr_WarnEx(NULL, message, 1);
  20246. }
  20247. return 0;
  20248. }
  20249. /* InitStrings */
  20250. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  20251. while (t->p) {
  20252. #if PY_MAJOR_VERSION < 3
  20253. if (t->is_unicode) {
  20254. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  20255. } else if (t->intern) {
  20256. *t->p = PyString_InternFromString(t->s);
  20257. } else {
  20258. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  20259. }
  20260. #else
  20261. if (t->is_unicode | t->is_str) {
  20262. if (t->intern) {
  20263. *t->p = PyUnicode_InternFromString(t->s);
  20264. } else if (t->encoding) {
  20265. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  20266. } else {
  20267. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  20268. }
  20269. } else {
  20270. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  20271. }
  20272. #endif
  20273. if (!*t->p)
  20274. return -1;
  20275. if (PyObject_Hash(*t->p) == -1)
  20276. return -1;
  20277. ++t;
  20278. }
  20279. return 0;
  20280. }
  20281. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  20282. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  20283. }
  20284. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  20285. Py_ssize_t ignore;
  20286. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  20287. }
  20288. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  20289. #if !CYTHON_PEP393_ENABLED
  20290. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  20291. char* defenc_c;
  20292. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  20293. if (!defenc) return NULL;
  20294. defenc_c = PyBytes_AS_STRING(defenc);
  20295. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  20296. {
  20297. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  20298. char* c;
  20299. for (c = defenc_c; c < end; c++) {
  20300. if ((unsigned char) (*c) >= 128) {
  20301. PyUnicode_AsASCIIString(o);
  20302. return NULL;
  20303. }
  20304. }
  20305. }
  20306. #endif
  20307. *length = PyBytes_GET_SIZE(defenc);
  20308. return defenc_c;
  20309. }
  20310. #else
  20311. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  20312. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  20313. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  20314. if (likely(PyUnicode_IS_ASCII(o))) {
  20315. *length = PyUnicode_GET_LENGTH(o);
  20316. return PyUnicode_AsUTF8(o);
  20317. } else {
  20318. PyUnicode_AsASCIIString(o);
  20319. return NULL;
  20320. }
  20321. #else
  20322. return PyUnicode_AsUTF8AndSize(o, length);
  20323. #endif
  20324. }
  20325. #endif
  20326. #endif
  20327. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  20328. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  20329. if (
  20330. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  20331. __Pyx_sys_getdefaultencoding_not_ascii &&
  20332. #endif
  20333. PyUnicode_Check(o)) {
  20334. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  20335. } else
  20336. #endif
  20337. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  20338. if (PyByteArray_Check(o)) {
  20339. *length = PyByteArray_GET_SIZE(o);
  20340. return PyByteArray_AS_STRING(o);
  20341. } else
  20342. #endif
  20343. {
  20344. char* result;
  20345. int r = PyBytes_AsStringAndSize(o, &result, length);
  20346. if (unlikely(r < 0)) {
  20347. return NULL;
  20348. } else {
  20349. return result;
  20350. }
  20351. }
  20352. }
  20353. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  20354. int is_true = x == Py_True;
  20355. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  20356. else return PyObject_IsTrue(x);
  20357. }
  20358. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  20359. int retval;
  20360. if (unlikely(!x)) return -1;
  20361. retval = __Pyx_PyObject_IsTrue(x);
  20362. Py_DECREF(x);
  20363. return retval;
  20364. }
  20365. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  20366. #if PY_MAJOR_VERSION >= 3
  20367. if (PyLong_Check(result)) {
  20368. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  20369. "__int__ returned non-int (type %.200s). "
  20370. "The ability to return an instance of a strict subclass of int "
  20371. "is deprecated, and may be removed in a future version of Python.",
  20372. Py_TYPE(result)->tp_name)) {
  20373. Py_DECREF(result);
  20374. return NULL;
  20375. }
  20376. return result;
  20377. }
  20378. #endif
  20379. PyErr_Format(PyExc_TypeError,
  20380. "__%.4s__ returned non-%.4s (type %.200s)",
  20381. type_name, type_name, Py_TYPE(result)->tp_name);
  20382. Py_DECREF(result);
  20383. return NULL;
  20384. }
  20385. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  20386. #if CYTHON_USE_TYPE_SLOTS
  20387. PyNumberMethods *m;
  20388. #endif
  20389. const char *name = NULL;
  20390. PyObject *res = NULL;
  20391. #if PY_MAJOR_VERSION < 3
  20392. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  20393. #else
  20394. if (likely(PyLong_Check(x)))
  20395. #endif
  20396. return __Pyx_NewRef(x);
  20397. #if CYTHON_USE_TYPE_SLOTS
  20398. m = Py_TYPE(x)->tp_as_number;
  20399. #if PY_MAJOR_VERSION < 3
  20400. if (m && m->nb_int) {
  20401. name = "int";
  20402. res = m->nb_int(x);
  20403. }
  20404. else if (m && m->nb_long) {
  20405. name = "long";
  20406. res = m->nb_long(x);
  20407. }
  20408. #else
  20409. if (likely(m && m->nb_int)) {
  20410. name = "int";
  20411. res = m->nb_int(x);
  20412. }
  20413. #endif
  20414. #else
  20415. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  20416. res = PyNumber_Int(x);
  20417. }
  20418. #endif
  20419. if (likely(res)) {
  20420. #if PY_MAJOR_VERSION < 3
  20421. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  20422. #else
  20423. if (unlikely(!PyLong_CheckExact(res))) {
  20424. #endif
  20425. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  20426. }
  20427. }
  20428. else if (!PyErr_Occurred()) {
  20429. PyErr_SetString(PyExc_TypeError,
  20430. "an integer is required");
  20431. }
  20432. return res;
  20433. }
  20434. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  20435. Py_ssize_t ival;
  20436. PyObject *x;
  20437. #if PY_MAJOR_VERSION < 3
  20438. if (likely(PyInt_CheckExact(b))) {
  20439. if (sizeof(Py_ssize_t) >= sizeof(long))
  20440. return PyInt_AS_LONG(b);
  20441. else
  20442. return PyInt_AsSsize_t(b);
  20443. }
  20444. #endif
  20445. if (likely(PyLong_CheckExact(b))) {
  20446. #if CYTHON_USE_PYLONG_INTERNALS
  20447. const digit* digits = ((PyLongObject*)b)->ob_digit;
  20448. const Py_ssize_t size = Py_SIZE(b);
  20449. if (likely(__Pyx_sst_abs(size) <= 1)) {
  20450. ival = likely(size) ? digits[0] : 0;
  20451. if (size == -1) ival = -ival;
  20452. return ival;
  20453. } else {
  20454. switch (size) {
  20455. case 2:
  20456. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  20457. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20458. }
  20459. break;
  20460. case -2:
  20461. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  20462. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20463. }
  20464. break;
  20465. case 3:
  20466. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  20467. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20468. }
  20469. break;
  20470. case -3:
  20471. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  20472. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20473. }
  20474. break;
  20475. case 4:
  20476. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  20477. 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]));
  20478. }
  20479. break;
  20480. case -4:
  20481. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  20482. 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]));
  20483. }
  20484. break;
  20485. }
  20486. }
  20487. #endif
  20488. return PyLong_AsSsize_t(b);
  20489. }
  20490. x = PyNumber_Index(b);
  20491. if (!x) return -1;
  20492. ival = PyInt_AsSsize_t(x);
  20493. Py_DECREF(x);
  20494. return ival;
  20495. }
  20496. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  20497. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  20498. }
  20499. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  20500. return PyInt_FromSize_t(ival);
  20501. }
  20502. #endif /* Py_PYTHON_H */