--- /dev/null
+.. change::
+ :tags: bug, engine, tests
+ :tickets: 8019
+
+ Fixed issue where support for logging "stacklevel" implemented in
+ :ticket:`7612` required adjustment to work with recently released Python
+ 3.11.0b1, also repairs the unit tests which tested this feature.
if fmt:
message = fmt(message)
- if util.py38:
- kw["stacklevel"] = 2
+ if log.STACKLEVEL:
+ kw["stacklevel"] = 1 + log.STACKLEVEL_OFFSET
self.engine.logger.info(message, *arg, **kw)
if fmt:
message = fmt(message)
- if util.py38:
- kw["stacklevel"] = 2
+ if log.STACKLEVEL:
+ kw["stacklevel"] = 1 + log.STACKLEVEL_OFFSET
self.engine.logger.debug(message, *arg, **kw)
from typing import TypeVar
from typing import Union
+from .util import py311
from .util import py38
from .util.typing import Literal
+
+if py38:
+ STACKLEVEL = True
+ # needed as of py3.11.0b1
+ # #8019
+ STACKLEVEL_OFFSET = 2 if py311 else 1
+else:
+ STACKLEVEL = False
+ STACKLEVEL_OFFSET = 0
+
_IT = TypeVar("_IT", bound="Identified")
_EchoFlagType = Union[None, bool, Literal["debug"]]
selected_level = self.logger.getEffectiveLevel()
if level >= selected_level:
- if py38:
- kwargs["stacklevel"] = kwargs.get("stacklevel", 1) + 1
+
+ if STACKLEVEL:
+ kwargs["stacklevel"] = (
+ kwargs.get("stacklevel", 1) + STACKLEVEL_OFFSET
+ )
self.logger._log(level, msg, args, **kwargs)
return exclusions.closed()
+ @property
+ def asyncio(self):
+ return self.greenlet
+
@property
def greenlet(self):
def go(config):
from .compat import inspect_getfullargspec as inspect_getfullargspec
from .compat import local_dataclass_fields as local_dataclass_fields
from .compat import osx as osx
+from .compat import py311 as py311
from .compat import py38 as py38
from .compat import py39 as py39
from .compat import pypy as pypy
class TextSyncDBAPI(fixtures.TestBase):
+ __requires__ = ("asyncio",)
+
def test_sync_dbapi_raises(self):
with expect_raises_message(
exc.InvalidRequestError,
def async_dialect(self):
"""dialect makes use of await_() to invoke operations on the DBAPI."""
- return only_on(
+ return self.asyncio + only_on(
LambdaPredicate(
lambda config: config.db.dialect.is_async,
"Async dialect required",
pytest>=7.0.0rc1,<8
pytest-xdist
+ # cython and greenlet both not working on 3.11
# note cython not working for 3.11 at all right now
- git+https://github.com/python-greenlet/greenlet.git#egg=greenlet; python_version >= '3.11'
+ git+https://github.com/sqlalchemyorg/greenlet/@fix_py311_cpp#egg=greenlet; python_version >= '3.11'
sqlite: .[aiosqlite]
sqlite_file: .[aiosqlite]
sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
sqlite_file: SQLITE={env:TOX_SQLITE_FILE:--db sqlite_file}
+
py3{,7,8,9,10,11}-sqlite: EXTRA_SQLITE_DRIVERS={env:EXTRA_SQLITE_DRIVERS:--dbdriver sqlite --dbdriver aiosqlite}
+
py3{,7,8,9}-sqlite_file: EXTRA_SQLITE_DRIVERS={env:EXTRA_SQLITE_DRIVERS:--dbdriver sqlite --dbdriver aiosqlite --dbdriver pysqlcipher}
+
# omit pysqlcipher for Python 3.10
py3{,10,11}-sqlite_file: EXTRA_SQLITE_DRIVERS={env:EXTRA_SQLITE_DRIVERS:--dbdriver sqlite --dbdriver aiosqlite}