Skip to content

Commit 1129c08

Browse files
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: 18388cb946374c0d762b1548de031b4fa65a5986
1 parent 15a597e commit 1129c08

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
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- 'main'
8-
- '3.*'
8+
- 'meta/3.*'
99
pull_request:
1010
branches:
1111
- 'main'

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 1
2828

2929
/* Version as a string */
30-
#define PY_VERSION "3.15.0b1+"
30+
#define PY_VERSION "3.15.0b1+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
@@ -891,6 +891,15 @@ def main():
891891
sethelper()
892892
if not sys.flags.isolated:
893893
enablerlcompleter()
894+
# If we've been built with CinderX support there will be an init_cinderx.py
895+
# included in the default module search path. In this case we import it
896+
# which will have the side-effect of initializing CinderX. If this module
897+
# is missing then we weren't build with CinderX so ignoring the import
898+
# error is fine.
899+
try:
900+
import init_cinderx
901+
except ImportError:
902+
pass
894903
execsitecustomize()
895904
if ENABLE_USER_SITE:
896905
execusercustomize()

0 commit comments

Comments
 (0)