File tree Expand file tree Collapse file tree 3 files changed +6
-18
lines changed
Filter options
Expand file tree Collapse file tree 3 files changed +6
-18
lines changed
Original file line number Diff line number Diff line change @@ -6239,6 +6239,8 @@ _ctypes_mod_exec(PyObject *mod)
6239
6239
}
6240
6240
Py_ffi_closure_free (ptr );
6241
6241
6242
+ _ctypes_init_fielddesc ();
6243
+
6242
6244
ctypes_state * st = get_module_state (mod );
6243
6245
st -> _unpickle = PyObject_GetAttrString (mod , "_unpickle" );
6244
6246
if (st -> _unpickle == NULL ) {
Original file line number Diff line number Diff line change @@ -1461,8 +1461,8 @@ _Py_COMP_DIAG_PUSH
1461
1461
1462
1462
/* Delayed initialization. Windows cannot statically reference dynamically
1463
1463
loaded addresses from DLLs. */
1464
- static void
1465
- _ctypes_init_fielddesc_locked (void )
1464
+ void
1465
+ _ctypes_init_fielddesc (void )
1466
1466
{
1467
1467
/* Fixed-width integers */
1468
1468
@@ -1659,30 +1659,14 @@ print(f" formattable.simple_type_chars[i] = 0;")
1659
1659
#undef FIXINT_FIELDDESC_FOR
1660
1660
_Py_COMP_DIAG_POP
1661
1661
1662
- static void
1663
- _ctypes_init_fielddesc (void )
1664
- {
1665
- static bool initialized = false;
1666
- static PyMutex mutex = {0 };
1667
- PyMutex_Lock (& mutex );
1668
- if (!initialized ) {
1669
- _ctypes_init_fielddesc_locked ();
1670
- initialized = true;
1671
- }
1672
- PyMutex_Unlock (& mutex );
1673
- }
1674
-
1675
1662
char *
1676
1663
_ctypes_get_simple_type_chars (void ) {
1677
- _ctypes_init_fielddesc ();
1678
1664
return formattable .simple_type_chars ;
1679
1665
}
1680
1666
1681
1667
struct fielddesc *
1682
1668
_ctypes_get_fielddesc (const char * fmt )
1683
1669
{
1684
- _ctypes_init_fielddesc ();
1685
-
1686
1670
struct fielddesc * result = NULL ;
1687
1671
switch (fmt [0 ]) {
1688
1672
/*[python input]
Original file line number Diff line number Diff line change @@ -537,6 +537,8 @@ extern int _ctypes_simple_instance(ctypes_state *st, PyObject *obj);
537
537
538
538
PyObject * _ctypes_get_errobj (ctypes_state * st , int * * pspace );
539
539
540
+ extern void _ctypes_init_fielddesc (void );
541
+
540
542
#ifdef USING_MALLOC_CLOSURE_DOT_C
541
543
void Py_ffi_closure_free (void * p );
542
544
void * Py_ffi_closure_alloc (size_t size , void * * codeloc );
You can’t perform that action at this time.
0 commit comments