Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S Solaar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pwr-Solaar
  • Solaar
  • Merge requests
  • !249

Fix some bugs in udev.get_indexed_string.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/mulkieran/master-pyudev into master Dec 23, 2015
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: mulkieran

  • from_device_number raises an exception if no device found, rather than returning None. So, instead of checking the result, catch the exception.
  • Use Attributes.get() method instead of checking containment and using the index operator. This is really the only correct way, see rhbz#1267584.

Effect of the changes: Previously, if no device was found this method would raise an exception. Now it returns None instead. Previously, this method read a value for every key in what udev lists as its "available" attributes, which was expensive and potentially destructive. That was how the 'key in attributes' expression was implemented. Now, the method only reads the key of interest.

Reason for noticing all these problems: In pyudev-0.18 the Attributes class is fixed, and no longer has the [] operator or contains() method. This patch fixes several bugs while simultaneously avoiding these removed operators.

Signed-off-by: mulhern amulhern@redhat.com

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/mulkieran/master-pyudev