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

small pypanda interface fixes #1532

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions panda/python/core/pandare/panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ def get_os_family(self):
family_num = self.libpanda.panda_os_familyno
family_name = self.ffi.string(self.ffi.cast("PandaOsFamily", family_num))
return family_name

def get_file_name(self, cpu, fd):
'''
Get the name of a file from a file descriptor.
Expand All @@ -1725,7 +1725,7 @@ def get_file_name(self, cpu, fd):
return None
if fname_ptr == self.ffi.NULL:
return None
return self.ffi.string(fname_ptr)
return self.ffi.string(fname_ptr).decode('utf8', 'ignore')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I like this change it will break all the code that uses this currently.

Also: in Linux I'd expect Latin-1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for Latin-1

PyPanda is versioned, are we not willing to make updates that break backwards compatibility with new versions? Or are you just suggesting we should update the in-tree uses of get_file_name to account for this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use utf-8 everywhere else in these interfaces, so maybe we should change those too if we're wanting to use Latin-1?


def get_current_process(self, cpu):
'''
Expand Down Expand Up @@ -1849,7 +1849,7 @@ def get_process_name(self, cpu):
return None

procname = self.ffi.string(proc.name).decode('utf8', 'ignore')
return self.ffi.string(proc.name).decode('utf8', 'ignore')
return procname


################## PYPERIPHERAL FUNCTIONS #####################
Expand Down
Loading