add support for python 3.6 #216

pingf opened this Issue Jan 6, 2017 · 2 comments


None yet

3 participants

pingf commented Jan 6, 2017

when I use pip install with python 3.6, it says,

Sorry, but pony 0.7 requires Python of one of the following versions: 2.7, 3.3, 3.4 and 3.5. You have version 3.6.0


I installed pony with python3.6 (I never got the error that @pingf got, it just worked for me), however I think something in Python3.6 broke queries.

Using the following dummy test file:

#!/usr/bin/env python3.6

from pony import orm

db = orm.Database()

class Foo(db.Entity):
    name = orm.Required(str)

db.bind('sqlite', ':memory:')


with orm.db_session:

print( for _ in Foo))

With python3.5 the output is as expected (a Query object) however with python 3.6 the output is the following:

Traceback (most recent call last):
  File "./", line 17, in <module>
    print( for _ in Foo))
  File "<string>", line 2, in select
  File "/home/william/.local/lib/python3.6/site-packages/pony/utils/", line 58, in cut_traceback
    return func(*args, **kwargs)
  File "/home/william/.local/lib/python3.6/site-packages/pony/orm/", line 4930, in select
    return make_query(args, frame_depth=3)
  File "/home/william/.local/lib/python3.6/site-packages/pony/orm/", line 4917, in make_query
    tree, external_names, cells = decompile(gen)
  File "/home/william/.local/lib/python3.6/site-packages/pony/orm/", line 35, in decompile
    decompiler = Decompiler(codeobject)
  File "/home/william/.local/lib/python3.6/site-packages/pony/orm/", line 75, in __init__
  File "/home/william/.local/lib/python3.6/site-packages/pony/orm/", line 100, in decompile
    elif op in haslocal: arg = [code.co_varnames[oparg]]
IndexError: tuple index out of range
@kozlovsky kozlovsky closed this in 5ab01cb Jan 10, 2017
@kozlovsky kozlovsky added a commit that referenced this issue Jan 10, 2017
@kozlovsky kozlovsky Pony ORM Release 0.7.1 (2017-01-10)
# New features

* New warning DatabaseContainsIncorrectEmptyValue added, it is raised when the required attribute is empty during loading an entity from the database

# Bugfixes

* Fixes #216: Added Python 3.6 support
* Fixes #203: subtranslator should use argnames from parent translator
* Change a way aliases in SQL query are generated in order to fix a problem when a subquery alias masks a base query alias
* Volatile attribute bug fixed
* Fix creation of self-referenced foreign keys - before this Pony didn't create the foreign key for self-referenced attributes
* Bug fixed: when required attribute is empty the loading from the database shouldn't raise the validation error. Now Pony raises the warning DatabaseContainsIncorrectEmptyValue
* Throw an error with more clear explanation when a list comprehension is used inside a query instead of a generator expression: "Use generator expression (... for ... in ...) instead of list comprehension [... for ... in ...] inside query"

Thanks for reporting, should be fixed now!

@kozlovsky kozlovsky added the bug label Jan 10, 2017
@kozlovsky kozlovsky added this to the 0.7.1 milestone Jan 10, 2017
@kozlovsky kozlovsky self-assigned this Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment