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 — gh-102029: Deprecate passing arguments to `_PyRLock` in `threading` by sobolevn · Pull Request #102071 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Feb 20, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I hope that this is not really a breaking change. Here's my reasoning:

  1. _PyRLock was the first one (since python2). People are familiar with it: and its signature was always correct
  2. Since passing values never made any sense, I hope nobody does rely on it
  3. Subclasses still work correctly, eventhough they are not really recommened (and RLock is exposed as a function)
  4. typeshed always had RLock defined as () -> RLock with no complains: https://github.com/python/typeshed/blob/40d853cbe239bcf1479e25c2c59615158b672610/stdlib/threading.pyi#L115-L122
  5. I was not able to find any references to RLock with arguments

As the next step, I will propose to deprecate the Python version.

  • Issue: threading.RLock must not support *args, **kwargs arguments #102029

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added the awaiting review label Feb 20, 2023
@sobolevn sobolevn changed the title Sync __new__ sigs of _CRLock and _PyRLock in threading gh-102029: Sync __new__ sigs of _CRLock and _PyRLock in threading Feb 20, 2023
@bedevere-bot bedevere-bot mentioned this pull request Feb 20, 2023
threading.RLock must not support *args, **kwargs arguments #102029
Closed
@sobolevn
sobolevn requested a review from pablogsal February 20, 2023 12:46
@sobolevn
pythongh-102029: Sync __new__ sigs of _CRLock and _PyRLock in `…
4529493
…threading`
@sobolevn
sobolevn force-pushed the issue-102029 branch from d634476 to 4529493 Compare February 20, 2023 12:49
@sobolevn
Fix tests
9fa3bd3
@sobolevn

sobolevn commented Mar 11, 2023

Copy link
Copy Markdown
Member Author

@pablogsal friendly ping :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead
gpshead self-requested a review May 29, 2023 00:12
gpshead
gpshead reviewed May 29, 2023
View reviewed changes

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but I want to run it through a huge pile of tests at work just to see what - if any - oddball code was relying on passing ignored values. I hope nothing. I'll do that this week.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead gpshead self-assigned this May 29, 2023
@sobolevn

sobolevn commented May 29, 2023

Copy link
Copy Markdown
Member Author

Thank you! In the meantime, I will change the What's new entry.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead

gpshead commented May 30, 2023

Copy link
Copy Markdown
Member

note to self: I included this PR in an internal test run today, I'll have results by tonight/tomorrow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Merge commit
d5cef3e
@sobolevn

sobolevn commented May 31, 2023

Copy link
Copy Markdown
Member Author

hypothesis failures are not related.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead

gpshead commented May 31, 2023

Copy link
Copy Markdown
Member

I found only a single instance of a parameter being passed to RLock via testing this change in our huge codebase at work:

threading.RLock(verbose=True)

That code was originally written for Python 2.7 which did support an undocumented verbose argument on threading.RLock. https://github.com/python/cpython/blob/v2.7.18/Lib/threading.py#L132

Easy to fix. But it does suggest that we should just do this API change via our usual DeprecationWarning cycle rather than just assuming we can make it without notice.

sobolevn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gpshead
gpshead requested changes May 31, 2023
View reviewed changes
Comment thread Doc/whatsnew/3.13.rst Outdated

* Passing any arguments to :func:`threading.RLock` is now restricted.
Previously C version allowed any numbers of args and kwargs,
but they were just ignored. Python version never allowed any arguments.

@gpshead gpshead May 31, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement isn't accurate; Python <= 2.7 and 3.1 accepted a single undocumented verbose argument.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/threading.py Outdated
Lock = _allocate_lock

def RLock(*args, **kwargs):
def RLock():

@gpshead gpshead May 31, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do a regular DeprecationWarning API change cycle on this.

if args or kwargs:
    warnings.warn(DeprecationWarning, ...)

we can put that in 3.12 remove the ignored args/kwargs in 3.14.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sobolevn sobolevn Jun 1, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that 3.12 is now only accepting bugfixes, isn't it? I would prefer to have this change as safe as possible and to put it in 3.13+. Unless you insist :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gpshead reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot added awaiting changes and removed awaiting review labels May 31, 2023
@bedevere-bot

bedevere-bot commented May 31, 2023

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sobolevn added 3 commits June 1, 2023 10:20
@sobolevn
Pre-merge
fa6c0e0
@sobolevn
Merge
7a43b4c
@sobolevn
Change to DeprecationWarning
70904e8
@sobolevn

sobolevn commented Jun 1, 2023

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Jun 1, 2023
@bedevere-bot

bedevere-bot commented Jun 1, 2023

Copy link
Copy Markdown

Thanks for making the requested changes!

@gpshead: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot
bedevere-bot requested a review from gpshead June 1, 2023 07:34
sobolevn
sobolevn commented Jun 1, 2023
View reviewed changes
Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
Update Doc/whatsnew/3.13.rst
1f744df
@sobolevn sobolevn changed the title gh-102029: Sync __new__ sigs of _CRLock and _PyRLock in threading gh-102029: Deprecate passing arguments to _PyRLock in threading Aug 11, 2023
sobolevn added 4 commits August 11, 2023 11:33
@sobolevn
Merge
291f04c
@sobolevn
Fixup
849c2e3
@sobolevn
Improve test
acb531c
@sobolevn
Update message
f0c7244
@sobolevn

sobolevn commented Aug 11, 2023

Copy link
Copy Markdown
Member Author

@gpshead now this is deprecated in 3.13 and stated to be changed in 3.15 :)

gpshead reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv

ambv commented Aug 11, 2023

Copy link
Copy Markdown
Contributor

Closing and re-opening to retrigger CLA checks. Sorry for the noise.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv ambv closed this Aug 11, 2023
@ambv ambv reopened this Aug 11, 2023
gpshead
gpshead approved these changes Aug 11, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting change review labels Aug 11, 2023
@sobolevn

sobolevn commented Aug 11, 2023

Copy link
Copy Markdown
Member Author

Thanks everyone! CI is now green :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Aug 17, 2023

Copy link
Copy Markdown
Member Author

Can someone please click "merge"? :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead
gpshead merged commit 80f30cf into python:main Aug 17, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead gpshead approved these changes
@pablogsal pablogsal Awaiting requested review from pablogsal

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gpshead gpshead

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sobolevn @gpshead @bedevere-bot @ambv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.