File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -1264,6 +1264,13 @@ User-defined data types
1264
1264
registered (checked only by the address of the pointer), then
1265
1265
return the previously-assigned type-number.
1266
1266
1267
+ The number of user DTypes known to numpy is stored in
1268
+ ``NPY_NUMUSERTYPES``, a static global variable that is public in the
1269
+ C API. Accessing this symbol is inherently *not* thread-safe. If
1270
+ for some reason you need to use this API in a multithreaded context,
1271
+ you will need to add your own locking, NumPy does not ensure new
1272
+ data types can be added in a thread-safe manner.
1273
+
1267
1274
.. c:function:: int PyArray_RegisterCastFunc( \
1268
1275
PyArray_Descr* descr, int totype, PyArray_VectorUnaryFunc* castfunc)
1269
1276
Original file line number Diff line number Diff line change 1
1
.. _global_state :
2
2
3
- ************
4
- Global state
5
- ************
3
+ ****************************
4
+ Global Configuration Options
5
+ ****************************
6
6
7
- NumPy exposes global state in legacy APIs and a few import-time,
8
- compile-time, or runtime options which change the global behaviour.
9
- Most of these are related to performance or for debugging purposes and
10
- will not be interesting to the vast majority of users.
7
+ NumPy has a few import-time, compile-time, or runtime configuration
8
+ options which change the global behaviour. Most of these are related to
9
+ performance or for debugging purposes and will not be interesting to the
10
+ vast majority of users.
11
11
12
12
13
13
Performance-related options
@@ -70,10 +70,3 @@ and set the ``ndarray.base``.
70
70
71
71
.. versionchanged :: 1.25.2
72
72
This variable is only checked on the first import.
73
-
74
- Legacy User DTypes
75
- ==================
76
-
77
- The number of legacy user DTypes is stored in ``NPY_NUMUSERTPES ``, a global
78
- variable that is exposed in the NumPy C API. This means that the legacy DType
79
- API is inherently not thread-safe.
Original file line number Diff line number Diff line change @@ -268,6 +268,9 @@ specifies your data-type. This type number should be stored and made
268
268
available by your module so that other modules can use it to recognize
269
269
your data-type.
270
270
271
+ Note that this API is inherently thread-unsafe. See `thread_safety ` for more
272
+ details about thread safety in NumPy.
273
+
271
274
272
275
Registering a casting function
273
276
------------------------------
You can’t perform that action at this time.
0 commit comments