Closed Bug 1527610 Opened 5 years ago Closed 5 years ago

[mozlog] Library fails after python 3 update; TypeError: vars() argument must have _dict_ attribute

Categories

(Testing :: Mozbase, defect, P3)

Version 3
defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: ahutusoru, Assigned: ahutusoru, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(2 files)

After installing the new version of mozlog library when running the following part of code:

import mozlog
mozlog.commandline.setup_logging('mozversion', None, {})

We receive the following error:

File "C:\Users\silviu.checherita\.virtualenvs\iris2-62hnA7_a\lib\site-packages\mozlog\commandline.py", line 263, in setup_logging
args = vars(args)
TypeError: vars() argument must have _dict_ attribute

The error is resulted from: https://searchfox.org/mozilla-central/source/testing/mozbase/mozlog/mozlog/commandline.py#263

Instead of args = vars(args) we can use args = args.__dict__

Are you using mozlog with python 3 here?

I think the bug here is that dict's don't have iteritems in Python 3, that's a really bad way to test for a dict. We should change the condition to if not isinstance(args, dict).

(In reply to Andrew Halberstadt [:ahal] from comment #1)

Are you using mozlog with python 3 here?

I think the bug here is that dict's don't have iteritems in Python 3, that's a really bad way to test for a dict. We should change the condition to if not isinstance(args, dict).

Yes, we are running mozlog with Python 3, and it hits some code that was not hit by the unit tests when library was updated.
I currently don't know what is the fix here, but I am going to try with what you suggested, should work.

Mentor: james
Keywords: good-first-bug

I have updated as you suggested, and now the bug did not reproduce anymore.
I have created a patch ready for review.
Thanks !

Hi @jgraham,

Can you please tell if there is anything to be done to correct this bug?

Thanks and Regards,
Shruthi

(In reply to shruthi0898 from comment #5)

Hi @jgraham,

Can you please tell if there is anything to be done to correct this bug?

Thanks and Regards,
Shruthi

A patch was already created and accepted.
It just needs to be merged into central.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:ahutusoru, could you have a look please?

Flags: needinfo?(ahutusoru)

This is more a question for Andrew.

Flags: needinfo?(ahutusoru) → needinfo?(ahal)

For future reference, if there's no needinfo or request on phabricator, best to assume I'm not going to see it. Bugmail/phabricator comments are very easy to miss.

Flags: needinfo?(ahal)

Sorry Andrei, looks like your patch bit-rotted. Could you rebase and push it to phabricator again?

Flags: needinfo?(hutusoru.andrei)
Type: enhancement → defect
Priority: -- → P3

Sorry for the late response.
Unfortunately I cannot update this on a daily basis.
If someone can take this and update it. Thank you !

Flags: needinfo?(hutusoru.andrei)

Hey Andrei & ahal. I'd be happy to update this one! As the version number will be updated to 4.1 with https://bugzilla.mozilla.org/show_bug.cgi?id=1550565, should I just stick with the changes, or update the versions to 4.1.1? I guess it depends on the order in which the patches both land?

Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2180deaa2c68
[mozlog] Library fails after python 3 update; TypeError: vars() argument must have _dict_ attribute r=ahal
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: