+
    Bi,                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	H
t
 ^ RIHt ^ RIHt ^ RIHtHt ^ RIt^ RItRt]R,           t ! R R	4      t ! R
 R]4      tR t ! R R]]P0                  4      t]P4                  ! ]! ]R4      '       * R4       ! R R]]P0                  4      4       tR t ! R R]]P0                  4      t ! R R]]P0                  4      tR t ]!R8X  d   ]PD                  ! 4        R# R# )z9Test largefile support on system where this makes sense.
N)requires
bigmemtestrequires_resource)SHORT_TIMEOUT)socket_helper)TESTFNunlinkl    y* 2c                   6   a  ] tR t^t o R t]R 4       tRtV tR# )LargeFileTestc                   \         P                  P                  \        4      '       d   R pMRpV P	                  \        V4      ;_uu_ 4       p\         P
                  ! VP                  4       4      P                  pV\        ^,           8X  d    RRR4       R# V^ 8X  d   VP                  R4       VP                  ^ 4       VP                  \        4       VP                  R4       VP                  4        V P                  \         P
                  ! VP                  4       4      P                  \        ^,           4       RRR4       R#   + '       g   i     R# ; i)r+bzw+bN   z   a)ospathexistsr   openfstatfilenost_sizesizewriteseekflushassertEqual)selfmodefcurrent_sizes   &   */usr/lib/python3.14/test/test_largefile.pysetUpLargeFileTest.setUp   s    77>>&!!DDYYvt$$88AHHJ/77LtAv% %$
 q FF1IFF4LGGDMGGIRXXahhj19946B %$$$s   AEB(EE	c                   V P                  \        R 4      ;_uu_ 4         RRR4       \        P                  ! \        4      P                  ^ 8X  g   V P                  R4      h\        \        4       R#   + '       g   i     L[; i)wbNz0File was not truncated by opening with mode "wb")r   r   r   statr   failureExceptionr   TESTFN2)clss   &r    tearDownClassLargeFileTest.tearDownClass,   sY    XXfd## $wwv&&!+&& (8 9 9w $#s   A44B	 N)	__name__
__module____qualname____firstlineno__r!   classmethodr)   __static_attributes____classdictcell____classdict__s   @r    r   r      s     C(      r   c                      a  ] tR t^6t o Rt]! ]^RR7      R 4       tR tR t	R t
R tR	 t]! ]^RR7      R
 4       tRtV tR# )TestFileMethodszOTest that each file function works as expected for large
(i.e. > 2 GiB) files.
F)r   memusedry_runc                :   V P                  \        R 4      ;_uu_ 4       pV P                  \        VP	                  4       4      \
        ^,           4       V P                  VP                  4       \
        ^,           4       RRR4       R#   + '       g   i     R# ; i)rbN)r   r   r   lenreadr   tellr   _sizer   s   && r    test_large_readTestFileMethods.test_large_read=   s^     YYvt$$S]D1H5QVVXtax0 %$$$s   A B		B	c                    V P                  \        P                  ! \        4      P                  \
        ^,           4       R# )   N)r   r   r%   r   r   r   )r   s   &r    test_osstatTestFileMethods.test_osstatD   s$    00$q&9r5   c                   V P                  \        R 4      ;_uu_ 4       pV P                  VP                  4       ^ 4       V P                  VP	                  ^4      R4       V P                  VP                  4       ^4       VP                  ^ 4       V P                  VP                  4       ^ 4       VP                  ^ ^ 4       V P                  VP                  4       ^ 4       VP                  ^*4       V P                  VP                  4       ^*4       VP                  ^*^ 4       V P                  VP                  4       ^*4       VP                  ^*^4       V P                  VP                  4       ^T4       VP                  ^ ^4       V P                  VP                  4       ^T4       VP                  ^ ^4       V P                  VP                  4       \        ^,           ^ ,           4       VP                  R^4       V P                  VP                  4       \        ^,           ^
,
          4       VP                  \        ) ^,
          ^4       V P                  VP                  4       ^ 4       VP                  \        4       V P                  VP                  4       \        4       V P                  VP	                  ^4      R4       VP                  \        ) ^,
          ^4       V P                  VP	                  ^4      R4       V P                  VP                  4       ^4       RRR4       R#   + '       g   i     R# ; i)r;   r   r   N)r   r   r   r>   r=   r   r   r   r   s   & r    test_seek_readTestFileMethods.test_seek_readG   s1   YYvt$$QVVXq)QVVAY-QVVXq)FF1IQVVXq)FF1aLQVVXq)FF2JQVVXr*FF2qMQVVXr*FF2qMQVVXr*FF1aLQVVXr*FF1aLQVVXtax!|4FF3NQVVXtax"}5FFD57AQVVXq)FF4LQVVXt,QVVAY-FFD57AQVVAY-QVVXq)9 %$$$s   LL44M	c           	        V P                  \        R 4      ;_uu_ 4       pV P                  \        P                  ! VP                  4       ^ ^ 4      ^ 4       V P                  \        P                  ! VP                  4       ^*^ 4      ^*4       V P                  \        P                  ! VP                  4       ^*^4      ^T4       V P                  \        P                  ! VP                  4       ^ ^4      ^T4       V P                  \        P                  ! VP                  4       ^ ^4      \        ^,           ^ ,           4       V P                  \        P                  ! VP                  4       R^4      \        ^,           ^
,
          4       V P                  \        P                  ! VP                  4       \        ) ^,
          ^4      ^ 4       V P                  \        P                  ! VP                  4       \        ^ 4      \        4       V P                  VP                  ^4      R4       RRR4       R#   + '       g   i     R# ; i)r;   r   NrH   )r   r   r   r   lseekr   r   r=   rI   s   & r    
test_lseekTestFileMethods.test_lseekf   sj   YYvt$$RXXahhj!Q7;RXXahhj"a8"=RXXahhj"a8"=RXXahhj!Q7<RXXahhj!Q7aBRXXahhj#q946"9ERXXahhj4%'1=qARXXahhj$:DAQVVAY- %$$$s   H
H33I	c                8   V P                  \        R 4      ;_uu_ 4       p\        VR4      '       g   \        P                  ! R4      hVP                  ^ ^4       V P                  VP                  4       \        ^,           4       \        ^
,
          pVP                  V4       VP                  4        V P                  VP                  4       V4       VP                  ^ ^4       V P                  VP                  4       V4       V^,          pVP                  ^*4       VP                  V4       V P                  VP                  4       ^*4       VP                  ^ ^4       V P                  VP                  4       V4       VP                  ^ 4       VP                  ^4       V P                  VP                  4       ^ 4       VP                  ^ 4       V P                  \        VP                  4       4      ^4       RRR4       R#   + '       g   i     R# ; i)r   truncatez.open().truncate() not available on this systemN)r   r   hasattrunittestSkipTestr   r   r>   r   rQ   r<   r=   )r   r   newsizes   &  r    test_truncateTestFileMethods.test_truncates   sv   YYvu%%1j))'' )9 : :FF1aLQVVXtAv.RiGFF7OJJLQVVXw/FF1aLQVVXw/ qLGFF2JJJwQVVXr*FF1aLQVVXw/ FF1IJJqMQVVXq)FF1I S]A.? &%%%s   GHH	c                    R FZ  pV P                  \        R4      ;_uu_ 4       pVP                  V4       V P                  VP	                  4       4       RRR4       K\  	  R#   + '       g   i     Kq  ; i)   r;   N)il               )r   r   r   
assertTrueseekable)r   posr   s   &  r    test_seekableTestFileMethods.test_seekable   sP     -C64((As

- )( -(((s   1A##A4c                   V P                  \        R 4      ;_uu_ 4       pV P                  VP                  ^ \        P
                  4      ^ 4       V P                  \        VP                  4       4      \        ^,           4       RRR4       V P                  \        R 4      ;_uu_ 4       pV P                  VP                  ^\        P                  4      ^4       V P                  \        VP                  4       4      \        ^,
          4       RRR4       V P                  \        R 4      ;_uu_ 4       pV P                  VP                  R\        P                  4      \        ^,
          4       V P                  \        VP                  4       4      ^4       RRR4       R#   + '       g   i     EL); i  + '       g   i     L; i  + '       g   i     R# ; i)r;   N)r   r   r   r   r   SEEK_CURr<   r=   r   SEEK_SETSEEK_ENDr?   s   && r    test_seek_readall!TestFileMethods.test_seek_readall   s+    YYvt$$QVVAr{{3Q7S]D1H5 % YYvt$$QVVB4b9S]D2I6 % YYvt$$QVVB4dQh?S]A. %$ %$$ %$ %$$s&   A%F$*A%F85A%G$F5	8G	G	r+   N)r,   r-   r.   r/   __doc__r   r   rA   rE   rJ   rN   rV   r^   re   r1   r2   r3   s   @r    r7   r7   6   s^      T!U31 41:*>. /D. T!U3/ 4/r5   r7   c                    a a V V3R  lpV# )c                    <a  V VV3R  lpV# )c                  V  < \        \        R 4      '       g   \        P                  ! R4      h\        P                  ! \
        P                  P                  S4      4      P                  S8  d4   \        SR,          R,          4      p\        P                  ! RV R24      hS! V / VB # )
disk_usagezrequires shutil.disk_usagei   z	required z MiB of free disk space)
rR   shutilrS   rT   rk   r   r   realpathfreeint)argskwargshsizefunr   requireds   *, r    wrapper6skip_no_disk_space.<locals>.decorator.<locals>.wrapper   s    6<00''(DEE  !1!1$!78==HHtOd23''w&=>@ @'''r5   r+   )rs   ru   r   rt   s   f r    	decorator%skip_no_disk_space.<locals>.decorator   s    	( r5   r+   )r   rt   rw   s   ff r    skip_no_disk_spacery      s    	 r5   c                      a  ] tR t^t o ]! ]P                  4      t]! ]]	R,          4      ]
! R4      R 4       4       tRtV tR# )TestCopyfile      @cpuc                   \         P                  P                  \        4      p\        P
                  ! \        \        4       V P                  \         P                  P                  \        4      V4       \        \        R 4      ;_uu_ 4       pV P                  VP                  ^4      R4       VP                  V^,
          4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)r;      z           aN)r   r   getsizer   rl   copyfiler'   r   r   r=   r   )r   r   r   s   &  r    test_itTestCopyfile.test_it   s    
 wwv&(148'4  AQVVAY(<=FF4!8QVVX';< !   s   AC22D	r+   N)r,   r-   r.   r/   staticmethodior   ry   r   r   r   r   r1   r2   r3   s   @r    r{   r{      s?      D s
+u	=  ,	=r5   r{   sendfilezsendfile not supportedc                      a a ] tR t^t o]! ]P                  4      t]tV 3R lt	V 3R lt
R t]! ]]R,          4      ]! R4      R 4       4       tRtVtV ;t# )TestSocketSendfilec                2   < \         SV `  4        R V n        R # N)superr!   threadr   	__class__s   &r    r!   TestSocketSendfile.setUp   s    r5   c                   < \         SV `  4        V P                  e/   V P                  P                  V P                  4       R V n        R # R # r   )r   tearDownr   jointimeoutr   s   &r    r   TestSocketSendfile.tearDown   s:    ;;"KKT\\*DK #r5   c                  a a VV 3R  lp\         P                  ! 4       oVP                  S P                  4       \         P                  ! W!3R7      S n        S P
                  P                  4        SP                  4        R# )c                   < T ;_uu_ 4        V P                  4       w  rVP                  SP                  4       T;_uu_ 4        \        \        R 4      ;_uu_ 4       pSP                  SP                  4        VP                  R4      pV'       g    RRR4       RRR4       RRR4       R# VP                  V4       KH    + '       g   i     M; iRRR4       M  + '       g   i     M; iRRR4       R#   + '       g   i     R# ; i)r$   i   N)accept
settimeoutr   r   r'   waitrecvr   )sockconn_r   chunkeventr   s   &    r    run*TestSocketSendfile.tcp_server.<locals>.run   s    ++--T4..!JJt||, $		% 0$" /T   /.TTTT sM   8C:C	5CCC	C:.CCC		C:C-(C::D	)targetrp   N)	threadingEventr   r   Threadr   startset)r   r   r   r   s   f& @r    
tcp_serverTestSocketSendfile.tcp_server   sS    
	' !%&&cA		r5   r|   r}   c                   \         P                  ! 4       p\        P                  ! R V34      ;_uu_ 4       pV P	                  V4       \        P
                  ! RV34      ;_uu_ 4       p\        \        R4      ;_uu_ 4       pVP                  V4       RRR4       RRR4       RRR4       V P                  4        \        P                  P                  \        4      pV P                  \        P                  P                  \        4      V4       \        \        R4      ;_uu_ 4       pV P                  VP                  ^4      R4       VP!                  V^,
          4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     R# ; i) z	127.0.0.1r;   Nr   r   )r   find_unused_portsocketcreate_serverr   create_connectionr   r   r   r   r   r   r   r   r'   r=   r   )r   portr   clientr   r   s   &     r    r   TestSocketSendfile.test_it   s8    --/!!2t*--OOD!));*=>>&&$''1OOA& ( ? .
 	wwv&148'4  AQVVAY(<=FF4!8QVVX';< !  ('' ?>> .-- !  sH   2F5(F!	FF!	F5)AG	F	F!	!F2,	F55G		G	)r   )r,   r-   r.   r/   r   r   r   r   r   r!   r   r   ry   r   r   r   r   r1   r2   __classcell__)r   r4   s   @@r    r   r      sX      DG* s
+u=  ,= =r5   r   c                      ^ RI p V P                  V P                  V P                  4       \
        P                  R,          R8X  g   \
        P                  R8X  d#   \        RR\        \        4      ,          4       R# \        \        R^ R7      p VP                  R	4       VP                  R
4       VP                  4         TP'                  4        \)        \        4       R#   \        \        3 d     Li ; i  \        \         3 d    \"        P$                  ! R4      hi ; i  TP'                  4        \)        \        4       i ; i)    N:N   Nwindarwin	largefilez-test requires %s bytes and a long time to runr$   )	bufferingrZ      xz*filesystem does not have largefile support)signalSIGXFSZSIG_IGNImportErrorAttributeErrorsysplatformr   strr   r   r   r   r   r   OSErrorOverflowErrorrS   rT   closer   )r   r   s     r    setUpModuler     s     	fnnfnn5 ||B5 CLLH$<@3t9L	N +	FF:GGDMGGI
 GGI6N5 ( * ' 	9## %8 9 9	9 GGI6Ns)   *C& 2C= &C:9C:=(D%%D( (!E	c                   :    ] tR tRt]! ]P                  4      tRtR# )CLargeFileTesti*  r+   N)r,   r-   r.   r/   r   r   r   r1   r+   r5   r    r   r   *  s     Dr5   r   c                   :    ] tR tRt]! ]P                  4      tRtR# )PyLargeFileTesti.  r+   N)r,   r-   r.   r/   r   pyior   r1   r+   r5   r    r   r   .  s    		"Dr5   r   c                  B    \        \        4       \        \        4       R # r   )r   r   r'   r+   r5   r    tearDownModuler   2  s    
6N
7Or5   __main__)#rg   r   r   rS   r   rl   r   test.supportr   r   r   r   r   test.support.os_helperr   r   r   _pyior   r   r'   r   r7   ry   TestCaser{   skipIfrR   r   r   r   r   r   r,   mainr+   r5   r    <module>r      s    
 
     @ @ & & 1 	  
3, @v/m v/p==("3"3 =& 
WR,,.FG3=(9(9 3= H3=l!H!_h&7&7 !#ox'8'8 #
 zMMO r5   