Skip to content

DeprecationWarning in _advance_tasklet #999

@johncarter-phntm

Description

@johncarter-phntm

Deprecation warning here in python 3.12:

yielded = self.generator.throw(type(error), error, traceback)

Environment details

  1. API: python-ndb
  2. OS type and version: Ubuntu 22.04
  3. Python version and virtual environment information: 3.12.3
  4. google-cloud- version: google-cloud-ndb==2.3.1

Steps to reproduce

  1. Call get_by_id with something that triggers an error, e.g. an out of range value

Code example

from google.cloud import ndb


class MyModel():
  foo = ndb.IntegerProperty()

def test_foo():
  # trigger an out of range error
  MyModel.get_by_id(15521907085945043008)

Stack trace

self = _TaskletFuture('get') <126572934096624>, send_value = None

    def _advance_tasklet(self, send_value=None, error=None):
        """Advance a tasklet one step by sending in a value or error."""
        # Avoid Python 2.7 import error
        from google.cloud.ndb import context as context_module
    
        try:
            with self.context.use():
                # Send the next value or exception into the generator
                if error:
                    traceback = error.__traceback__
>                   yielded = self.generator.throw(type(error), error, traceback)
E                   DeprecationWarning: the (type, exc, tb) signature of throw() is deprecated, use the single-arg signature instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: datastoreIssues related to the googleapis/python-ndb API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions