Visitar URL original
gh-100227: Move the Dict of Interned Strings to PyInterpreterState by ericsnowcurrently · Pull Request #102339 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unicode_is_finalizing().
  • Loading branch information
ericsnowcurrently committed Mar 27, 2023
commit 408ee56a97e291c8e5678e59fc0c26896d92c80e
8 changes: 4 additions & 4 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
_Py_error_handler error_handler, const char *errors,
Py_ssize_t *consumed);
#ifdef Py_DEBUG
static inline int unicode_is_finalizing(PyInterpreterState *);
static inline int unicode_is_finalizing(void);
static int unicode_is_singleton(PyObject *unicode);
#endif

Expand Down Expand Up @@ -1545,7 +1545,7 @@ unicode_dealloc(PyObject *unicode)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
#ifdef Py_DEBUG
if (!unicode_is_finalizing(interp) && unicode_is_singleton(unicode)) {
if (!unicode_is_finalizing() && unicode_is_singleton(unicode)) {
_Py_FatalRefcountError("deallocating an Unicode singleton");
}
#endif
Expand Down Expand Up @@ -15121,9 +15121,9 @@ _PyUnicode_EnableLegacyWindowsFSEncoding(void)

#ifdef Py_DEBUG
static inline int
unicode_is_finalizing(PyInterpreterState *interp)
unicode_is_finalizing(void)
{
return (get_interned_dict(interp) == NULL);
return (get_interned_dict(_PyInterpreterState_Main()) == NULL);
}
#endif

Expand Down