GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.11] gh-109795: `_thread.start_new_thread`: allocate thread bootsta… · python/cpython@0afae89

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Modules
    • _threadmodule.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Modules/_threadmodule.c‎

Copy file name to clipboardExpand all lines: Modules/_threadmodule.c
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ thread_bootstate_free(struct bootstate *boot, int decref)
10681068
Py_DECREF(boot->args);
10691069
Py_XDECREF(boot->kwargs);
10701070
}
1071-
PyMem_Free(boot);
1071+
PyMem_RawFree(boot);
10721072
}
10731073

10741074

@@ -1164,13 +1164,16 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
11641164
return NULL;
11651165
}
11661166

1167-
struct bootstate *boot = PyMem_NEW(struct bootstate, 1);
1167+
// gh-109795: Use PyMem_RawMalloc() instead of PyMem_Malloc(),
1168+
// because it should be possible to call thread_bootstate_free()
1169+
// without holding the GIL.
1170+
struct bootstate *boot = PyMem_RawMalloc(sizeof(struct bootstate));
11681171
if (boot == NULL) {
11691172
return PyErr_NoMemory();
11701173
}
11711174
boot->tstate = _PyThreadState_Prealloc(interp);
11721175
if (boot->tstate == NULL) {
1173-
PyMem_Free(boot);
1176+
PyMem_RawFree(boot);
11741177
return PyErr_NoMemory();
11751178
}
11761179
boot->func = Py_NewRef(func);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.