Skip to content

Commit e6f3131

Browse files
facebook-github-botitamaro
authored andcommitted
Re-sync with internal repository
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging. fbshipit-source-id: b65f103f320570ce1830743524ebd37b97374a04
1 parent f1a47e7 commit e6f3131

127 files changed

Lines changed: 52159 additions & 51995 deletions

File tree

Some content is hidden

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

.github/dependabot.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7-
- 'main'
7+
- 'meta/main'
88
- '3.*'
99
pull_request:
1010
branches:

Include/internal/pycore_gc.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,55 @@ extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
343343
gcvisitobjects_t callback, void *arg);
344344
#endif
345345

346+
struct _Ci_PyGCImpl;
347+
348+
/*
349+
* Collect cyclic garbage.
350+
*
351+
* impl - Pointer to the collection implementation.
352+
* tstate - Indirectly specifies (via tstate->interp) the interpreter
353+
for which collection should be performed.
354+
* generation - Collect generations <= this value
355+
* reason - Why we're collecting
356+
*/
357+
typedef Py_ssize_t (*Ci_gc_collect_t)(struct _Ci_PyGCImpl *impl, PyThreadState* tstate,
358+
int generation, _PyGC_Reason reason);
359+
360+
// Free a collector
361+
typedef void (*Ci_gc_finalize_t)(struct _Ci_PyGCImpl *impl);
362+
363+
// An implementation of cyclic garbage collection
364+
typedef struct _Ci_PyGCImpl {
365+
Ci_gc_collect_t collect;
366+
Ci_gc_finalize_t finalize;
367+
} _Ci_PyGCImpl;
368+
369+
struct _gc_runtime_state;
370+
371+
/*
372+
* Set the collection implementation.
373+
*
374+
* The callee takes ownership of impl.
375+
*
376+
* Returns a pointer to the previous impl, which the caller is responsible for freeing
377+
* using the returned impl's finalize().
378+
*/
379+
PyAPI_FUNC(_Ci_PyGCImpl *) _Ci_PyGC_SetImpl(struct _gc_runtime_state *gc_state, _Ci_PyGCImpl *impl);
380+
381+
/*
382+
* Returns a pointer to the current GC implementation but does not transfer
383+
* ownership to the caller.
384+
*/
385+
PyAPI_FUNC(_Ci_PyGCImpl *) _Ci_PyGC_GetImpl(struct _gc_runtime_state *gc_state);
386+
387+
/*
388+
* Clear free lists (e.g. frames, tuples, etc.) for the given interpreter.
389+
*
390+
* This should be called by GC implementations after collecting the highest
391+
* generation.
392+
*/
393+
PyAPI_FUNC(void) _Ci_PyGC_ClearFreeLists(PyInterpreterState* interp);
394+
346395
#ifdef __cplusplus
347396
}
348397
#endif

Include/internal/pycore_pystate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ _Py_ThreadCanHandleSignals(PyInterpreterState *interp)
9090
and interpreter state */
9191

9292
#if !defined(Py_BUILD_CORE_MODULE)
93+
# if defined(Py_ENABLE_SHARED) && _Py__has_attribute(tls_model)
94+
__attribute__((tls_model("initial-exec")))
95+
# endif
9396
extern _Py_thread_local PyThreadState *_Py_tss_tstate;
97+
# if defined(Py_ENABLE_SHARED) && _Py__has_attribute(tls_model)
98+
__attribute__((tls_model("initial-exec")))
99+
# endif
94100
extern _Py_thread_local PyInterpreterState *_Py_tss_interp;
95101
#endif
96102

Include/patchlevel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define PY_RELEASE_SERIAL 0
2828

2929
/* Version as a string */
30-
#define PY_VERSION "3.16.0a0"
30+
#define PY_VERSION "3.16.0a0+meta"
3131
/*--end constants--*/
3232

3333

Include/pystate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
119119
*/
120120
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
121121

122+
// Sets the thread state for multi-threaded GC
123+
PyAPI_FUNC(void) Ci_SetTStateForGC(PyThreadState *tstate);
122124

123125
/* PEP 788 -- Protection against interpreter finalization */
124126

Lib/site.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,15 @@ def main():
10231023
sethelper()
10241024
if not sys.flags.isolated:
10251025
enablerlcompleter()
1026+
# If we've been built with CinderX support there will be an init_cinderx.py
1027+
# included in the default module search path. In this case we import it
1028+
# which will have the side-effect of initializing CinderX. If this module
1029+
# is missing then we weren't build with CinderX so ignoring the import
1030+
# error is fine.
1031+
try:
1032+
import init_cinderx
1033+
except ImportError:
1034+
pass
10261035
execsitecustomize()
10271036
if ENABLE_USER_SITE:
10281037
execusercustomize()

0 commit comments

Comments
 (0)