Edgewall Software

Opened 9 years ago

Closed 7 years ago

Last modified 6 years ago

#602 closed defect (duplicate)

genshi broken with python 3.5

Reported by: anonymous Owned by: cmlenz
Priority: major Milestone: 0.8
Component: General Version: 0.6
Keywords: Cc:

Description

Genshi 0.7 is incompatible with Python 3.5 due to changes in Python's ast module API. Of course ast's API is not guaranteed to be stable across Python releases.

Here's a link to build failures in an Ubuntu archive test rebuild against Python 3.5. Scroll to the bottom to see the failures. I don't have a fix yet.

https://launchpadlibrarian.net/210474355/buildlog_ubuntu-wily-amd64.genshi_0.7-3_BUILDING.txt.gz

Attachments (1)

t602.diff (3.7 KB) - added by trac@… 9 years ago.
Patch which passes tests in python 3.5

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by trac@…

Patch which passes tests in python 3.5

comment:1 Changed 9 years ago by trac@…

(Tim Hatch here, can't recall my edgewall login at the moment.)

I attached a patch which passes the tests. If anyone has a fuzzer to throw at it, I would appreciate additional confirmation that it works. The AST code is a little tricky.

comment:2 Changed 9 years ago by barry@…

I had to make one change to t602.diff. Since in Ubuntu we build versions for Python 2.7, 3.4, and 3.5 (currently), you first have to check if _ast.Starred exists, which it doesn't for Python 2.7. Thus:

                if hasattr(_ast, 'Starred') and isinstance(arg, _ast.Starred):
                    # Python 3.5+
                    self.star_args = arg.value.id
                else:
                    # only names
                    self.args.append(arg.id)

What's the status of getting a new version of Genshi released with this fix?

Last edited 7 years ago by rjollos (previous) (diff)

comment:3 Changed 7 years ago by hodgestar

  • Milestone changed from 0.7 to 0.8

comment:4 Changed 7 years ago by jaraco@…

I'm pretty sure this is a duplicate of #582 (already fixed, just not released).

comment:5 Changed 7 years ago by hodgestar

  • Resolution set to duplicate
  • Status changed from new to closed

Agreed. Closing.

comment:6 Changed 7 years ago by anonymous

The issue is not solved with #582, the diff still applies cleanly and seems to fix the reported issue

comment:7 Changed 7 years ago by lele

FYI, my Python 3 only branch fixes this and other minor issues.

comment:8 Changed 6 years ago by toni.sissala@…

Yup. Still broken. At least with Python 3.5 and Genshi 0.7 (latest from pip) I cannot use

py:attrs={'attr':None}

It gives me

lib/python3.5/site-packages/genshi/template/astutil.py", line 90, in visit
    raise Exception('Unhandled node type %r' % type(node))
Exception: Unhandled node type <class '_ast.NameConstant'>
Note: See TracTickets for help on using tickets.