Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-100227: Move the Dict of Interned Strings to PyInterpreterState #102339

Merged
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