Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Doc/library/site.rst
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,19 @@ Module contents
Also processes :file:`.start` files. See :ref:`site-start-files`.


.. function:: getsitepackages()
.. function:: getsitepackages(prefixes=None)

Return a list containing all global site-packages directories.

For each directory present in *prefixes* (or :data:`PREFIXES` if *prefixes*
is ``None``), this function will find its site-packages subdirectory
depending on the system environment, and will return a list of full paths.

.. versionadded:: 3.2

.. versionchanged:: 3.3
Add the optional *prefixes* argument.


.. function:: getuserbase()

Expand Down
9 changes: 9 additions & 0 deletions Modules/_testlimitedcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
* standard Python regression test, via Lib/test/test_capi.py.
*/

#include "pyconfig.h" // Py_GIL_DISABLED

#ifdef Py_GIL_DISABLED
// Cannot test the limited C API
#else
// Use the oldest limited C API version
# define Py_LIMITED_API 0x03020000
#endif

#include "_testlimitedcapi/parts.h"

static PyMethodDef TestMethods[] = {
Expand Down
3 changes: 3 additions & 0 deletions Modules/_testlimitedcapi/capsule.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "parts.h"

#include <stdlib.h> // free()


static void
capsule_destructor(PyObject *op)
{
Expand Down
7 changes: 4 additions & 3 deletions Modules/_testlimitedcapi/codec.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "pyconfig.h" // Py_GIL_DISABLED

// Need limited C API version 3.5 for PyCodec_NameReplaceErrors()
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.5 for PyCodec_NameReplaceErrors()
# define Py_LIMITED_API 0x03050000
#endif

Expand Down
4 changes: 3 additions & 1 deletion Modules/_testlimitedcapi/file.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API 3.13 for PyLong_AsInt()
# define Py_LIMITED_API 0x030d0000
#endif
Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/heaptype_relative.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Need limited C API version 3.15 for _DuringGC functions
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
// Cannot test the limited C API
#else
// Need limited C API version 3.15 for _DuringGC functions
# define Py_LIMITED_API 0x030f0000
#endif

Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/import.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Need limited C API version 3.13 for PyImport_AddModuleRef()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.13 for PyImport_AddModuleRef()
# define Py_LIMITED_API 0x030d0000
#endif

Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/list.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Need limited C API version 3.13 for PyList_GetItemRef()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.13 for PyList_GetItemRef()
# define Py_LIMITED_API 0x030d0000
#endif

Expand Down
4 changes: 3 additions & 1 deletion Modules/_testlimitedcapi/long.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API 3.14 to test PyLong_AsInt64()
# define Py_LIMITED_API 0x030e0000
#endif
Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/object.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Need limited C API version 3.13 for Py_GetConstant()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.13 for Py_GetConstant()
# define Py_LIMITED_API 0x030d0000
#endif

Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/parts.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#include "pyconfig.h" // Py_GIL_DISABLED

// Use the limited C API
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
// need limited C API version 3.5 for PyModule_AddFunctions()
#ifdef Py_GIL_DISABLED
// Cannot test the limited C API
#elif !defined(Py_LIMITED_API)
// Need limited C API version 3.5 for PyModule_AddFunctions()
# define Py_LIMITED_API 0x03050000
#endif

Expand Down
1 change: 1 addition & 0 deletions Modules/_testlimitedcapi/slots.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Need limited C API version 3.15 for PyType_FromSlots()
#define Py_LIMITED_API 0x030f0000

#include "parts.h"
Expand Down
6 changes: 2 additions & 4 deletions Modules/_testlimitedcapi/sys.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "pyconfig.h" // Py_GIL_DISABLED
// Need limited C API version 3.15 for PySys_GetAttr() etc
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
# define Py_LIMITED_API 0x030f0000
#endif
#define Py_LIMITED_API 0x030f0000

#include "parts.h"
#include "util.h"

Expand Down
4 changes: 3 additions & 1 deletion Modules/_testlimitedcapi/unicode.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API 3.14 to test PyUnicode_Equal()
# define Py_LIMITED_API 0x030e0000
#endif
Expand Down
6 changes: 4 additions & 2 deletions Modules/_testlimitedcapi/vectorcall_limited.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* Test Vectorcall in the limited API */

// Need limited C API version 3.12 for PyObject_Vectorcall()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
#ifdef Py_GIL_DISABLED
// Cannot test the limited C API
#else
// Need limited C API version 3.12 for PyObject_Vectorcall()
# define Py_LIMITED_API 0x030c0000
#endif

Expand Down
7 changes: 5 additions & 2 deletions Modules/_testlimitedcapi/version.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* Test version macros in the limited API */

#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030e0000 // Added in 3.14
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.14 for Py_PACK_VERSION()
# define Py_LIMITED_API 0x030e0000
#endif

#include "parts.h"
Expand Down
4 changes: 3 additions & 1 deletion Modules/_testlimitedcapi/weakref.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API 3.5 for PyModule_AddFunctions()
# define Py_LIMITED_API 0x03050000
#endif
Expand Down
6 changes: 3 additions & 3 deletions Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ typedef struct _PyCfgInstruction {

typedef struct _PyCfgBasicblock {
/* Each basicblock in a compilation unit is linked via b_list in the
reverse order that the block are allocated. b_list points to the next
block in this list, not to be confused with b_next, which is next by
control flow. */
reverse order that blocks are allocated. b_list points to the
previously allocated block, not to be confused with b_next, which is
next by control flow. */
struct _PyCfgBasicblock *b_list;
/* The label of this block if it is a jump target, -1 otherwise */
_PyJumpTargetLabel b_label;
Expand Down
Loading