Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#7915 enhancement closed fixed (fixed)

Update twisted/plugins to Py3 syntax enough to run trial

Reported by: Adi Roiban Owned by: Adi Roiban
Priority: normal Milestone: Python-3.x
Component: core Keywords:
Cc: Branch: branches/twisted-plugins-py3-7915-2
branch-diff, diff-cov, branch-cov, buildbot
Author: adiroiban

Description

I don't know if trial actually make use of the twisted/plugins but they are loaded by trial

The errors are simple

  File "/home/adi/chevah/twisted/build/py33/lib/python3.3/site-packages/zope/interface/declarations.py", line 412, in implements
    raise TypeError(_ADVICE_ERROR % 'implementer')
builtins.TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.

Attachments (1)

foo (180 bytes) - added by Moshe Zadka 3 years ago.
Example for adi

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by Adi Roiban

Author: adiroiban
Branch: branches/twisted-plugins-py3-7915

(In [44961]) Branching to twisted-plugins-py3-7915.

comment:2 Changed 3 years ago by Adi Roiban

Branch: branches/twisted-plugins-py3-7915branches/twisted-plugins-py3-7915-2

(In [44978]) Branching to twisted-plugins-py3-7915-2.

comment:3 Changed 3 years ago by Adi Roiban

Keywords: review added
Summary: Port twisted/plugins to Py3 enough to run trialUpdate twisted/plugins to Py3 syntax enough to run trial

Problem

When I try to run ./build/py33/bin/python3 bin/trial twisted/web -x I get errors from twisted/plugins due to py3 syntax error

Changes

I have updated the code from plugins loaded by trial to py3 syntax, together with other code loaded by those plugins.

The code is not ported in py3... but it can be imported in py3 without errors.

I am doing this to help bootstrap the trial py3 port.

No file was added to py3 dist file

How to test

Run python3 bin/trial twisted/web -x and you should no longer see error related to code from twisted.plugins.

There are still errors... but the errors are in trial code and they are already fixed by Hawkie in a branch dedicated to trial

Thanks!

comment:4 Changed 3 years ago by Moshe Zadka

Keywords: review removed
Owner: set to Adi Roiban

Hi Adi,

Thanks for working on this! I'm so excited to have trial work on Py3 :)

This needs to be fixed:

  1. The topfile seems to be missing content?

You might also consider:

  1. In twisted/conch/ssh/keys.py, "Util.number.bytes_to_long(signature[:20])," -- Can we add parens instead of violating DRY?

Please address and resubmit.

comment:5 Changed 3 years ago by Adi Roiban

Keywords: review added
Owner: changed from Adi Roiban to Moshe Zadka

Thanks for the review.

For topfile, what content do you expect? :) This is just a refactoring, it does not add no new feature. The code is not ported to py3, it is just updated to compile on py3. This is why I put it as .misc. Content of misc tickets is ignored.

For Util.number.bytes_to_long(signature[:20]) how should I use the parens ? I am more than happy to reduce duplication.

Thanks!

Changed 3 years ago by Moshe Zadka

Attachment: foo added

Example for adi

comment:6 Changed 3 years ago by Moshe Zadka

Keywords: review removed
Owner: changed from Moshe Zadka to Adi Roiban

Hi Adi,

Thanks for your clarifications.

HawkOwl said that .misc do not need content, so my bad. Anyway, as far as refactoring I attached an example.

Please either merge, or see if my example shows how to reduce code dup, and integrate + merge.

comment:7 Changed 3 years ago by Adi Roiban

Thanks. Don't worry! I am also not 100% familiar with the review process.

I am very happy to see you doing the review :)

Note that the splice is not duplicated, only the call for conversion is duplicate.

The calls are:

list[:N]
list[N:]


Thanks for not letting this go.

I did a poor job in the previous path.

I will updated it to

            numbers = [
                Util.number.bytes_to_long(n) for n in
                    (signature[:20], signature[20:])
                ]

Thanks!

comment:8 Changed 3 years ago by Adi Roiban

Resolution: fixed
Status: newclosed

(In [44988]) Merge twisted-plugins-py3-7915-2: Update twisted/plugins and imported code to py3 syntax to help port trial.

Author: adiroiban Reviewer: moshez Fixes: #7915

comment:9 Changed 3 years ago by Adi Roiban

This also fixes #6918

Note: See TracTickets for help on using tickets.