GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Extend deprecation warning period for bitwise inversion on ``bool`` type · Issue #122982 · python/cpython

Extend deprecation warning period for bitwise inversion on bool type #122982

New issue
Copy link
New issue
Copy link
Closed
Closed
Extend deprecation warning period for bitwise inversion on bool type#122982
Copy link
Assignees
Eclips4
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@Eclips4
Eclips4
opened on Aug 13, 2024
Issue body actions

Feature or enhancement

Proposal:

Since Python 3.12, attempting to use bitwise inversion on a bool type is raises a DeprecationWarning:

Python 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = True
>>> ~a
<stdin>:1: DeprecationWarning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
-2
>>>

I have a PR ready.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-122982: Prohibit bitwise inversion on bool type #122983
  • gh-122982: Extend the deprecation period for bool inversion by two years #123306
  • [3.13] gh-122982: Extend the deprecation period for bool inversion by two years (GH-123306) #123316
  • [3.12] gh-122982: Extend the deprecation period for bool inversion by two years (GH-123306) #123317

Activity

  1. Eclips4
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Aug 13, 2024
  2. Eclips4
    self-assigned this
    on Aug 13, 2024
  3. encukou commented on Aug 14, 2024

    @encukou
    encukou
    on Aug 14, 2024
    Member
    More actions

    It's deprecated, but why should it be removed now?

    Reacted by Shantanu, Jean Abou Samra and Diego Garcia
  4. encukou commented on Aug 14, 2024

    @encukou
    encukou
    on Aug 14, 2024
    Member
    More actions

    Oh, I see the plan to remove it in 3.14 is in the docs, but not all the places it should be :(

  5. hauntsaninja commented on Aug 24, 2024

    @hauntsaninja
    hauntsaninja
    on Aug 24, 2024
    Contributor
    More actions

    I think the removal might affect a number of users (e.g. see comments on #103487); I'd vote for extending the deprecation period beyond the 2 year minimum

  6. Eclips4 commented on Aug 25, 2024

    @Eclips4
    Eclips4
    on Aug 25, 2024
    MemberAuthor
    More actions

    I think the removal might affect a number of users (e.g. see comments on #103487); I'd vote for extending the deprecation period beyond the 2 year minimum

    I've read these comments and I agree with your opinion. I'll close the PR and open a new one to properly document the deprecation.

  7. serhiy-storchaka commented on Aug 25, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 25, 2024
    Member
    More actions

    It is not necessary to close the PR. It can simply be postponed for few years.

    Reacted by Kristian Thy
  8. picnixz
    changed the title [-]Prohibit bitwise inversion on ``bool`` type[/-] [+]Extend deprecation warning for bitwise inversion on ``bool`` type[/+] on Aug 25, 2024
  9. picnixz
    changed the title [-]Extend deprecation warning for bitwise inversion on ``bool`` type[/-] [+]Extend deprecation warning period for bitwise inversion on ``bool`` type[/+] on Aug 25, 2024
  10. picnixz commented on Aug 25, 2024

    @picnixz
    picnixz
    on Aug 25, 2024
    Member
    More actions

    I've changed the title of the issue to highlight the fact that we are not removing it for now. We will change it later when we'll eventually remove it (just for tracking purposes)

    Reacted by Kirill Podoprigora
  11. hauntsaninja
    added a commit that references this issue on Aug 25, 2024

    gh-122982: Extend the deprecation period for bool inversion by two ye…

    249b083
  12. miss-islington
    added 2 commits that reference this issue on Aug 25, 2024

    pythongh-122982: Extend the deprecation period for bool inversion by …

    66ea0fa

    pythongh-122982: Extend the deprecation period for bool inversion by …

    ac0ec0b
  13. hauntsaninja
    added 2 commits that reference this issue on Aug 25, 2024

    [3.12] gh-122982: Extend the deprecation period for bool inversion by…

    93d4a19

    [3.13] gh-122982: Extend the deprecation period for bool inversion by…

    abaaaff
  14. nineteendo commented on Sep 26, 2024

    @nineteendo
    nineteendo
    on Sep 26, 2024
    Contributor
    More actions

    Can't this be closed now?

  15. picnixz commented on Sep 26, 2024

    @picnixz
    picnixz
    on Sep 26, 2024
    Member
    More actions

    Mmmh. Yes. We'll open another issue if we want to really deprecate the behaviour.

  16. picnixz
    closed this as completedon Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Eclips4
    Eclips4

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.