Skip to content

The next in middleware args overwrites Python built-in one #370

Description

@leblancfg

slack_bolt version

Current HEAD.

Description

The keyword next used in slack_bolt.middleware.middleware.process() overwrites the Python builtin next(), used to produce the next item in iterables and generators. We are currently trying to pass a generator to a custom middleware, having us resorting in using a hack to use the generator as middleware.

Please consider using another variable name, or next_.

Cheers, and thank you for your great work! ❤️

C.C. @nikodraca

Activity

  1. leblancfg commented on Jun 7, 2021

    @leblancfg
    Author
  2. added this to the 1.7.0 milestone on Jun 7, 2021
  3. changed the title [-][BUG] Middleware.process `next` argument overwrites Python built-in[/-] [+]The `next` in middleware args overwrites Python built-in one[/+] on Jun 7, 2021
  4. seratch commented on Jun 7, 2021

    @seratch
    Contributor

    Hi @leblancfg, thanks for taking the time to report this!

    Indeed, this is possibly an issue when you use the built-in next in a listener function. As removing the next is a breaking change, we'll add an alias next_ for it. The change will be included in the next minor version.

  5. mwbrooks commented on Jun 7, 2021

    @mwbrooks
    Member

    Really great suggestion @leblancfg, thanks for creating an issue for this! ❤️

  6. added a commit that references this issue on Jul 9, 2021
    dce45c5
  7. leblancfg commented on Jul 9, 2021

    @leblancfg
    Author

    Thank you for this quick response @seratch! Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions