Skip to content

Commit

Permalink
chore: use weakref.proxy to avoid circular referencing
Browse files Browse the repository at this point in the history
  • Loading branch information
ncclementi committed Aug 22, 2024
1 parent 95d060c commit c7a022f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ibis/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import keyword
import re
import urllib.parse
import weakref
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar

Expand Down Expand Up @@ -114,7 +115,7 @@ def _ipython_key_completions_(self) -> list[str]:
class DDLAccessor:
"""ddl accessor list views."""

def __init__(self, backend: BaseBackend):
def __init__(self, backend: weakref.proxy):
self._backend = backend

def _raise_if_not_implemented(self, method_name: str):
Expand Down Expand Up @@ -1051,7 +1052,7 @@ def tables(self):
@functools.cached_property
def ddl(self):
"""A ddl accessor."""
return DDLAccessor(self)
return DDLAccessor(weakref.proxy(self))

@property
@abc.abstractmethod
Expand Down

0 comments on commit c7a022f

Please sign in to comment.