hyb
2025-12-31 6cdcd01f77e11b72c323603e27ebdb85b15223c9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Ë
Kñúhãó€—dZddlZddlZddlZddlZddlZddlZddgZdddddœd„Z    dd„Z    d    „Z
d
„Z d „Z d „Z d „Zd„Zy)zb
Build a c-extension module on-the-fly in tests.
See build_and_import_extensions for usage hints
 
éNÚbuild_and_import_extensionÚcompile_extension_moduleÚ)ÚprologueÚ    build_dirÚ include_dirsÚ    more_initcób—|€g}|t||«z}d}|stjd«}|r
|dz }||z }|dz }t|||«}t    ||||«}    ddl}
|
j j||    «} |
j j| «} | jj| «| S)a
    Build and imports a c-extension module `modname` from a list of function
    fragments `functions`.
 
 
    Parameters
    ----------
    functions : list of fragments
        Each fragment is a sequence of func_name, calling convention, snippet.
    prologue : string
        Code to precede the rest, usually extra ``#include`` or ``#define``
        macros.
    build_dir : pathlib.Path
        Where to build the module, usually a temporary directory
    include_dirs : list
        Extra directories to find include files when compiling
    more_init : string
        Code to appear in the module PyMODINIT_FUNC
 
    Returns
    -------
    out: module
        The module will have been loaded and is ready for use
 
    Examples
    --------
    >>> functions = [("test_bytes", "METH_O", """
        if ( !PyBytesCheck(args)) {
            Py_RETURN_FALSE;
        }
        Py_RETURN_TRUE;
    """)]
    >>> mod = build_and_import_extension("testme", functions)
    >>> assert not mod.test_bytes('abc')
    >>> assert mod.test_bytes(b'abc')
    Nz›
    PyObject *mod = PyModule_Create(&moduledef);
    #ifdef Py_GIL_DISABLED
    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
    #endif
           ú.z.#define INITERROR return NULL
                z
return mod;r) Ú _make_methodsÚpathlibÚPathÚ _make_sourcerÚimportlib.utilÚutilÚspec_from_file_locationÚmodule_from_specÚloaderÚ exec_module) ÚmodnameÚ    functionsrrrr    ÚbodyÚinitÚ source_stringÚmod_soÚ    importlibÚspecÚfoos              úRH:\Change_password\venv_build\Lib\site-packages\numpy/testing/_private/extbuild.pyrrsƀðNÐØˆ Ø ”m I¨wÓ7Ñ 7€Dð €Dñ Ü—L‘L Ó%ˆ    ÙØ ðñ    ˆà     ÑˆØˆOÑ€DÜ  ¨$°Ó5€MÜ %ؐ˜L¨-ó9€FãØ >‰>× 1Ñ 1°'¸6Ó B€DØ
.‰.×
)¨$Ó
/€C؇KK×јCÔ Ø €Jócóº—|jd«d}||z }|jd¬«t||«}|xsg}|xsg}|xsg}t|||z |||¬«S)aH
    Build an extension module and return the filename of the resulting
    native code file.
 
    Parameters
    ----------
    name : string
        name of the module, possibly including dots if it is a module inside a
        package.
    builddir : pathlib.Path
        Where to build the module, usually a temporary directory
    include_dirs : list
        Extra directories to find include files when compiling
    libraries : list
        Libraries to link into the extension module
    library_dirs: list
        Where to find the libraries, ``-L`` passed to the linker
    r éÿÿÿÿT©Úexist_ok)ÚoutputfilenamerÚ    librariesÚ library_dirs)ÚsplitÚmkdirÚ_convert_str_to_fileÚ
_c_compile)    ÚnameÚbuilddirrrr&r'rÚdirnameÚcfiles             rrrRsu€ð*j‰j˜‹o˜bÑ!€Gؘ‰o€GØ ‡MM˜4€MÔ Ü   °Ó 8€EØÒ% 2€LØ’˜R€IØÒ% 2€Lä Ø ˜g¨Ñ/Ø!¨YØ!ô
ð
r có’—|dz }|jd«5}|jt|««ddd«|S#1swY|SxYw)zHelper function to create a file ``source.c`` in `dirname` that contains
    the string in `source`. Returns the file name
    zsource.cÚwN)ÚopenÚwriteÚstr)Úsourcer.ÚfilenameÚfs    rr*r*vsF€ð˜Ñ#€HØ    ‰sÓ    ð˜qØ    ‰”F“ Ô÷à €O÷à €Oús    —<¼Ac
ó—g}g}|D]M\}}}|›d|›}d|vrd}nd}|jd|›d|›d|›d«d    |›|›d
|›d }    |j|    «ŒOd j|«d d j|«|dœzz}
|
S)zõ Turns the name, signature, code in functions into complete functions
    and lists them in a methods_table. Then turns the methods_table into a
    ``PyMethodDef`` structure and returns the resulting code fragment ready
    for compilation
    Ú_Ú METH_KEYWORDSz2(PyObject *self, PyObject *args, PyObject *kwargs)z (PyObject *self, PyObject *args)z{"z", (PyCFunction)z, z},z
        static PyObject* z
        {
        z
        }
        ú
a6
    static PyMethodDef methods[] = {
    %(methods)s
    { NULL }
    };
    static struct PyModuleDef moduledef = {
        PyModuleDef_HEAD_INIT,
        "%(modname)s",  /* m_name */
        NULL,           /* m_doc */
        -1,             /* m_size */
        methods,        /* m_methods */
    };
    )Úmethodsr)ÚappendÚjoin) rrÚ methods_tableÚcodesÚfuncnameÚflagsÚcodeÚ    cfuncnameÚ    signatureÚ    func_coders            rr r €s̀ð €MØ €EØ!*ò Ñˆ%˜Øi˜q  
Ð+ˆ    Ø ˜eÑ #ØL‰Ià:ˆIØ×ÒÚ08º)ÂUÐ Kô    MðØ#˜ Y Kð0    à     ˆð    ð ˆ    ð      ‰ YÕð ð  9‰9UÓ ð ð—i‘i  Ó.¸7Ñ
Cñ Dñ D€Dð €Kr có—d|||dœz}|S)zG Combines the code fragments into source code ready to be compiled
    zn
    #include <Python.h>
 
    %(body)s
 
    PyMODINIT_FUNC
    PyInit_%(name)s(void) {
    %(init)s
    }
    )r,rr©)r,rrrCs    rrr¨s#€ð     ð˜d¨Dñ ñ €Dð €Kr c    óėg}tjdk(rdg}|jd«n&tjjd«rgd¢}ng}t    |||||||«S)NÚwin32z/we4013z/DEBUGÚlinux)z-O0z-gz%-Werror=implicit-function-declarationz-fPIC)ÚsysÚplatformr=Ú
startswithÚbuild)r/r%rr&r'Ú
link_extraÚ compile_extras       rr+r+ºsg€à€JÜ
‡||wÒØ"˜ ˆ Ø×ј(Õ#Ü     ‰×     Ñ      Ô    )òK‰ ðˆ ä Ø ˆ~ؐzؐi ó /ð/r cóâ—|jdz }tj|d¬«t|jdz d«5}|D    cgc]}    d|    z‘Œ    }
}    |j    t j d|jd›d    |jd›d
|›d |
›d |›d  ««ddd«|jdz } t| d«5}|j    t j dtj›d««ddd«tjdk(rtjgd¢|¬«n2tjdddddtj| «›g|¬«|jdt«z} tjddg|¬«tjt!|| z «|j| z «|j| z Scc}    w#1swYŒ9xYw#1swYŒëxYw)zuse meson to buildrOTr#z meson.buildÚwtz-Lz“            project('foo', 'c')
            py = import('python').find_installation(pure: false)
            py.extension_module(
                'r"z',
                'z',
                c_args: z,
                link_args: z',
                include_directories: z,
            )
        Nz.mesonpy-native-file.iniz-            [binaries]
            python = 'z
'
        rJ)ÚmesonÚsetupz--buildtype=releaseú--vsenvú..)ÚcwdrTrUrVrWz--native-file=Úcompile)ÚparentÚosÚmakedirsr2r3ÚtextwrapÚdedentÚpartsrLÚ
executablerMÚ
subprocessÚ
check_callÚfspathÚ get_so_suffixÚrenamer4) r/r%rQrPrr&r'rÚfidÚdÚ    link_dirsÚnative_file_nameÚso_names              rrOrOÌsï€ð— ‘ ˜wÑ&€I܇KK     DÕ)Ü     ˆel‰l˜]Ñ*¨DÓ    1ð °SØ'3Ö4 !T˜A“XÐ4ˆ    Ð4Ø     ‰    ”(—/‘/ð'ð!×&Ñ& rÑ*Ð+ð,Ø—+‘+˜b‘/Ð"ð#Ø&˜ð(Ø%˜;ð'&Ø&2 ^ð4    ð
# ó
 ô
    ÷ ð—|‘|Ð&@Ñ@ÐÜ     РӠ   %ð¨Ø     ‰    ”(—/‘/ð'ä—~‘~Ð&ð'    ð# ó ô    ÷ô
 ‡||wÒÜ×Ñò0ð#,ö     ô     ×јw¨°Ø# ~´b·i±iÐ@PÓ6QÐ5RÐ%SðUà"+õ     ð
×"Ñ" 2Ñ&¬«Ñ8€GÜ×ј7 IÐ.°IÕ>܇IIŒc)˜gÑ%Ó&¨¯ © °wÑ(>Ô?Ø <‰<˜'Ñ !Ð!ùòC5÷ ñ ú÷ðús+ÁGÁ GÁAGÃ7G%ÇGÇG"Ç%G.có8—tjd«}|sJ‚|S)NÚ
EXT_SUFFIX)Ú    sysconfigÚget_config_var)Úrets rrdrd÷s€Ü
" <Ó
0€CÙ €Jˆ3Ø €Jr )NN)Ú__doc__r[r rarLrmr]Ú__all__rrr*r rr+rOrdrHr rú<module>rrsfðñó 
ÛÛÛ
ÛÛà 'Ð)CÐ
D€ð)+°dØ Rô>ðF59ó!
òHò%òPò$/ò$("óVr