Thanks to visit codestin.com
Credit goes to github.com

Skip to content

str(r.now()) or repr(r.now()) raise RuntimeError in python 3.7+ #110

Closed
@nlevitt

Description

@nlevitt

Describe the bug

This happens in python 3.7 but seemingly not earlier versions.

>>> from rethinkdb import RethinkDB
>>> r = RethinkDB()
>>> r.now()
Traceback (most recent call last):
  File "/Users/nlevitt/workspace/doublethink/doublethink-ve37/lib/python3.7/site-packages/rethinkdb/errors.py", line 246, in __iter__
    for sub in next(itr):
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nlevitt/workspace/doublethink/doublethink-ve37/lib/python3.7/site-packages/rethinkdb/ast.py", line 147, in __repr__
    return "<RqlQuery instance: %s >" % str(self)
  File "/Users/nlevitt/workspace/doublethink/doublethink-ve37/lib/python3.7/site-packages/rethinkdb/ast.py", line 144, in __str__
    return printer.print_query()
  File "/Users/nlevitt/workspace/doublethink/doublethink-ve37/lib/python3.7/site-packages/rethinkdb/errors.py", line 202, in print_query
    return ''.join(self.compose_term(self.root))
  File "/Users/nlevitt/workspace/doublethink/doublethink-ve37/lib/python3.7/site-packages/rethinkdb/errors.py", line 251, in __iter__
    for sub in token:
RuntimeError: generator raised StopIteration

Can be a major problem if code tries to log a query before running it, for example.

To Reproduce
Steps to reproduce the behavior:

  1. see above

Expected behavior
Return a reasonable stringification.

Screenshots
If applicable, add screenshots to help explain your problem.

System info

  • OS: tested on mac, linux
  • RethinkDB Version: any
  • Python client version: 2.4.1, 2.3.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions