Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inspect object has no attribute date_format #19

Closed
linville opened this issue Apr 8, 2022 · 3 comments · Fixed by #20
Closed

Inspect object has no attribute date_format #19

linville opened this issue Apr 8, 2022 · 3 comments · Fixed by #20
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@linville
Copy link
Contributor

linville commented Apr 8, 2022

Inspecting a Chapter 10 file for just messages of type 0x30 errors out attempting to access a non-existent date_format attribute of the inspect object.

% pdm run c10 inspect path/to/file.c10 -t 0x30
-----------------------------------------------------------------------------------------------
| Channel | Type | Sequence | Size    | Time                        | Valid | Offset          |
-----------------------------------------------------------------------------------------------
'Inspect' object has no attribute 'date_format' at 0
'Inspect' object has no attribute 'date_format' at 336
... [snip] ...

Appears to be an issue with the following line:

if self.date_format:

I've worked around it by modifying that line to use getattr(..) to access the attribute (but wasn't quite confident if that was the fix or if it should just be initialized in __init__).

Reproduceable with Python 3.9 and 3.10.

@mcferrill
Copy link
Member

That looks reasonable. Are you able to submit a pull request to that effect? Bonus points for tests.

@mcferrill mcferrill added bug Something isn't working good first issue Good for newcomers labels Apr 8, 2022
@linville
Copy link
Contributor Author

linville commented Apr 8, 2022

Submitted getattr change w/ test that checks inspect filtering expected output.

Probably out of scope for this PR, but I had to bump Pytest to a newer version to get this fix to test with Python 3.10.

@mcferrill
Copy link
Member

Looks great! Let's get this merged!

I'll make a note to review dependencies and pick up that pytest update. Thanks for calling that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants