11 Build Changes 12 C API Changes 12.1 New Features 19 • Added --with-platlibdir option to the configure script: name of the platform-specific library di- rectory, stored in the new sys.platlibdir attribute. See sys.platlibdir attribute for more infor- mation. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor Stinner in bpo-1294959.) • The COUNT_ALLOCS special build macro has been removed. (Contributed by Victor Stinner in bpo-39489.) • On non-Windows platforms, the setenv() and unsetenv() functions are now required to build Python. (Contributed by Victor Stinner in bpo-39395.) • On non-Windows platforms, creating bdist_wininst installers is now officially unsupported. (See bpo- 10945 for more details.) • When building Python on macOS from source, _tkinter now links with non-system Tcl and Tk frameworks if they are installed in /Library/Frameworks , as had been the case on older releases of macOS. If a macOS SDK is explicitly configured, by using --enable-universalsdk= or $_{-isysroot}$, only the SDK itself is searched. The default behavior can still be overridden with$_{--with-tcltk-includes}$ and --with-tcltk-libs . (Contributed by Ned Deily in bpo-34956.) • Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower in bpo-33125.) • Some individual tests are now skipped when$_{--pgo}$ is used. The tests in question increased the PGO task time significantly and likely didn’t help improve optimization of the final executable. This speeds up the task by a factor of about 15x. Running the full unit test suite is slow. This change may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the much slower build, the old behavior can be restored using$_{./configure [..] PROFILE_TASK="-m test}$ --pgo-extended" . We make no guarantees as to which PGO task set produces a faster build. Users who care should run their own relevant benchmarks as results can depend on the environment, workload, and compiler tool chain. (See bpo-36044 and bpo-37707 for more details.) • PEP 573 : Added $_{PyType_FromModuleAndSpec()}$to associate a module with a class; PyType_GetModule() and PyType_GetModuleState() to retrieve the module and its state; and$_{PyCMethod}$ and$_{METH_METHOD}$ to allow a method to access the class it was defined in. (Contributed by Marcel Plch and Petr Viktorin in bpo-38787.) • Added$_{PyFrame_GetCode()}$ function: get a frame code. Added$_{PyFrame_GetBack()}$ function: get the frame next outer frame. (Contributed by Victor Stinner in bpo-40421.) • Added$_{PyFrame_GetLineNumber()}$to the limited C API. (Contributed by Victor Stinner in bpo-40421.) • Added PyThreadState_GetInterpreter() and PyInterpreterState_Get() functions to get the interpreter. Added$_{PyThreadState_GetFrame()}$ function to get the current frame of a Python thread state. Added PyThreadState_GetID() function: get the unique identifier of a Python thread state. (Contributed by Victor Stinner in bpo-39947.) • Added a new public$_{PyObject_CallNoArgs()}$ function to the C API, which calls a callable Python object without any arguments. It is the most efficient way to call a callable Python object without any argument. (Contributed by Victor Stinner in bpo-37194.) • Changes in the limited C API (if$_{Py_LIMITED_API}$ macro is defined): – Provide$_{Py_EnterRecursiveCall()}$ and$_{Py_LeaveRecursiveCall()}$ as regular functions for the limited API. Previously, there were defined as macros, but these macros didn’t compile with the limited C API which cannot access $_{PyThreadState.recursion_depth}$field (the structure is opaque in the limited C API).