Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be059c1

Browse files
committed
Merge remote-tracking branch 'upstream/main' into tvobject
2 parents 66851e6 + c8c3956 commit be059c1

45 files changed

Lines changed: 585 additions & 287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ jobs:
308308
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
309309
- name: Install Dependencies
310310
run: sudo ./.github/workflows/posix-deps-apt.sh
311+
- name: Set up GCC-10 for ASAN
312+
uses: egor-tensin/setup-gcc@v1
313+
with:
314+
version: 10
311315
- name: Configure OpenSSL env vars
312316
run: |
313317
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV

.github/workflows/require-pr-label.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
label:
9-
name: DO-NOT-MERGE
9+
name: DO-NOT-MERGE / unresolved review
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 10
1212

@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
mode: exactly
1717
count: 0
18-
labels: "DO-NOT-MERGE"
18+
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"

Doc/library/dataclasses.rst

Lines changed: 74 additions & 72 deletions
Large diffs are not rendered by default.

Doc/tools/.nitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ Doc/library/csv.rst
111111
Doc/library/ctypes.rst
112112
Doc/library/curses.ascii.rst
113113
Doc/library/curses.rst
114-
Doc/library/dataclasses.rst
115114
Doc/library/datetime.rst
116115
Doc/library/dbm.rst
117116
Doc/library/decimal.rst
@@ -178,7 +177,6 @@ Doc/library/os.rst
178177
Doc/library/ossaudiodev.rst
179178
Doc/library/pickle.rst
180179
Doc/library/pickletools.rst
181-
Doc/library/pkgutil.rst
182180
Doc/library/platform.rst
183181
Doc/library/plistlib.rst
184182
Doc/library/poplib.rst

Doc/using/unix.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ On FreeBSD and OpenBSD
5454
pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2.tgz
5555

5656

57-
On OpenSolaris
58-
--------------
59-
60-
You can get Python from `OpenCSW <https://www.opencsw.org/>`_. Various versions
61-
of Python are available and can be installed with e.g. ``pkgutil -i python27``.
62-
63-
6457
.. _building-python-on-unix:
6558

6659
Building Python

Include/cpython/initconfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
245245
/* --- PyInterpreterConfig ------------------------------------ */
246246

247247
typedef struct {
248+
// XXX "allow_object_sharing"? "own_objects"?
249+
int use_main_obmalloc;
248250
int allow_fork;
249251
int allow_exec;
250252
int allow_threads;
@@ -254,6 +256,7 @@ typedef struct {
254256

255257
#define _PyInterpreterConfig_INIT \
256258
{ \
259+
.use_main_obmalloc = 0, \
257260
.allow_fork = 0, \
258261
.allow_exec = 0, \
259262
.allow_threads = 1, \
@@ -263,6 +266,7 @@ typedef struct {
263266

264267
#define _PyInterpreterConfig_LEGACY_INIT \
265268
{ \
269+
.use_main_obmalloc = 1, \
266270
.allow_fork = 1, \
267271
.allow_exec = 1, \
268272
.allow_threads = 1, \

Include/cpython/pystate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ is available in a given context. For example, forking the process
1111
might not be allowed in the current interpreter (i.e. os.fork() would fail).
1212
*/
1313

14+
/* Set if the interpreter share obmalloc runtime state
15+
with the main interpreter. */
16+
#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
17+
1418
/* Set if import should check a module for subinterpreter support. */
1519
#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
1620

Include/internal/pycore_import.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ struct _import_runtime_state {
1919
used exclusively for when the extensions dict is access/modified
2020
from an arbitrary thread. */
2121
PyThreadState main_tstate;
22+
/* A lock to guard the dict. */
23+
PyThread_type_lock mutex;
2224
/* A dict mapping (filename, name) to PyModuleDef for modules.
2325
Only legacy (single-phase init) extension modules are added
2426
and only if they support multiple initialization (m_size >- 0)

Include/internal/pycore_interp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ extern "C" {
2323
#include "pycore_function.h" // FUNC_MAX_WATCHERS
2424
#include "pycore_genobject.h" // struct _Py_async_gen_state
2525
#include "pycore_gc.h" // struct _gc_runtime_state
26+
#include "pycore_global_objects.h" // struct _Py_interp_static_objects
2627
#include "pycore_import.h" // struct _import_state
2728
#include "pycore_instruments.h" // PY_MONITORING_EVENTS
2829
#include "pycore_list.h" // struct _Py_list_state
29-
#include "pycore_global_objects.h" // struct _Py_interp_static_objects
3030
#include "pycore_object_state.h" // struct _py_object_state
31+
#include "pycore_obmalloc.h" // struct obmalloc_state
3132
#include "pycore_tuple.h" // struct _Py_tuple_state
3233
#include "pycore_typeobject.h" // struct type_cache
3334
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
@@ -82,6 +83,8 @@ struct _is {
8283
int _initialized;
8384
int finalizing;
8485

86+
struct _obmalloc_state obmalloc;
87+
8588
struct _ceval_state ceval;
8689
struct _gc_runtime_state gc;
8790

Include/internal/pycore_obmalloc.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,12 @@ struct _obmalloc_usage {
657657
#endif /* WITH_PYMALLOC_RADIX_TREE */
658658

659659

660-
struct _obmalloc_state {
660+
struct _obmalloc_global_state {
661661
int dump_debug_stats;
662+
Py_ssize_t interpreter_leaks;
663+
};
664+
665+
struct _obmalloc_state {
662666
struct _obmalloc_pools pools;
663667
struct _obmalloc_mgmt mgmt;
664668
struct _obmalloc_usage usage;
@@ -675,7 +679,11 @@ void _PyObject_VirtualFree(void *, size_t size);
675679

676680

677681
/* This function returns the number of allocated memory blocks, regardless of size */
678-
PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
682+
extern Py_ssize_t _Py_GetGlobalAllocatedBlocks(void);
683+
#define _Py_GetAllocatedBlocks() \
684+
_Py_GetGlobalAllocatedBlocks()
685+
extern Py_ssize_t _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *);
686+
extern void _PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *);
679687

680688

681689
#ifdef WITH_PYMALLOC

0 commit comments

Comments
 (0)