
    d                        d Z ddlZej        dk    r ed          ddlZddlZddlZddlZddlZddl	Z	ddl
Z
dZdZej        Zej        Z ej                    Zdded	d
Z G d d          Z G d dej                  ZdS )z)Various Windows specific bits and pieces.    Nwin32z
win32 only)pipePopenPIPE
PipeHandlei    F)TT)duplex
overlappedbufsizec           
      R   t          j        d                    t          j                    t          t                                        }| r*t          j        }t          j	        t          j
        z  }||}}nt          j        }t          j
        }d|}}|t          j        z  }|d         r|t          j        z  }|d         rt          j        }nd}dx}	}
	 t          j        ||t          j        d||t          j        t          j                  }	t          j        ||dt          j        t          j        |t          j                  }
t          j        |	d          }|                    d           |	|
fS #  |	t          j        |	           |
t          j        |
            xY w)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixr      NTr	   )tempfilemktempformatosgetpidnext_mmap_counter_winapiPIPE_ACCESS_DUPLEXGENERIC_READGENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe	PIPE_WAITNMPWAIT_WAIT_FOREVERNULL
CreateFileOPEN_EXISTINGConnectNamedPipeGetOverlappedResultCloseHandle)r   r	   r
   addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs               '  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/asyncio/windows_utils.pyr   r       s   o188IKKm,,. ./ / /G  $-%(== '.&G55H!} 1G00!} #8NB$Xw0vvw;W\K K VQg.Cw|- - %bT:::
t$$$2v>###>###s   BE7 7/F&c                   p    e Zd ZdZd Zd Zed             Zd Ze	j
        ddZej        fdZd	 Zd
 ZdS )r   zWrapper for an overlapped pipe handle which is vaguely file-object like.

    The IOCP event loop can use these instead of socket objects.
    c                     || _         d S N_handleselfhandles     r/   __init__zPipeHandle.__init__V   s        c                 P    | j         d| j         }nd}d| j        j         d| dS )Nzhandle=closed< >)r4   	__class____name__r5   s     r/   __repr__zPipeHandle.__repr__Y   s>    <#/t|//FFF64>*66V6666r9   c                     | j         S r2   r3   r6   s    r/   r7   zPipeHandle.handle`   s
    |r9   c                 <    | j         t          d          | j         S )NzI/O operation on closed pipe)r4   
ValueErrorrC   s    r/   filenozPipeHandle.filenod   s!    <;<<<|r9   )r%   c                F    | j          || j                    d | _         d S d S r2   r3   )r6   r%   s     r/   closezPipeHandle.closei   s/    <#K%%%DLLL $#r9   c                 l    | j         , |d| t          |            |                                  d S d S )Nz	unclosed )source)r4   ResourceWarningrH   )r6   _warns     r/   __del__zPipeHandle.__del__n   sC    <#E&d&&EEEEJJLLLLL $#r9   c                     | S r2    rC   s    r/   	__enter__zPipeHandle.__enter__s   s    r9   c                 .    |                                   d S r2   )rH   )r6   tvtbs       r/   __exit__zPipeHandle.__exit__v   s    

r9   N)r@   
__module____qualname____doc__r8   rA   propertyr7   rF   r   r%   rH   warningswarnrM   rP   rU   rO   r9   r/   r   r   Q   s           7 7 7   X  
 $+#6          
 %M    
      r9   r   c                   $     e Zd ZdZd fd	Z xZS )r   zReplacement for subprocess.Popen using overlapped pipe handles.

    The stdin, stdout, stderr are None or instances of PipeHandle.
    Nc                    |                     d          rJ |                     dd          dk    sJ d x}x}}d x}	x}
}|t          k    r4t          dd          \  }}	t          j        |t
          j                  }n|}|t          k    r)t          d          \  }
}t          j        |d          }n|}|t          k    r)t          d          \  }}t          j        |d          }n|t          k    r|}n|}	  t                      j	        |f|||d	| |	t          |	          | _        |
t          |
          | _        |t          |          | _        n$#  |	|
|fD ]}|t          j        |            xY w|t          k    rt          j        |           |t          k    rt          j        |           |t          k    rt          j        |           d S d S # |t          k    rt          j        |           |t          k    rt          j        |           |t          k    rt          j        |           w w xY w)
Nuniversal_newlinesr
   r   )FTT)r	   r   )TFr   )stdinstdoutstderr)getr   r   msvcrtopen_osfhandler   O_RDONLYSTDOUTsuperr8   r   r_   r`   ra   r   r%   rH   )r6   argsr_   r`   ra   kwds	stdin_rfd
stdout_wfd
stderr_wfdstdin_wh	stdout_rh	stderr_rhstdin_rh	stdout_wh	stderr_whhr?   s                   r/   r8   zPopen.__init__   s}   88011111xx	1%%****.22	2J+///9yD==!%t!L!L!LHh-hDDIIIT>>#'=#A#A#A Iy.y!<<JJJT>>#'=#A#A#A Iy.y!<<JJv#JJJ	%EGGT 8:$.8 8268 8 8 #'11
$(33$(33		95 + +='*** }}###~~$$$~~$$$$$ ~	 }}###~~$$$~~$$$$ s    =E AG# !E??G# #A I)NNN)r@   rV   rW   rX   r8   __classcell__)r?   s   @r/   r   r   }   sG         +% +% +% +% +% +% +% +% +% +%r9   r   )rX   sysplatformImportErrorr   	itertoolsrc   r   
subprocessr   rZ   __all__BUFSIZEr   rf   countr   r   r   r   rO   r9   r/   <module>r}      s%   / / 



<7
+l
#
##       				       0 			!! \7 + + + + +b& & & & & & & &X0% 0% 0% 0% 0%J 0% 0% 0% 0% 0%r9   