@plone/volto 14.0.2 → 14.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +24 -3
  3. package/locales/ca/LC_MESSAGES/volto.po +12 -2
  4. package/locales/ca.json +1 -1
  5. package/locales/de/LC_MESSAGES/volto.po +12 -2
  6. package/locales/de.json +1 -1
  7. package/locales/en/LC_MESSAGES/volto.po +12 -2
  8. package/locales/en.json +1 -1
  9. package/locales/es/LC_MESSAGES/volto.po +12 -2
  10. package/locales/es.json +1 -1
  11. package/locales/eu/LC_MESSAGES/volto.po +12 -2
  12. package/locales/eu.json +1 -1
  13. package/locales/fr/LC_MESSAGES/volto.po +12 -2
  14. package/locales/fr.json +1 -1
  15. package/locales/it/LC_MESSAGES/volto.po +12 -2
  16. package/locales/it.json +1 -1
  17. package/locales/ja/LC_MESSAGES/volto.po +12 -2
  18. package/locales/ja.json +1 -1
  19. package/locales/nl/LC_MESSAGES/volto.po +12 -2
  20. package/locales/nl.json +1 -1
  21. package/locales/pt/LC_MESSAGES/volto.po +12 -2
  22. package/locales/pt.json +1 -1
  23. package/locales/pt_BR/LC_MESSAGES/volto.po +12 -2
  24. package/locales/pt_BR.json +1 -1
  25. package/locales/ro/LC_MESSAGES/volto.po +12 -2
  26. package/locales/ro.json +1 -1
  27. package/locales/volto.pot +12 -2
  28. package/package.json +3 -2
  29. package/src/actions/vocabularies/vocabularies.js +15 -3
  30. package/src/components/index.js +1 -0
  31. package/src/components/manage/Add/Add.jsx +1 -0
  32. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +1 -1
  33. package/src/components/manage/Blocks/Listing/getAsyncData.js +1 -1
  34. package/src/components/manage/Blocks/Text/Edit.jsx +19 -0
  35. package/src/components/manage/Edit/Edit.jsx +1 -0
  36. package/src/components/manage/Form/Form.jsx +32 -6
  37. package/src/components/manage/Form/UndoToolbar.jsx +78 -0
  38. package/src/components/manage/Multilingual/TranslationObject.jsx +1 -0
  39. package/src/components/manage/Widgets/AlignWidget.stories.jsx +5 -21
  40. package/src/components/manage/Widgets/ArrayWidget.jsx +88 -88
  41. package/src/components/manage/Widgets/ArrayWidget.stories.jsx +37 -64
  42. package/src/components/manage/Widgets/CheckboxWidget.stories.jsx +5 -22
  43. package/src/components/manage/Widgets/DatetimeWidget.jsx +65 -74
  44. package/src/components/manage/Widgets/DatetimeWidget.stories.jsx +7 -23
  45. package/src/components/manage/Widgets/DatetimeWidget.test.jsx +17 -15
  46. package/src/components/manage/Widgets/EmailWidget.stories.jsx +5 -22
  47. package/src/components/manage/Widgets/FileWidget.stories.jsx +5 -22
  48. package/src/components/manage/Widgets/NumberWidget.stories.jsx +5 -23
  49. package/src/components/manage/Widgets/ObjectBrowserWidget.stories.js +24 -32
  50. package/src/components/manage/Widgets/ObjectListWidget.stories.js +44 -44
  51. package/src/components/manage/Widgets/ObjectWidget.stories.jsx +13 -28
  52. package/src/components/manage/Widgets/PasswordWidget.stories.jsx +5 -22
  53. package/src/components/manage/Widgets/QueryWidget.jsx +2 -2
  54. package/src/components/manage/Widgets/QueryWidget.stories.jsx +1637 -22
  55. package/src/components/manage/Widgets/SelectAutoComplete.jsx +79 -48
  56. package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +16 -0
  57. package/src/components/manage/Widgets/SelectAutocompleteWidget.stories.jsx +161 -0
  58. package/src/components/manage/Widgets/SelectUtils.js +90 -30
  59. package/src/components/manage/Widgets/SelectUtils.test.jsx +76 -1
  60. package/src/components/manage/Widgets/SelectWidget.jsx +26 -37
  61. package/src/components/manage/Widgets/SelectWidget.stories.jsx +96 -28
  62. package/src/components/manage/Widgets/TextWidget.stories.jsx +5 -22
  63. package/src/components/manage/Widgets/TextareaWidget.stories.jsx +5 -22
  64. package/src/components/manage/Widgets/TokenWidget.jsx +19 -17
  65. package/src/components/manage/Widgets/TokenWidget.stories.jsx +141 -0
  66. package/src/components/manage/Widgets/UrlWidget.stories.jsx +5 -21
  67. package/src/components/manage/Widgets/VocabularyTermsWidget.stories.js +27 -64
  68. package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +5 -22
  69. package/src/components/manage/Widgets/story.jsx +38 -0
  70. package/src/components/theme/ContactForm/ContactForm.jsx +1 -0
  71. package/src/components/theme/ContactForm/ContactForm.stories.jsx +126 -0
  72. package/src/components/theme/CorsError/CorsError.jsx +2 -2
  73. package/src/components/theme/Navigation/NavItem.jsx +3 -1
  74. package/src/config/Blocks.jsx +8 -1
  75. package/src/config/Loadables.jsx +2 -0
  76. package/src/config/index.js +3 -0
  77. package/src/helpers/UndoManager/useUndoManager.js +102 -0
  78. package/src/helpers/index.js +1 -0
  79. package/src/reducers/vocabularies/vocabularies.js +13 -2
  80. package/src/store.js +1 -1
  81. package/src/storybook.jsx +55 -0
  82. package/theme/themes/pastanaga/extras/time-picker-overrides.less +1 -1
  83. package/include/python3.8/Python-ast.h +0 -715
  84. package/include/python3.8/Python.h +0 -160
  85. package/include/python3.8/abstract.h +0 -844
  86. package/include/python3.8/asdl.h +0 -46
  87. package/include/python3.8/ast.h +0 -37
  88. package/include/python3.8/bitset.h +0 -23
  89. package/include/python3.8/bltinmodule.h +0 -14
  90. package/include/python3.8/boolobject.h +0 -34
  91. package/include/python3.8/bytearrayobject.h +0 -62
  92. package/include/python3.8/bytes_methods.h +0 -69
  93. package/include/python3.8/bytesobject.h +0 -224
  94. package/include/python3.8/cellobject.h +0 -29
  95. package/include/python3.8/ceval.h +0 -231
  96. package/include/python3.8/classobject.h +0 -59
  97. package/include/python3.8/code.h +0 -180
  98. package/include/python3.8/codecs.h +0 -240
  99. package/include/python3.8/compile.h +0 -106
  100. package/include/python3.8/complexobject.h +0 -69
  101. package/include/python3.8/context.h +0 -84
  102. package/include/python3.8/cpython/abstract.h +0 -319
  103. package/include/python3.8/cpython/dictobject.h +0 -94
  104. package/include/python3.8/cpython/fileobject.h +0 -24
  105. package/include/python3.8/cpython/initconfig.h +0 -434
  106. package/include/python3.8/cpython/interpreteridobject.h +0 -19
  107. package/include/python3.8/cpython/object.h +0 -470
  108. package/include/python3.8/cpython/objimpl.h +0 -113
  109. package/include/python3.8/cpython/pyerrors.h +0 -188
  110. package/include/python3.8/cpython/pylifecycle.h +0 -78
  111. package/include/python3.8/cpython/pymem.h +0 -108
  112. package/include/python3.8/cpython/pystate.h +0 -252
  113. package/include/python3.8/cpython/sysmodule.h +0 -21
  114. package/include/python3.8/cpython/traceback.h +0 -22
  115. package/include/python3.8/cpython/tupleobject.h +0 -36
  116. package/include/python3.8/cpython/unicodeobject.h +0 -1239
  117. package/include/python3.8/datetime.h +0 -259
  118. package/include/python3.8/descrobject.h +0 -108
  119. package/include/python3.8/dictobject.h +0 -94
  120. package/include/python3.8/dtoa.h +0 -19
  121. package/include/python3.8/dynamic_annotations.h +0 -499
  122. package/include/python3.8/enumobject.h +0 -17
  123. package/include/python3.8/errcode.h +0 -38
  124. package/include/python3.8/eval.h +0 -37
  125. package/include/python3.8/fileobject.h +0 -49
  126. package/include/python3.8/fileutils.h +0 -185
  127. package/include/python3.8/floatobject.h +0 -130
  128. package/include/python3.8/frameobject.h +0 -92
  129. package/include/python3.8/funcobject.h +0 -104
  130. package/include/python3.8/genobject.h +0 -109
  131. package/include/python3.8/graminit.h +0 -94
  132. package/include/python3.8/grammar.h +0 -77
  133. package/include/python3.8/import.h +0 -149
  134. package/include/python3.8/internal/pycore_accu.h +0 -39
  135. package/include/python3.8/internal/pycore_atomic.h +0 -558
  136. package/include/python3.8/internal/pycore_ceval.h +0 -37
  137. package/include/python3.8/internal/pycore_code.h +0 -27
  138. package/include/python3.8/internal/pycore_condvar.h +0 -95
  139. package/include/python3.8/internal/pycore_context.h +0 -42
  140. package/include/python3.8/internal/pycore_fileutils.h +0 -54
  141. package/include/python3.8/internal/pycore_getopt.h +0 -22
  142. package/include/python3.8/internal/pycore_gil.h +0 -50
  143. package/include/python3.8/internal/pycore_hamt.h +0 -116
  144. package/include/python3.8/internal/pycore_initconfig.h +0 -166
  145. package/include/python3.8/internal/pycore_object.h +0 -81
  146. package/include/python3.8/internal/pycore_pathconfig.h +0 -75
  147. package/include/python3.8/internal/pycore_pyerrors.h +0 -62
  148. package/include/python3.8/internal/pycore_pyhash.h +0 -10
  149. package/include/python3.8/internal/pycore_pylifecycle.h +0 -118
  150. package/include/python3.8/internal/pycore_pymem.h +0 -212
  151. package/include/python3.8/internal/pycore_pystate.h +0 -326
  152. package/include/python3.8/internal/pycore_traceback.h +0 -96
  153. package/include/python3.8/internal/pycore_tupleobject.h +0 -19
  154. package/include/python3.8/internal/pycore_warnings.h +0 -25
  155. package/include/python3.8/interpreteridobject.h +0 -17
  156. package/include/python3.8/intrcheck.h +0 -33
  157. package/include/python3.8/iterobject.h +0 -25
  158. package/include/python3.8/listobject.h +0 -81
  159. package/include/python3.8/longintrepr.h +0 -99
  160. package/include/python3.8/longobject.h +0 -242
  161. package/include/python3.8/marshal.h +0 -28
  162. package/include/python3.8/memoryobject.h +0 -72
  163. package/include/python3.8/methodobject.h +0 -131
  164. package/include/python3.8/modsupport.h +0 -248
  165. package/include/python3.8/moduleobject.h +0 -90
  166. package/include/python3.8/namespaceobject.h +0 -19
  167. package/include/python3.8/node.h +0 -48
  168. package/include/python3.8/object.h +0 -753
  169. package/include/python3.8/objimpl.h +0 -284
  170. package/include/python3.8/odictobject.h +0 -43
  171. package/include/python3.8/opcode.h +0 -148
  172. package/include/python3.8/osdefs.h +0 -51
  173. package/include/python3.8/osmodule.h +0 -17
  174. package/include/python3.8/parsetok.h +0 -110
  175. package/include/python3.8/patchlevel.h +0 -35
  176. package/include/python3.8/picklebufobject.h +0 -31
  177. package/include/python3.8/py_curses.h +0 -100
  178. package/include/python3.8/pyarena.h +0 -64
  179. package/include/python3.8/pycapsule.h +0 -59
  180. package/include/python3.8/pyconfig.h +0 -1665
  181. package/include/python3.8/pyctype.h +0 -39
  182. package/include/python3.8/pydebug.h +0 -40
  183. package/include/python3.8/pydtrace.h +0 -59
  184. package/include/python3.8/pydtrace_probes.h +0 -228
  185. package/include/python3.8/pyerrors.h +0 -335
  186. package/include/python3.8/pyexpat.h +0 -55
  187. package/include/python3.8/pyfpe.h +0 -12
  188. package/include/python3.8/pyhash.h +0 -145
  189. package/include/python3.8/pylifecycle.h +0 -75
  190. package/include/python3.8/pymacconfig.h +0 -102
  191. package/include/python3.8/pymacro.h +0 -106
  192. package/include/python3.8/pymath.h +0 -230
  193. package/include/python3.8/pymem.h +0 -150
  194. package/include/python3.8/pyport.h +0 -850
  195. package/include/python3.8/pystate.h +0 -136
  196. package/include/python3.8/pystrcmp.h +0 -23
  197. package/include/python3.8/pystrhex.h +0 -22
  198. package/include/python3.8/pystrtod.h +0 -45
  199. package/include/python3.8/pythonrun.h +0 -210
  200. package/include/python3.8/pythread.h +0 -161
  201. package/include/python3.8/pytime.h +0 -246
  202. package/include/python3.8/rangeobject.h +0 -27
  203. package/include/python3.8/setobject.h +0 -108
  204. package/include/python3.8/sliceobject.h +0 -65
  205. package/include/python3.8/structmember.h +0 -74
  206. package/include/python3.8/structseq.h +0 -49
  207. package/include/python3.8/symtable.h +0 -123
  208. package/include/python3.8/sysmodule.h +0 -41
  209. package/include/python3.8/token.h +0 -92
  210. package/include/python3.8/traceback.h +0 -28
  211. package/include/python3.8/tracemalloc.h +0 -38
  212. package/include/python3.8/tupleobject.h +0 -48
  213. package/include/python3.8/typeslots.h +0 -85
  214. package/include/python3.8/ucnhash.h +0 -36
  215. package/include/python3.8/unicodeobject.h +0 -1044
  216. package/include/python3.8/warnings.h +0 -67
  217. package/include/python3.8/weakrefobject.h +0 -86
  218. package/src/components/theme/ContactForm/ContactForm.stories.mdx +0 -39
@@ -1,118 +0,0 @@
1
- #ifndef Py_INTERNAL_LIFECYCLE_H
2
- #define Py_INTERNAL_LIFECYCLE_H
3
- #ifdef __cplusplus
4
- extern "C" {
5
- #endif
6
-
7
- #ifndef Py_BUILD_CORE
8
- # error "this header requires Py_BUILD_CORE define"
9
- #endif
10
-
11
- #include "pycore_initconfig.h" /* _PyArgv */
12
- #include "pycore_pystate.h" /* _PyRuntimeState */
13
-
14
- /* True if the main interpreter thread exited due to an unhandled
15
- * KeyboardInterrupt exception, suggesting the user pressed ^C. */
16
- PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt;
17
-
18
- extern int _Py_SetFileSystemEncoding(
19
- const char *encoding,
20
- const char *errors);
21
- extern void _Py_ClearFileSystemEncoding(void);
22
- extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate);
23
- #ifdef MS_WINDOWS
24
- extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void);
25
- #endif
26
-
27
- PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void);
28
-
29
- PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
30
-
31
- /* Various one-time initializers */
32
-
33
- extern PyStatus _PyUnicode_Init(void);
34
- extern int _PyStructSequence_Init(void);
35
- extern int _PyLong_Init(void);
36
- extern PyStatus _PyFaulthandler_Init(int enable);
37
- extern int _PyTraceMalloc_Init(int enable);
38
- extern PyObject * _PyBuiltin_Init(void);
39
- extern PyStatus _PySys_Create(
40
- _PyRuntimeState *runtime,
41
- PyInterpreterState *interp,
42
- PyObject **sysmod_p);
43
- extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict);
44
- extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
45
- extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
46
- extern int _PySys_InitMain(
47
- _PyRuntimeState *runtime,
48
- PyInterpreterState *interp);
49
- extern PyStatus _PyImport_Init(PyInterpreterState *interp);
50
- extern PyStatus _PyExc_Init(void);
51
- extern PyStatus _PyErr_Init(void);
52
- extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod);
53
- extern PyStatus _PyImportHooks_Init(void);
54
- extern int _PyFloat_Init(void);
55
- extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
56
-
57
- extern PyStatus _PyTypes_Init(void);
58
- extern PyStatus _PyImportZip_Init(PyInterpreterState *interp);
59
-
60
-
61
- /* Various internal finalizers */
62
-
63
- extern void PyMethod_Fini(void);
64
- extern void PyFrame_Fini(void);
65
- extern void PyCFunction_Fini(void);
66
- extern void PyDict_Fini(void);
67
- extern void PyTuple_Fini(void);
68
- extern void PyList_Fini(void);
69
- extern void PySet_Fini(void);
70
- extern void PyBytes_Fini(void);
71
- extern void PyFloat_Fini(void);
72
-
73
- extern int _PySignal_Init(int install_signal_handlers);
74
- extern void PyOS_FiniInterrupts(void);
75
- extern void PySlice_Fini(void);
76
- extern void PyAsyncGen_Fini(void);
77
-
78
- extern void _PyExc_Fini(void);
79
- extern void _PyImport_Fini(void);
80
- extern void _PyImport_Fini2(void);
81
- extern void _PyGC_Fini(_PyRuntimeState *runtime);
82
- extern void _PyType_Fini(void);
83
- extern void _Py_HashRandomization_Fini(void);
84
- extern void _PyUnicode_Fini(void);
85
- extern void PyLong_Fini(void);
86
- extern void _PyFaulthandler_Fini(void);
87
- extern void _PyHash_Fini(void);
88
- extern void _PyTraceMalloc_Fini(void);
89
- extern void _PyWarnings_Fini(PyInterpreterState *interp);
90
-
91
- extern void _PyGILState_Init(
92
- _PyRuntimeState *runtime,
93
- PyInterpreterState *interp,
94
- PyThreadState *tstate);
95
- extern void _PyGILState_Fini(_PyRuntimeState *runtime);
96
-
97
- PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime);
98
-
99
- PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv(
100
- const PyPreConfig *src_config,
101
- const _PyArgv *args);
102
- PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
103
- const PyConfig *config,
104
- const _PyArgv *args);
105
-
106
-
107
- PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
108
-
109
- PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);
110
-
111
- PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
112
- PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception,
113
- PyObject *value, PyObject *tb);
114
-
115
- #ifdef __cplusplus
116
- }
117
- #endif
118
- #endif /* !Py_INTERNAL_LIFECYCLE_H */
@@ -1,212 +0,0 @@
1
- #ifndef Py_INTERNAL_PYMEM_H
2
- #define Py_INTERNAL_PYMEM_H
3
- #ifdef __cplusplus
4
- extern "C" {
5
- #endif
6
-
7
- #ifndef Py_BUILD_CORE
8
- # error "this header requires Py_BUILD_CORE define"
9
- #endif
10
-
11
- #include "objimpl.h"
12
- #include "pymem.h"
13
-
14
-
15
- /* GC runtime state */
16
-
17
- /* If we change this, we need to change the default value in the
18
- signature of gc.collect. */
19
- #define NUM_GENERATIONS 3
20
-
21
- /*
22
- NOTE: about the counting of long-lived objects.
23
-
24
- To limit the cost of garbage collection, there are two strategies;
25
- - make each collection faster, e.g. by scanning fewer objects
26
- - do less collections
27
- This heuristic is about the latter strategy.
28
-
29
- In addition to the various configurable thresholds, we only trigger a
30
- full collection if the ratio
31
- long_lived_pending / long_lived_total
32
- is above a given value (hardwired to 25%).
33
-
34
- The reason is that, while "non-full" collections (i.e., collections of
35
- the young and middle generations) will always examine roughly the same
36
- number of objects -- determined by the aforementioned thresholds --,
37
- the cost of a full collection is proportional to the total number of
38
- long-lived objects, which is virtually unbounded.
39
-
40
- Indeed, it has been remarked that doing a full collection every
41
- <constant number> of object creations entails a dramatic performance
42
- degradation in workloads which consist in creating and storing lots of
43
- long-lived objects (e.g. building a large list of GC-tracked objects would
44
- show quadratic performance, instead of linear as expected: see issue #4074).
45
-
46
- Using the above ratio, instead, yields amortized linear performance in
47
- the total number of objects (the effect of which can be summarized
48
- thusly: "each full garbage collection is more and more costly as the
49
- number of objects grows, but we do fewer and fewer of them").
50
-
51
- This heuristic was suggested by Martin von Löwis on python-dev in
52
- June 2008. His original analysis and proposal can be found at:
53
- http://mail.python.org/pipermail/python-dev/2008-June/080579.html
54
- */
55
-
56
- /*
57
- NOTE: about untracking of mutable objects.
58
-
59
- Certain types of container cannot participate in a reference cycle, and
60
- so do not need to be tracked by the garbage collector. Untracking these
61
- objects reduces the cost of garbage collections. However, determining
62
- which objects may be untracked is not free, and the costs must be
63
- weighed against the benefits for garbage collection.
64
-
65
- There are two possible strategies for when to untrack a container:
66
-
67
- i) When the container is created.
68
- ii) When the container is examined by the garbage collector.
69
-
70
- Tuples containing only immutable objects (integers, strings etc, and
71
- recursively, tuples of immutable objects) do not need to be tracked.
72
- The interpreter creates a large number of tuples, many of which will
73
- not survive until garbage collection. It is therefore not worthwhile
74
- to untrack eligible tuples at creation time.
75
-
76
- Instead, all tuples except the empty tuple are tracked when created.
77
- During garbage collection it is determined whether any surviving tuples
78
- can be untracked. A tuple can be untracked if all of its contents are
79
- already not tracked. Tuples are examined for untracking in all garbage
80
- collection cycles. It may take more than one cycle to untrack a tuple.
81
-
82
- Dictionaries containing only immutable objects also do not need to be
83
- tracked. Dictionaries are untracked when created. If a tracked item is
84
- inserted into a dictionary (either as a key or value), the dictionary
85
- becomes tracked. During a full garbage collection (all generations),
86
- the collector will untrack any dictionaries whose contents are not
87
- tracked.
88
-
89
- The module provides the python function is_tracked(obj), which returns
90
- the CURRENT tracking status of the object. Subsequent garbage
91
- collections may change the tracking status of the object.
92
-
93
- Untracking of certain containers was introduced in issue #4688, and
94
- the algorithm was refined in response to issue #14775.
95
- */
96
-
97
- struct gc_generation {
98
- PyGC_Head head;
99
- int threshold; /* collection threshold */
100
- int count; /* count of allocations or collections of younger
101
- generations */
102
- };
103
-
104
- /* Running stats per generation */
105
- struct gc_generation_stats {
106
- /* total number of collections */
107
- Py_ssize_t collections;
108
- /* total number of collected objects */
109
- Py_ssize_t collected;
110
- /* total number of uncollectable objects (put into gc.garbage) */
111
- Py_ssize_t uncollectable;
112
- };
113
-
114
- struct _gc_runtime_state {
115
- /* List of objects that still need to be cleaned up, singly linked
116
- * via their gc headers' gc_prev pointers. */
117
- PyObject *trash_delete_later;
118
- /* Current call-stack depth of tp_dealloc calls. */
119
- int trash_delete_nesting;
120
-
121
- int enabled;
122
- int debug;
123
- /* linked lists of container objects */
124
- struct gc_generation generations[NUM_GENERATIONS];
125
- PyGC_Head *generation0;
126
- /* a permanent generation which won't be collected */
127
- struct gc_generation permanent_generation;
128
- struct gc_generation_stats generation_stats[NUM_GENERATIONS];
129
- /* true if we are currently running the collector */
130
- int collecting;
131
- /* list of uncollectable objects */
132
- PyObject *garbage;
133
- /* a list of callbacks to be invoked when collection is performed */
134
- PyObject *callbacks;
135
- /* This is the number of objects that survived the last full
136
- collection. It approximates the number of long lived objects
137
- tracked by the GC.
138
-
139
- (by "full collection", we mean a collection of the oldest
140
- generation). */
141
- Py_ssize_t long_lived_total;
142
- /* This is the number of objects that survived all "non-full"
143
- collections, and are awaiting to undergo a full collection for
144
- the first time. */
145
- Py_ssize_t long_lived_pending;
146
- };
147
-
148
- PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *);
149
-
150
-
151
- /* Set the memory allocator of the specified domain to the default.
152
- Save the old allocator into *old_alloc if it's non-NULL.
153
- Return on success, or return -1 if the domain is unknown. */
154
- PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
155
- PyMemAllocatorDomain domain,
156
- PyMemAllocatorEx *old_alloc);
157
-
158
- /* Special bytes broadcast into debug memory blocks at appropriate times.
159
- Strings of these are unlikely to be valid addresses, floats, ints or
160
- 7-bit ASCII.
161
-
162
- - PYMEM_CLEANBYTE: clean (newly allocated) memory
163
- - PYMEM_DEADBYTE dead (newly freed) memory
164
- - PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block
165
-
166
- Byte patterns 0xCB, 0xDB and 0xFB have been replaced with 0xCD, 0xDD and
167
- 0xFD to use the same values than Windows CRT debug malloc() and free().
168
- If modified, _PyMem_IsPtrFreed() should be updated as well. */
169
- #define PYMEM_CLEANBYTE 0xCD
170
- #define PYMEM_DEADBYTE 0xDD
171
- #define PYMEM_FORBIDDENBYTE 0xFD
172
-
173
- /* Heuristic checking if a pointer value is newly allocated
174
- (uninitialized), newly freed or NULL (is equal to zero).
175
-
176
- The pointer is not dereferenced, only the pointer value is checked.
177
-
178
- The heuristic relies on the debug hooks on Python memory allocators which
179
- fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory
180
- with DEADBYTE (0xDD). Detect also "untouchable bytes" marked
181
- with FORBIDDENBYTE (0xFD). */
182
- static inline int _PyMem_IsPtrFreed(void *ptr)
183
- {
184
- uintptr_t value = (uintptr_t)ptr;
185
- #if SIZEOF_VOID_P == 8
186
- return (value == 0
187
- || value == (uintptr_t)0xCDCDCDCDCDCDCDCD
188
- || value == (uintptr_t)0xDDDDDDDDDDDDDDDD
189
- || value == (uintptr_t)0xFDFDFDFDFDFDFDFD);
190
- #elif SIZEOF_VOID_P == 4
191
- return (value == 0
192
- || value == (uintptr_t)0xCDCDCDCD
193
- || value == (uintptr_t)0xDDDDDDDD
194
- || value == (uintptr_t)0xFDFDFDFD);
195
- #else
196
- # error "unknown pointer size"
197
- #endif
198
- }
199
-
200
- PyAPI_FUNC(int) _PyMem_GetAllocatorName(
201
- const char *name,
202
- PyMemAllocatorName *allocator);
203
-
204
- /* Configure the Python memory allocators.
205
- Pass PYMEM_ALLOCATOR_DEFAULT to use default allocators.
206
- PYMEM_ALLOCATOR_NOT_SET does nothing. */
207
- PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator);
208
-
209
- #ifdef __cplusplus
210
- }
211
- #endif
212
- #endif /* !Py_INTERNAL_PYMEM_H */
@@ -1,326 +0,0 @@
1
- #ifndef Py_INTERNAL_PYSTATE_H
2
- #define Py_INTERNAL_PYSTATE_H
3
- #ifdef __cplusplus
4
- extern "C" {
5
- #endif
6
-
7
- #ifndef Py_BUILD_CORE
8
- # error "this header requires Py_BUILD_CORE define"
9
- #endif
10
-
11
- #include "cpython/initconfig.h"
12
- #include "fileobject.h"
13
- #include "pystate.h"
14
- #include "pythread.h"
15
- #include "sysmodule.h"
16
-
17
- #include "pycore_gil.h" /* _gil_runtime_state */
18
- #include "pycore_pathconfig.h"
19
- #include "pycore_pymem.h"
20
- #include "pycore_warnings.h"
21
-
22
-
23
- /* ceval state */
24
-
25
- struct _pending_calls {
26
- int finishing;
27
- PyThread_type_lock lock;
28
- /* Request for running pending calls. */
29
- _Py_atomic_int calls_to_do;
30
- /* Request for looking at the `async_exc` field of the current
31
- thread state.
32
- Guarded by the GIL. */
33
- int async_exc;
34
- #define NPENDINGCALLS 32
35
- struct {
36
- int (*func)(void *);
37
- void *arg;
38
- } calls[NPENDINGCALLS];
39
- int first;
40
- int last;
41
- };
42
-
43
- struct _ceval_runtime_state {
44
- int recursion_limit;
45
- /* Records whether tracing is on for any thread. Counts the number
46
- of threads for which tstate->c_tracefunc is non-NULL, so if the
47
- value is 0, we know we don't have to check this thread's
48
- c_tracefunc. This speeds up the if statement in
49
- PyEval_EvalFrameEx() after fast_next_opcode. */
50
- int tracing_possible;
51
- /* This single variable consolidates all requests to break out of
52
- the fast path in the eval loop. */
53
- _Py_atomic_int eval_breaker;
54
- /* Request for dropping the GIL */
55
- _Py_atomic_int gil_drop_request;
56
- struct _pending_calls pending;
57
- /* Request for checking signals. */
58
- _Py_atomic_int signals_pending;
59
- struct _gil_runtime_state gil;
60
- };
61
-
62
- /* interpreter state */
63
-
64
- typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int);
65
-
66
- // The PyInterpreterState typedef is in Include/pystate.h.
67
- struct _is {
68
-
69
- struct _is *next;
70
- struct _ts *tstate_head;
71
-
72
- int64_t id;
73
- int64_t id_refcount;
74
- int requires_idref;
75
- PyThread_type_lock id_mutex;
76
-
77
- int finalizing;
78
-
79
- PyObject *modules;
80
- PyObject *modules_by_index;
81
- PyObject *sysdict;
82
- PyObject *builtins;
83
- PyObject *importlib;
84
-
85
- /* Used in Python/sysmodule.c. */
86
- int check_interval;
87
-
88
- /* Used in Modules/_threadmodule.c. */
89
- long num_threads;
90
- /* Support for runtime thread stack size tuning.
91
- A value of 0 means using the platform's default stack size
92
- or the size specified by the THREAD_STACK_SIZE macro. */
93
- /* Used in Python/thread.c. */
94
- size_t pythread_stacksize;
95
-
96
- PyObject *codec_search_path;
97
- PyObject *codec_search_cache;
98
- PyObject *codec_error_registry;
99
- int codecs_initialized;
100
-
101
- /* fs_codec.encoding is initialized to NULL.
102
- Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */
103
- struct {
104
- char *encoding; /* Filesystem encoding (encoded to UTF-8) */
105
- char *errors; /* Filesystem errors (encoded to UTF-8) */
106
- _Py_error_handler error_handler;
107
- } fs_codec;
108
-
109
- PyConfig config;
110
- #ifdef HAVE_DLOPEN
111
- int dlopenflags;
112
- #endif
113
-
114
- PyObject *dict; /* Stores per-interpreter state */
115
-
116
- PyObject *builtins_copy;
117
- PyObject *import_func;
118
- /* Initialized to PyEval_EvalFrameDefault(). */
119
- _PyFrameEvalFunction eval_frame;
120
-
121
- Py_ssize_t co_extra_user_count;
122
- freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS];
123
-
124
- #ifdef HAVE_FORK
125
- PyObject *before_forkers;
126
- PyObject *after_forkers_parent;
127
- PyObject *after_forkers_child;
128
- #endif
129
- /* AtExit module */
130
- void (*pyexitfunc)(PyObject *);
131
- PyObject *pyexitmodule;
132
-
133
- uint64_t tstate_next_unique_id;
134
-
135
- struct _warnings_runtime_state warnings;
136
-
137
- PyObject *audit_hooks;
138
- };
139
-
140
- PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T);
141
-
142
- PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *);
143
- PyAPI_FUNC(int) _PyInterpreterState_IDIncref(struct _is *);
144
- PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *);
145
-
146
-
147
- /* cross-interpreter data registry */
148
-
149
- /* For now we use a global registry of shareable classes. An
150
- alternative would be to add a tp_* slot for a class's
151
- crossinterpdatafunc. It would be simpler and more efficient. */
152
-
153
- struct _xidregitem;
154
-
155
- struct _xidregitem {
156
- PyTypeObject *cls;
157
- crossinterpdatafunc getdata;
158
- struct _xidregitem *next;
159
- };
160
-
161
- /* runtime audit hook state */
162
-
163
- typedef struct _Py_AuditHookEntry {
164
- struct _Py_AuditHookEntry *next;
165
- Py_AuditHookFunction hookCFunction;
166
- void *userData;
167
- } _Py_AuditHookEntry;
168
-
169
- /* GIL state */
170
-
171
- struct _gilstate_runtime_state {
172
- int check_enabled;
173
- /* Assuming the current thread holds the GIL, this is the
174
- PyThreadState for the current thread. */
175
- _Py_atomic_address tstate_current;
176
- PyThreadFrameGetter getframe;
177
- /* The single PyInterpreterState used by this process'
178
- GILState implementation
179
- */
180
- /* TODO: Given interp_main, it may be possible to kill this ref */
181
- PyInterpreterState *autoInterpreterState;
182
- Py_tss_t autoTSSkey;
183
- };
184
-
185
- /* hook for PyEval_GetFrame(), requested for Psyco */
186
- #define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe
187
-
188
- /* Issue #26558: Flag to disable PyGILState_Check().
189
- If set to non-zero, PyGILState_Check() always return 1. */
190
- #define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled
191
-
192
-
193
- /* Full Python runtime state */
194
-
195
- typedef struct pyruntimestate {
196
- /* Is running Py_PreInitialize()? */
197
- int preinitializing;
198
-
199
- /* Is Python preinitialized? Set to 1 by Py_PreInitialize() */
200
- int preinitialized;
201
-
202
- /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */
203
- int core_initialized;
204
-
205
- /* Is Python fully initialized? Set to 1 by Py_Initialize() */
206
- int initialized;
207
-
208
- /* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize()
209
- is called again. */
210
- PyThreadState *finalizing;
211
-
212
- struct pyinterpreters {
213
- PyThread_type_lock mutex;
214
- PyInterpreterState *head;
215
- PyInterpreterState *main;
216
- /* _next_interp_id is an auto-numbered sequence of small
217
- integers. It gets initialized in _PyInterpreterState_Init(),
218
- which is called in Py_Initialize(), and used in
219
- PyInterpreterState_New(). A negative interpreter ID
220
- indicates an error occurred. The main interpreter will
221
- always have an ID of 0. Overflow results in a RuntimeError.
222
- If that becomes a problem later then we can adjust, e.g. by
223
- using a Python int. */
224
- int64_t next_id;
225
- } interpreters;
226
- // XXX Remove this field once we have a tp_* slot.
227
- struct _xidregistry {
228
- PyThread_type_lock mutex;
229
- struct _xidregitem *head;
230
- } xidregistry;
231
-
232
- unsigned long main_thread;
233
-
234
- #define NEXITFUNCS 32
235
- void (*exitfuncs[NEXITFUNCS])(void);
236
- int nexitfuncs;
237
-
238
- struct _gc_runtime_state gc;
239
- struct _ceval_runtime_state ceval;
240
- struct _gilstate_runtime_state gilstate;
241
-
242
- PyPreConfig preconfig;
243
-
244
- Py_OpenCodeHookFunction open_code_hook;
245
- void *open_code_userdata;
246
- _Py_AuditHookEntry *audit_hook_head;
247
-
248
- // XXX Consolidate globals found via the check-c-globals script.
249
- } _PyRuntimeState;
250
-
251
- #define _PyRuntimeState_INIT \
252
- {.preinitialized = 0, .core_initialized = 0, .initialized = 0}
253
- /* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */
254
-
255
- PyAPI_DATA(_PyRuntimeState) _PyRuntime;
256
- PyAPI_FUNC(PyStatus) _PyRuntimeState_Init(_PyRuntimeState *runtime);
257
- PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime);
258
- PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);
259
-
260
- /* Initialize _PyRuntimeState.
261
- Return NULL on success, or return an error message on failure. */
262
- PyAPI_FUNC(PyStatus) _PyRuntime_Initialize(void);
263
-
264
- PyAPI_FUNC(void) _PyRuntime_Finalize(void);
265
-
266
- #define _Py_CURRENTLY_FINALIZING(runtime, tstate) \
267
- (runtime->finalizing == tstate)
268
-
269
-
270
- /* Variable and macro for in-line access to current thread
271
- and interpreter state */
272
-
273
- #define _PyRuntimeState_GetThreadState(runtime) \
274
- ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current))
275
-
276
- /* Get the current Python thread state.
277
-
278
- Efficient macro reading directly the 'gilstate.tstate_current' atomic
279
- variable. The macro is unsafe: it does not check for error and it can
280
- return NULL.
281
-
282
- The caller must hold the GIL.
283
-
284
- See also PyThreadState_Get() and PyThreadState_GET(). */
285
- #define _PyThreadState_GET() _PyRuntimeState_GetThreadState(&_PyRuntime)
286
-
287
- /* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */
288
- #undef PyThreadState_GET
289
- #define PyThreadState_GET() _PyThreadState_GET()
290
-
291
- /* Get the current interpreter state.
292
-
293
- The macro is unsafe: it does not check for error and it can return NULL.
294
-
295
- The caller must hold the GIL.
296
-
297
- See also _PyInterpreterState_Get()
298
- and _PyGILState_GetInterpreterStateUnsafe(). */
299
- #define _PyInterpreterState_GET_UNSAFE() (_PyThreadState_GET()->interp)
300
-
301
-
302
- /* Other */
303
-
304
- PyAPI_FUNC(void) _PyThreadState_Init(
305
- _PyRuntimeState *runtime,
306
- PyThreadState *tstate);
307
- PyAPI_FUNC(void) _PyThreadState_DeleteExcept(
308
- _PyRuntimeState *runtime,
309
- PyThreadState *tstate);
310
-
311
- PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap(
312
- struct _gilstate_runtime_state *gilstate,
313
- PyThreadState *newts);
314
-
315
- PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime);
316
- PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
317
-
318
- PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime);
319
-
320
-
321
- PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate);
322
-
323
- #ifdef __cplusplus
324
- }
325
- #endif
326
- #endif /* !Py_INTERNAL_PYSTATE_H */