Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
P
pyatspi2
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • pyatspi2
  • Issues
  • #1

Closed
Open
Opened Jun 28, 2018 by Miro Hrončok@hroncokContributor

pyatspi is not Python 3.7 compatible due to using "async" as a attribute/argument name

pyatspi uses "async" as a attribute/argument name:

https://github.com/GNOME/pyatspi2/blob/150e7b386736d41ed3b95a5d691879e0a3246f57/pyatspi/registry.py#L114 https://gitlab.gnome.org/GNOME/pyatspi2/blob/150e7b386736d41ed3b95a5d691879e0a3246f57/pyatspi/registry.py#L114 (and below that as well).

This results in:

  File "/usr/lib/python3.7/site-packages/pyatspi/registry.py", line 114
    self.async = False	# not fully supported yet
             ^
SyntaxError: invalid syntax

https://docs.python.org/3/whatsnew/3.7.html#summary-release-highlights

Fedora reproducer: fedpkg build --target=f29-python -> https://koji.fedoraproject.org/koji/taskinfo?taskID=27887876

This needs to be renamed. But it kinda seems like part of an API, if that's true, it's a good idea to provide a backwards compatible API as well. I have a decorator that might be useful for this (consider it Public Domain or CC0):

from functools import wraps


def deprecated_async(func):
    """A decorator, that let's us keep our old API, but deprecate it"""
    @wraps(func)
    def inner(*args, **kwargs):
        if 'async' in kwargs:
            if 'asynchronous' in kwargs:
                raise ValueError('cannot use both async and asynchronous '
                                 'keyword arguments! the latter obsoletes the first.')
            warnings.warn('async keyword argumnt is deprecated, '
                          'use asynchronous instead', DeprecationWarning)
            kwargs['asynchronous'] = kwargs.pop('async')
        return func(*args, **kwargs)
    return inner


@deprecated_async
def awesome_func(foo, bar, asynchronous=False):
    """People can pass async or asynchronous"""
    ...

Fedora bug for cross reference: https://bugzilla.redhat.com/show_bug.cgi?id=1596269

Edited Jun 28, 2018 by Miro Hrončok
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/pyatspi2#1