Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

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

Closed

Description

@Eclips4

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

Activity

  1. self-assigned this
    on Aug 13, 2024
  2. encukou commented on Aug 14, 2024

    @encukou
    Member

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

  3. encukou commented on Aug 14, 2024

    @encukou
    Member

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

  4. hauntsaninja commented on Aug 24, 2024

    @hauntsaninja
    Contributor

    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

  5. Eclips4 commented on Aug 25, 2024

    @Eclips4
    MemberAuthor

    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.

  6. serhiy-storchaka commented on Aug 25, 2024

    @serhiy-storchaka
    Member

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

  7. changed the title [-]Prohibit bitwise inversion on ``bool`` type[/-] [+]Extend deprecation warning for bitwise inversion on ``bool`` type[/+] on Aug 25, 2024
  8. 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
  9. picnixz commented on Aug 25, 2024

    @picnixz
    Member

    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)

  10. added a commit that references this issue on Aug 25, 2024
  11. added 2 commits that reference this issue on Aug 25, 2024
  12. added 2 commits that reference this issue on Aug 25, 2024
  13. nineteendo commented on Sep 26, 2024

    @nineteendo
    Contributor

    Can't this be closed now?

  14. picnixz commented on Sep 26, 2024

    @picnixz
    Member

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

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

Metadata

Metadata

Assignees

Labels

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions