@plone/volto 14.0.0 → 14.1.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 (216) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/locales/ca/LC_MESSAGES/volto.po +12 -2
  3. package/locales/ca.json +1 -1
  4. package/locales/de/LC_MESSAGES/volto.po +12 -2
  5. package/locales/de.json +1 -1
  6. package/locales/en/LC_MESSAGES/volto.po +12 -2
  7. package/locales/en.json +1 -1
  8. package/locales/es/LC_MESSAGES/volto.po +12 -2
  9. package/locales/es.json +1 -1
  10. package/locales/eu/LC_MESSAGES/volto.po +12 -2
  11. package/locales/eu.json +1 -1
  12. package/locales/fr/LC_MESSAGES/volto.po +12 -2
  13. package/locales/fr.json +1 -1
  14. package/locales/it/LC_MESSAGES/volto.po +12 -2
  15. package/locales/it.json +1 -1
  16. package/locales/ja/LC_MESSAGES/volto.po +12 -2
  17. package/locales/ja.json +1 -1
  18. package/locales/nl/LC_MESSAGES/volto.po +12 -2
  19. package/locales/nl.json +1 -1
  20. package/locales/pt/LC_MESSAGES/volto.po +12 -2
  21. package/locales/pt.json +1 -1
  22. package/locales/pt_BR/LC_MESSAGES/volto.po +12 -2
  23. package/locales/pt_BR.json +1 -1
  24. package/locales/ro/LC_MESSAGES/volto.po +12 -2
  25. package/locales/ro.json +1 -1
  26. package/locales/volto.pot +12 -2
  27. package/package.json +2 -1
  28. package/public/icon.svg +13 -0
  29. package/src/actions/vocabularies/vocabularies.js +15 -3
  30. package/src/components/index.js +1 -0
  31. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +1 -1
  32. package/src/components/manage/Blocks/Listing/getAsyncData.js +1 -1
  33. package/src/components/manage/Blocks/Text/Edit.jsx +19 -0
  34. package/src/components/manage/Form/Form.jsx +11 -1
  35. package/src/components/manage/Form/UndoToolbar.jsx +78 -0
  36. package/src/components/manage/Widgets/AlignWidget.stories.jsx +5 -21
  37. package/src/components/manage/Widgets/ArrayWidget.jsx +83 -101
  38. package/src/components/manage/Widgets/ArrayWidget.stories.jsx +29 -64
  39. package/src/components/manage/Widgets/CheckboxWidget.stories.jsx +5 -22
  40. package/src/components/manage/Widgets/DatetimeWidget.jsx +65 -74
  41. package/src/components/manage/Widgets/DatetimeWidget.stories.jsx +7 -23
  42. package/src/components/manage/Widgets/DatetimeWidget.test.jsx +17 -15
  43. package/src/components/manage/Widgets/EmailWidget.stories.jsx +5 -22
  44. package/src/components/manage/Widgets/FileWidget.stories.jsx +5 -22
  45. package/src/components/manage/Widgets/NumberWidget.stories.jsx +5 -23
  46. package/src/components/manage/Widgets/ObjectBrowserWidget.stories.js +24 -32
  47. package/src/components/manage/Widgets/ObjectListWidget.stories.js +44 -44
  48. package/src/components/manage/Widgets/ObjectWidget.stories.jsx +13 -28
  49. package/src/components/manage/Widgets/PasswordWidget.stories.jsx +5 -22
  50. package/src/components/manage/Widgets/QueryWidget.jsx +2 -2
  51. package/src/components/manage/Widgets/QueryWidget.stories.jsx +1637 -22
  52. package/src/components/manage/Widgets/SelectAutoComplete.jsx +79 -48
  53. package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +16 -0
  54. package/src/components/manage/Widgets/SelectAutocompleteWidget.stories.jsx +161 -0
  55. package/src/components/manage/Widgets/SelectUtils.js +90 -30
  56. package/src/components/manage/Widgets/SelectUtils.test.jsx +76 -1
  57. package/src/components/manage/Widgets/SelectWidget.jsx +26 -37
  58. package/src/components/manage/Widgets/SelectWidget.stories.jsx +96 -28
  59. package/src/components/manage/Widgets/TextWidget.stories.jsx +5 -22
  60. package/src/components/manage/Widgets/TextareaWidget.stories.jsx +5 -22
  61. package/src/components/manage/Widgets/TokenWidget.jsx +19 -17
  62. package/src/components/manage/Widgets/TokenWidget.stories.jsx +141 -0
  63. package/src/components/manage/Widgets/UrlWidget.stories.jsx +5 -21
  64. package/src/components/manage/Widgets/VocabularyTermsWidget.stories.js +27 -64
  65. package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +5 -22
  66. package/src/components/manage/Widgets/story.jsx +38 -0
  67. package/src/components/theme/ContactForm/ContactForm.jsx +1 -0
  68. package/src/components/theme/ContactForm/ContactForm.stories.jsx +126 -0
  69. package/src/components/theme/CorsError/CorsError.jsx +2 -2
  70. package/src/config/Loadables.jsx +2 -0
  71. package/src/config/index.js +1 -0
  72. package/src/helpers/Html/Html.jsx +2 -12
  73. package/src/helpers/UndoManager/useUndoManager.js +102 -0
  74. package/src/helpers/index.js +1 -0
  75. package/src/middleware/Api.test.js +57 -6
  76. package/src/middleware/api.js +34 -13
  77. package/src/reducers/vocabularies/vocabularies.js +13 -2
  78. package/src/store.js +1 -1
  79. package/src/storybook.jsx +55 -0
  80. package/theme/themes/pastanaga/extras/time-picker-overrides.less +1 -1
  81. package/include/python3.8/Python-ast.h +0 -715
  82. package/include/python3.8/Python.h +0 -160
  83. package/include/python3.8/abstract.h +0 -844
  84. package/include/python3.8/asdl.h +0 -46
  85. package/include/python3.8/ast.h +0 -37
  86. package/include/python3.8/bitset.h +0 -23
  87. package/include/python3.8/bltinmodule.h +0 -14
  88. package/include/python3.8/boolobject.h +0 -34
  89. package/include/python3.8/bytearrayobject.h +0 -62
  90. package/include/python3.8/bytes_methods.h +0 -69
  91. package/include/python3.8/bytesobject.h +0 -224
  92. package/include/python3.8/cellobject.h +0 -29
  93. package/include/python3.8/ceval.h +0 -231
  94. package/include/python3.8/classobject.h +0 -59
  95. package/include/python3.8/code.h +0 -180
  96. package/include/python3.8/codecs.h +0 -240
  97. package/include/python3.8/compile.h +0 -106
  98. package/include/python3.8/complexobject.h +0 -69
  99. package/include/python3.8/context.h +0 -84
  100. package/include/python3.8/cpython/abstract.h +0 -319
  101. package/include/python3.8/cpython/dictobject.h +0 -94
  102. package/include/python3.8/cpython/fileobject.h +0 -24
  103. package/include/python3.8/cpython/initconfig.h +0 -434
  104. package/include/python3.8/cpython/interpreteridobject.h +0 -19
  105. package/include/python3.8/cpython/object.h +0 -470
  106. package/include/python3.8/cpython/objimpl.h +0 -113
  107. package/include/python3.8/cpython/pyerrors.h +0 -188
  108. package/include/python3.8/cpython/pylifecycle.h +0 -78
  109. package/include/python3.8/cpython/pymem.h +0 -108
  110. package/include/python3.8/cpython/pystate.h +0 -252
  111. package/include/python3.8/cpython/sysmodule.h +0 -21
  112. package/include/python3.8/cpython/traceback.h +0 -22
  113. package/include/python3.8/cpython/tupleobject.h +0 -36
  114. package/include/python3.8/cpython/unicodeobject.h +0 -1239
  115. package/include/python3.8/datetime.h +0 -259
  116. package/include/python3.8/descrobject.h +0 -108
  117. package/include/python3.8/dictobject.h +0 -94
  118. package/include/python3.8/dtoa.h +0 -19
  119. package/include/python3.8/dynamic_annotations.h +0 -499
  120. package/include/python3.8/enumobject.h +0 -17
  121. package/include/python3.8/errcode.h +0 -38
  122. package/include/python3.8/eval.h +0 -37
  123. package/include/python3.8/fileobject.h +0 -49
  124. package/include/python3.8/fileutils.h +0 -185
  125. package/include/python3.8/floatobject.h +0 -130
  126. package/include/python3.8/frameobject.h +0 -92
  127. package/include/python3.8/funcobject.h +0 -104
  128. package/include/python3.8/genobject.h +0 -109
  129. package/include/python3.8/graminit.h +0 -94
  130. package/include/python3.8/grammar.h +0 -77
  131. package/include/python3.8/import.h +0 -149
  132. package/include/python3.8/internal/pycore_accu.h +0 -39
  133. package/include/python3.8/internal/pycore_atomic.h +0 -558
  134. package/include/python3.8/internal/pycore_ceval.h +0 -37
  135. package/include/python3.8/internal/pycore_code.h +0 -27
  136. package/include/python3.8/internal/pycore_condvar.h +0 -95
  137. package/include/python3.8/internal/pycore_context.h +0 -42
  138. package/include/python3.8/internal/pycore_fileutils.h +0 -54
  139. package/include/python3.8/internal/pycore_getopt.h +0 -22
  140. package/include/python3.8/internal/pycore_gil.h +0 -50
  141. package/include/python3.8/internal/pycore_hamt.h +0 -116
  142. package/include/python3.8/internal/pycore_initconfig.h +0 -166
  143. package/include/python3.8/internal/pycore_object.h +0 -81
  144. package/include/python3.8/internal/pycore_pathconfig.h +0 -75
  145. package/include/python3.8/internal/pycore_pyerrors.h +0 -62
  146. package/include/python3.8/internal/pycore_pyhash.h +0 -10
  147. package/include/python3.8/internal/pycore_pylifecycle.h +0 -118
  148. package/include/python3.8/internal/pycore_pymem.h +0 -212
  149. package/include/python3.8/internal/pycore_pystate.h +0 -326
  150. package/include/python3.8/internal/pycore_traceback.h +0 -96
  151. package/include/python3.8/internal/pycore_tupleobject.h +0 -19
  152. package/include/python3.8/internal/pycore_warnings.h +0 -25
  153. package/include/python3.8/interpreteridobject.h +0 -17
  154. package/include/python3.8/intrcheck.h +0 -33
  155. package/include/python3.8/iterobject.h +0 -25
  156. package/include/python3.8/listobject.h +0 -81
  157. package/include/python3.8/longintrepr.h +0 -99
  158. package/include/python3.8/longobject.h +0 -242
  159. package/include/python3.8/marshal.h +0 -28
  160. package/include/python3.8/memoryobject.h +0 -72
  161. package/include/python3.8/methodobject.h +0 -131
  162. package/include/python3.8/modsupport.h +0 -248
  163. package/include/python3.8/moduleobject.h +0 -90
  164. package/include/python3.8/namespaceobject.h +0 -19
  165. package/include/python3.8/node.h +0 -48
  166. package/include/python3.8/object.h +0 -753
  167. package/include/python3.8/objimpl.h +0 -284
  168. package/include/python3.8/odictobject.h +0 -43
  169. package/include/python3.8/opcode.h +0 -148
  170. package/include/python3.8/osdefs.h +0 -51
  171. package/include/python3.8/osmodule.h +0 -17
  172. package/include/python3.8/parsetok.h +0 -110
  173. package/include/python3.8/patchlevel.h +0 -35
  174. package/include/python3.8/picklebufobject.h +0 -31
  175. package/include/python3.8/py_curses.h +0 -100
  176. package/include/python3.8/pyarena.h +0 -64
  177. package/include/python3.8/pycapsule.h +0 -59
  178. package/include/python3.8/pyconfig.h +0 -1665
  179. package/include/python3.8/pyctype.h +0 -39
  180. package/include/python3.8/pydebug.h +0 -40
  181. package/include/python3.8/pydtrace.h +0 -59
  182. package/include/python3.8/pydtrace_probes.h +0 -228
  183. package/include/python3.8/pyerrors.h +0 -335
  184. package/include/python3.8/pyexpat.h +0 -55
  185. package/include/python3.8/pyfpe.h +0 -12
  186. package/include/python3.8/pyhash.h +0 -145
  187. package/include/python3.8/pylifecycle.h +0 -75
  188. package/include/python3.8/pymacconfig.h +0 -102
  189. package/include/python3.8/pymacro.h +0 -106
  190. package/include/python3.8/pymath.h +0 -230
  191. package/include/python3.8/pymem.h +0 -150
  192. package/include/python3.8/pyport.h +0 -850
  193. package/include/python3.8/pystate.h +0 -136
  194. package/include/python3.8/pystrcmp.h +0 -23
  195. package/include/python3.8/pystrhex.h +0 -22
  196. package/include/python3.8/pystrtod.h +0 -45
  197. package/include/python3.8/pythonrun.h +0 -210
  198. package/include/python3.8/pythread.h +0 -161
  199. package/include/python3.8/pytime.h +0 -246
  200. package/include/python3.8/rangeobject.h +0 -27
  201. package/include/python3.8/setobject.h +0 -108
  202. package/include/python3.8/sliceobject.h +0 -65
  203. package/include/python3.8/structmember.h +0 -74
  204. package/include/python3.8/structseq.h +0 -49
  205. package/include/python3.8/symtable.h +0 -123
  206. package/include/python3.8/sysmodule.h +0 -41
  207. package/include/python3.8/token.h +0 -92
  208. package/include/python3.8/traceback.h +0 -28
  209. package/include/python3.8/tracemalloc.h +0 -38
  210. package/include/python3.8/tupleobject.h +0 -48
  211. package/include/python3.8/typeslots.h +0 -85
  212. package/include/python3.8/ucnhash.h +0 -36
  213. package/include/python3.8/unicodeobject.h +0 -1044
  214. package/include/python3.8/warnings.h +0 -67
  215. package/include/python3.8/weakrefobject.h +0 -86
  216. package/src/components/theme/ContactForm/ContactForm.stories.mdx +0 -39
@@ -1,558 +0,0 @@
1
- #ifndef Py_ATOMIC_H
2
- #define Py_ATOMIC_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 "dynamic_annotations.h"
12
-
13
- #include "pyconfig.h"
14
-
15
- #if defined(HAVE_STD_ATOMIC)
16
- #include <stdatomic.h>
17
- #endif
18
-
19
-
20
- #if defined(_MSC_VER)
21
- #include <intrin.h>
22
- #if defined(_M_IX86) || defined(_M_X64)
23
- # include <immintrin.h>
24
- #endif
25
- #endif
26
-
27
- /* This is modeled after the atomics interface from C1x, according to
28
- * the draft at
29
- * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf.
30
- * Operations and types are named the same except with a _Py_ prefix
31
- * and have the same semantics.
32
- *
33
- * Beware, the implementations here are deep magic.
34
- */
35
-
36
- #if defined(HAVE_STD_ATOMIC)
37
-
38
- typedef enum _Py_memory_order {
39
- _Py_memory_order_relaxed = memory_order_relaxed,
40
- _Py_memory_order_acquire = memory_order_acquire,
41
- _Py_memory_order_release = memory_order_release,
42
- _Py_memory_order_acq_rel = memory_order_acq_rel,
43
- _Py_memory_order_seq_cst = memory_order_seq_cst
44
- } _Py_memory_order;
45
-
46
- typedef struct _Py_atomic_address {
47
- atomic_uintptr_t _value;
48
- } _Py_atomic_address;
49
-
50
- typedef struct _Py_atomic_int {
51
- atomic_int _value;
52
- } _Py_atomic_int;
53
-
54
- #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
55
- atomic_signal_fence(ORDER)
56
-
57
- #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
58
- atomic_thread_fence(ORDER)
59
-
60
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
61
- atomic_store_explicit(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER)
62
-
63
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
64
- atomic_load_explicit(&((ATOMIC_VAL)->_value), ORDER)
65
-
66
- /* Use builtin atomic operations in GCC >= 4.7 */
67
- #elif defined(HAVE_BUILTIN_ATOMIC)
68
-
69
- typedef enum _Py_memory_order {
70
- _Py_memory_order_relaxed = __ATOMIC_RELAXED,
71
- _Py_memory_order_acquire = __ATOMIC_ACQUIRE,
72
- _Py_memory_order_release = __ATOMIC_RELEASE,
73
- _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL,
74
- _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST
75
- } _Py_memory_order;
76
-
77
- typedef struct _Py_atomic_address {
78
- uintptr_t _value;
79
- } _Py_atomic_address;
80
-
81
- typedef struct _Py_atomic_int {
82
- int _value;
83
- } _Py_atomic_int;
84
-
85
- #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
86
- __atomic_signal_fence(ORDER)
87
-
88
- #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
89
- __atomic_thread_fence(ORDER)
90
-
91
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
92
- (assert((ORDER) == __ATOMIC_RELAXED \
93
- || (ORDER) == __ATOMIC_SEQ_CST \
94
- || (ORDER) == __ATOMIC_RELEASE), \
95
- __atomic_store_n(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER))
96
-
97
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
98
- (assert((ORDER) == __ATOMIC_RELAXED \
99
- || (ORDER) == __ATOMIC_SEQ_CST \
100
- || (ORDER) == __ATOMIC_ACQUIRE \
101
- || (ORDER) == __ATOMIC_CONSUME), \
102
- __atomic_load_n(&((ATOMIC_VAL)->_value), ORDER))
103
-
104
- /* Only support GCC (for expression statements) and x86 (for simple
105
- * atomic semantics) and MSVC x86/x64/ARM */
106
- #elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64))
107
- typedef enum _Py_memory_order {
108
- _Py_memory_order_relaxed,
109
- _Py_memory_order_acquire,
110
- _Py_memory_order_release,
111
- _Py_memory_order_acq_rel,
112
- _Py_memory_order_seq_cst
113
- } _Py_memory_order;
114
-
115
- typedef struct _Py_atomic_address {
116
- uintptr_t _value;
117
- } _Py_atomic_address;
118
-
119
- typedef struct _Py_atomic_int {
120
- int _value;
121
- } _Py_atomic_int;
122
-
123
-
124
- static __inline__ void
125
- _Py_atomic_signal_fence(_Py_memory_order order)
126
- {
127
- if (order != _Py_memory_order_relaxed)
128
- __asm__ volatile("":::"memory");
129
- }
130
-
131
- static __inline__ void
132
- _Py_atomic_thread_fence(_Py_memory_order order)
133
- {
134
- if (order != _Py_memory_order_relaxed)
135
- __asm__ volatile("mfence":::"memory");
136
- }
137
-
138
- /* Tell the race checker about this operation's effects. */
139
- static __inline__ void
140
- _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
141
- {
142
- (void)address; /* shut up -Wunused-parameter */
143
- switch(order) {
144
- case _Py_memory_order_release:
145
- case _Py_memory_order_acq_rel:
146
- case _Py_memory_order_seq_cst:
147
- _Py_ANNOTATE_HAPPENS_BEFORE(address);
148
- break;
149
- case _Py_memory_order_relaxed:
150
- case _Py_memory_order_acquire:
151
- break;
152
- }
153
- switch(order) {
154
- case _Py_memory_order_acquire:
155
- case _Py_memory_order_acq_rel:
156
- case _Py_memory_order_seq_cst:
157
- _Py_ANNOTATE_HAPPENS_AFTER(address);
158
- break;
159
- case _Py_memory_order_relaxed:
160
- case _Py_memory_order_release:
161
- break;
162
- }
163
- }
164
-
165
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
166
- __extension__ ({ \
167
- __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
168
- __typeof__(atomic_val->_value) new_val = NEW_VAL;\
169
- volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \
170
- _Py_memory_order order = ORDER; \
171
- _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
172
- \
173
- /* Perform the operation. */ \
174
- _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \
175
- switch(order) { \
176
- case _Py_memory_order_release: \
177
- _Py_atomic_signal_fence(_Py_memory_order_release); \
178
- /* fallthrough */ \
179
- case _Py_memory_order_relaxed: \
180
- *volatile_data = new_val; \
181
- break; \
182
- \
183
- case _Py_memory_order_acquire: \
184
- case _Py_memory_order_acq_rel: \
185
- case _Py_memory_order_seq_cst: \
186
- __asm__ volatile("xchg %0, %1" \
187
- : "+r"(new_val) \
188
- : "m"(atomic_val->_value) \
189
- : "memory"); \
190
- break; \
191
- } \
192
- _Py_ANNOTATE_IGNORE_WRITES_END(); \
193
- })
194
-
195
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
196
- __extension__ ({ \
197
- __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
198
- __typeof__(atomic_val->_value) result; \
199
- volatile __typeof__(result) *volatile_data = &atomic_val->_value; \
200
- _Py_memory_order order = ORDER; \
201
- _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
202
- \
203
- /* Perform the operation. */ \
204
- _Py_ANNOTATE_IGNORE_READS_BEGIN(); \
205
- switch(order) { \
206
- case _Py_memory_order_release: \
207
- case _Py_memory_order_acq_rel: \
208
- case _Py_memory_order_seq_cst: \
209
- /* Loads on x86 are not releases by default, so need a */ \
210
- /* thread fence. */ \
211
- _Py_atomic_thread_fence(_Py_memory_order_release); \
212
- break; \
213
- default: \
214
- /* No fence */ \
215
- break; \
216
- } \
217
- result = *volatile_data; \
218
- switch(order) { \
219
- case _Py_memory_order_acquire: \
220
- case _Py_memory_order_acq_rel: \
221
- case _Py_memory_order_seq_cst: \
222
- /* Loads on x86 are automatically acquire operations so */ \
223
- /* can get by with just a compiler fence. */ \
224
- _Py_atomic_signal_fence(_Py_memory_order_acquire); \
225
- break; \
226
- default: \
227
- /* No fence */ \
228
- break; \
229
- } \
230
- _Py_ANNOTATE_IGNORE_READS_END(); \
231
- result; \
232
- })
233
-
234
- #elif defined(_MSC_VER)
235
- /* _Interlocked* functions provide a full memory barrier and are therefore
236
- enough for acq_rel and seq_cst. If the HLE variants aren't available
237
- in hardware they will fall back to a full memory barrier as well.
238
-
239
- This might affect performance but likely only in some very specific and
240
- hard to meassure scenario.
241
- */
242
- #if defined(_M_IX86) || defined(_M_X64)
243
- typedef enum _Py_memory_order {
244
- _Py_memory_order_relaxed,
245
- _Py_memory_order_acquire,
246
- _Py_memory_order_release,
247
- _Py_memory_order_acq_rel,
248
- _Py_memory_order_seq_cst
249
- } _Py_memory_order;
250
-
251
- typedef struct _Py_atomic_address {
252
- volatile uintptr_t _value;
253
- } _Py_atomic_address;
254
-
255
- typedef struct _Py_atomic_int {
256
- volatile int _value;
257
- } _Py_atomic_int;
258
-
259
-
260
- #if defined(_M_X64)
261
- #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \
262
- switch (ORDER) { \
263
- case _Py_memory_order_acquire: \
264
- _InterlockedExchange64_HLEAcquire((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \
265
- break; \
266
- case _Py_memory_order_release: \
267
- _InterlockedExchange64_HLERelease((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \
268
- break; \
269
- default: \
270
- _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \
271
- break; \
272
- }
273
- #else
274
- #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0);
275
- #endif
276
-
277
- #define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \
278
- switch (ORDER) { \
279
- case _Py_memory_order_acquire: \
280
- _InterlockedExchange_HLEAcquire((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \
281
- break; \
282
- case _Py_memory_order_release: \
283
- _InterlockedExchange_HLERelease((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \
284
- break; \
285
- default: \
286
- _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \
287
- break; \
288
- }
289
-
290
- #if defined(_M_X64)
291
- /* This has to be an intptr_t for now.
292
- gil_created() uses -1 as a sentinel value, if this returns
293
- a uintptr_t it will do an unsigned compare and crash
294
- */
295
- inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) {
296
- __int64 old;
297
- switch (order) {
298
- case _Py_memory_order_acquire:
299
- {
300
- do {
301
- old = *value;
302
- } while(_InterlockedCompareExchange64_HLEAcquire((volatile __int64*)value, old, old) != old);
303
- break;
304
- }
305
- case _Py_memory_order_release:
306
- {
307
- do {
308
- old = *value;
309
- } while(_InterlockedCompareExchange64_HLERelease((volatile __int64*)value, old, old) != old);
310
- break;
311
- }
312
- case _Py_memory_order_relaxed:
313
- old = *value;
314
- break;
315
- default:
316
- {
317
- do {
318
- old = *value;
319
- } while(_InterlockedCompareExchange64((volatile __int64*)value, old, old) != old);
320
- break;
321
- }
322
- }
323
- return old;
324
- }
325
-
326
- #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \
327
- _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER))
328
-
329
- #else
330
- #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value)
331
- #endif
332
-
333
- inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) {
334
- long old;
335
- switch (order) {
336
- case _Py_memory_order_acquire:
337
- {
338
- do {
339
- old = *value;
340
- } while(_InterlockedCompareExchange_HLEAcquire((volatile long*)value, old, old) != old);
341
- break;
342
- }
343
- case _Py_memory_order_release:
344
- {
345
- do {
346
- old = *value;
347
- } while(_InterlockedCompareExchange_HLERelease((volatile long*)value, old, old) != old);
348
- break;
349
- }
350
- case _Py_memory_order_relaxed:
351
- old = *value;
352
- break;
353
- default:
354
- {
355
- do {
356
- old = *value;
357
- } while(_InterlockedCompareExchange((volatile long*)value, old, old) != old);
358
- break;
359
- }
360
- }
361
- return old;
362
- }
363
-
364
- #define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \
365
- _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER))
366
-
367
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
368
- if (sizeof((ATOMIC_VAL)->_value) == 8) { \
369
- _Py_atomic_store_64bit((ATOMIC_VAL), NEW_VAL, ORDER) } else { \
370
- _Py_atomic_store_32bit((ATOMIC_VAL), NEW_VAL, ORDER) }
371
-
372
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
373
- ( \
374
- sizeof((ATOMIC_VAL)->_value) == 8 ? \
375
- _Py_atomic_load_64bit((ATOMIC_VAL), ORDER) : \
376
- _Py_atomic_load_32bit((ATOMIC_VAL), ORDER) \
377
- )
378
- #elif defined(_M_ARM) || defined(_M_ARM64)
379
- typedef enum _Py_memory_order {
380
- _Py_memory_order_relaxed,
381
- _Py_memory_order_acquire,
382
- _Py_memory_order_release,
383
- _Py_memory_order_acq_rel,
384
- _Py_memory_order_seq_cst
385
- } _Py_memory_order;
386
-
387
- typedef struct _Py_atomic_address {
388
- volatile uintptr_t _value;
389
- } _Py_atomic_address;
390
-
391
- typedef struct _Py_atomic_int {
392
- volatile int _value;
393
- } _Py_atomic_int;
394
-
395
-
396
- #if defined(_M_ARM64)
397
- #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \
398
- switch (ORDER) { \
399
- case _Py_memory_order_acquire: \
400
- _InterlockedExchange64_acq((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \
401
- break; \
402
- case _Py_memory_order_release: \
403
- _InterlockedExchange64_rel((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \
404
- break; \
405
- default: \
406
- _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \
407
- break; \
408
- }
409
- #else
410
- #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0);
411
- #endif
412
-
413
- #define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \
414
- switch (ORDER) { \
415
- case _Py_memory_order_acquire: \
416
- _InterlockedExchange_acq((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \
417
- break; \
418
- case _Py_memory_order_release: \
419
- _InterlockedExchange_rel((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \
420
- break; \
421
- default: \
422
- _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \
423
- break; \
424
- }
425
-
426
- #if defined(_M_ARM64)
427
- /* This has to be an intptr_t for now.
428
- gil_created() uses -1 as a sentinel value, if this returns
429
- a uintptr_t it will do an unsigned compare and crash
430
- */
431
- inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) {
432
- uintptr_t old;
433
- switch (order) {
434
- case _Py_memory_order_acquire:
435
- {
436
- do {
437
- old = *value;
438
- } while(_InterlockedCompareExchange64_acq(value, old, old) != old);
439
- break;
440
- }
441
- case _Py_memory_order_release:
442
- {
443
- do {
444
- old = *value;
445
- } while(_InterlockedCompareExchange64_rel(value, old, old) != old);
446
- break;
447
- }
448
- case _Py_memory_order_relaxed:
449
- old = *value;
450
- break;
451
- default:
452
- {
453
- do {
454
- old = *value;
455
- } while(_InterlockedCompareExchange64(value, old, old) != old);
456
- break;
457
- }
458
- }
459
- return old;
460
- }
461
-
462
- #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \
463
- _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER))
464
-
465
- #else
466
- #define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value)
467
- #endif
468
-
469
- inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) {
470
- int old;
471
- switch (order) {
472
- case _Py_memory_order_acquire:
473
- {
474
- do {
475
- old = *value;
476
- } while(_InterlockedCompareExchange_acq(value, old, old) != old);
477
- break;
478
- }
479
- case _Py_memory_order_release:
480
- {
481
- do {
482
- old = *value;
483
- } while(_InterlockedCompareExchange_rel(value, old, old) != old);
484
- break;
485
- }
486
- case _Py_memory_order_relaxed:
487
- old = *value;
488
- break;
489
- default:
490
- {
491
- do {
492
- old = *value;
493
- } while(_InterlockedCompareExchange(value, old, old) != old);
494
- break;
495
- }
496
- }
497
- return old;
498
- }
499
-
500
- #define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \
501
- _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER))
502
-
503
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
504
- if (sizeof((ATOMIC_VAL)->_value) == 8) { \
505
- _Py_atomic_store_64bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } else { \
506
- _Py_atomic_store_32bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) }
507
-
508
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
509
- ( \
510
- sizeof((ATOMIC_VAL)->_value) == 8 ? \
511
- _Py_atomic_load_64bit((ATOMIC_VAL), (ORDER)) : \
512
- _Py_atomic_load_32bit((ATOMIC_VAL), (ORDER)) \
513
- )
514
- #endif
515
- #else /* !gcc x86 !_msc_ver */
516
- typedef enum _Py_memory_order {
517
- _Py_memory_order_relaxed,
518
- _Py_memory_order_acquire,
519
- _Py_memory_order_release,
520
- _Py_memory_order_acq_rel,
521
- _Py_memory_order_seq_cst
522
- } _Py_memory_order;
523
-
524
- typedef struct _Py_atomic_address {
525
- uintptr_t _value;
526
- } _Py_atomic_address;
527
-
528
- typedef struct _Py_atomic_int {
529
- int _value;
530
- } _Py_atomic_int;
531
- /* Fall back to other compilers and processors by assuming that simple
532
- volatile accesses are atomic. This is false, so people should port
533
- this. */
534
- #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0)
535
- #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0)
536
- #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
537
- ((ATOMIC_VAL)->_value = NEW_VAL)
538
- #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
539
- ((ATOMIC_VAL)->_value)
540
- #endif
541
-
542
- /* Standardized shortcuts. */
543
- #define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \
544
- _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_seq_cst)
545
- #define _Py_atomic_load(ATOMIC_VAL) \
546
- _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_seq_cst)
547
-
548
- /* Python-local extensions */
549
-
550
- #define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \
551
- _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_relaxed)
552
- #define _Py_atomic_load_relaxed(ATOMIC_VAL) \
553
- _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_relaxed)
554
-
555
- #ifdef __cplusplus
556
- }
557
- #endif
558
- #endif /* Py_ATOMIC_H */
@@ -1,37 +0,0 @@
1
- #ifndef Py_INTERNAL_CEVAL_H
2
- #define Py_INTERNAL_CEVAL_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_atomic.h"
12
- #include "pycore_pystate.h"
13
- #include "pythread.h"
14
-
15
- PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime);
16
- PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
17
- PyAPI_FUNC(void) _PyEval_FiniThreads(
18
- struct _ceval_runtime_state *ceval);
19
- PyAPI_FUNC(void) _PyEval_SignalReceived(
20
- struct _ceval_runtime_state *ceval);
21
- PyAPI_FUNC(int) _PyEval_AddPendingCall(
22
- PyThreadState *tstate,
23
- struct _ceval_runtime_state *ceval,
24
- int (*func)(void *),
25
- void *arg);
26
- PyAPI_FUNC(void) _PyEval_SignalAsyncExc(
27
- struct _ceval_runtime_state *ceval);
28
- PyAPI_FUNC(void) _PyEval_ReInitThreads(
29
- _PyRuntimeState *runtime);
30
-
31
- /* Private function */
32
- void _PyEval_Fini(void);
33
-
34
- #ifdef __cplusplus
35
- }
36
- #endif
37
- #endif /* !Py_INTERNAL_CEVAL_H */
@@ -1,27 +0,0 @@
1
- #ifndef Py_INTERNAL_CODE_H
2
- #define Py_INTERNAL_CODE_H
3
- #ifdef __cplusplus
4
- extern "C" {
5
- #endif
6
-
7
- typedef struct {
8
- PyObject *ptr; /* Cached pointer (borrowed reference) */
9
- uint64_t globals_ver; /* ma_version of global dict */
10
- uint64_t builtins_ver; /* ma_version of builtin dict */
11
- } _PyOpcache_LoadGlobal;
12
-
13
- struct _PyOpcache {
14
- union {
15
- _PyOpcache_LoadGlobal lg;
16
- } u;
17
- char optimized;
18
- };
19
-
20
- /* Private API */
21
- int _PyCode_InitOpcache(PyCodeObject *co);
22
-
23
-
24
- #ifdef __cplusplus
25
- }
26
- #endif
27
- #endif /* !Py_INTERNAL_CODE_H */
@@ -1,95 +0,0 @@
1
- #ifndef Py_INTERNAL_CONDVAR_H
2
- #define Py_INTERNAL_CONDVAR_H
3
-
4
- #ifndef Py_BUILD_CORE
5
- # error "this header requires Py_BUILD_CORE define"
6
- #endif
7
-
8
- #ifndef _POSIX_THREADS
9
- /* This means pthreads are not implemented in libc headers, hence the macro
10
- not present in unistd.h. But they still can be implemented as an external
11
- library (e.g. gnu pth in pthread emulation) */
12
- # ifdef HAVE_PTHREAD_H
13
- # include <pthread.h> /* _POSIX_THREADS */
14
- # endif
15
- #endif
16
-
17
- #ifdef _POSIX_THREADS
18
- /*
19
- * POSIX support
20
- */
21
- #define Py_HAVE_CONDVAR
22
-
23
- #include <pthread.h>
24
-
25
- #define PyMUTEX_T pthread_mutex_t
26
- #define PyCOND_T pthread_cond_t
27
-
28
- #elif defined(NT_THREADS)
29
- /*
30
- * Windows (XP, 2003 server and later, as well as (hopefully) CE) support
31
- *
32
- * Emulated condition variables ones that work with XP and later, plus
33
- * example native support on VISTA and onwards.
34
- */
35
- #define Py_HAVE_CONDVAR
36
-
37
- /* include windows if it hasn't been done before */
38
- #define WIN32_LEAN_AND_MEAN
39
- #include <windows.h>
40
-
41
- /* options */
42
- /* non-emulated condition variables are provided for those that want
43
- * to target Windows Vista. Modify this macro to enable them.
44
- */
45
- #ifndef _PY_EMULATED_WIN_CV
46
- #define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */
47
- #endif
48
-
49
- /* fall back to emulation if not targeting Vista */
50
- #if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA
51
- #undef _PY_EMULATED_WIN_CV
52
- #define _PY_EMULATED_WIN_CV 1
53
- #endif
54
-
55
- #if _PY_EMULATED_WIN_CV
56
-
57
- typedef CRITICAL_SECTION PyMUTEX_T;
58
-
59
- /* The ConditionVariable object. From XP onwards it is easily emulated
60
- with a Semaphore.
61
- Semaphores are available on Windows XP (2003 server) and later.
62
- We use a Semaphore rather than an auto-reset event, because although
63
- an auto-resent event might appear to solve the lost-wakeup bug (race
64
- condition between releasing the outer lock and waiting) because it
65
- maintains state even though a wait hasn't happened, there is still
66
- a lost wakeup problem if more than one thread are interrupted in the
67
- critical place. A semaphore solves that, because its state is
68
- counted, not Boolean.
69
- Because it is ok to signal a condition variable with no one
70
- waiting, we need to keep track of the number of
71
- waiting threads. Otherwise, the semaphore's state could rise
72
- without bound. This also helps reduce the number of "spurious wakeups"
73
- that would otherwise happen.
74
- */
75
-
76
- typedef struct _PyCOND_T
77
- {
78
- HANDLE sem;
79
- int waiting; /* to allow PyCOND_SIGNAL to be a no-op */
80
- } PyCOND_T;
81
-
82
- #else /* !_PY_EMULATED_WIN_CV */
83
-
84
- /* Use native Win7 primitives if build target is Win7 or higher */
85
-
86
- /* SRWLOCK is faster and better than CriticalSection */
87
- typedef SRWLOCK PyMUTEX_T;
88
-
89
- typedef CONDITION_VARIABLE PyCOND_T;
90
-
91
- #endif /* _PY_EMULATED_WIN_CV */
92
-
93
- #endif /* _POSIX_THREADS, NT_THREADS */
94
-
95
- #endif /* Py_INTERNAL_CONDVAR_H */