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-93057: Deprecate positional use of optional sqlite3.connect() params by erlend-aasland · Pull Request #107948 · python/cpython

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented Aug 14, 2023 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • Issue: Make optional parameters of sqlite3.connect() keyword-only #93057

📚 Documentation preview 📚: https://cpython-previews--107948.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

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

All reactions
@erlend-aasland
pythongh-93057: Deprecate positional use of optional sqlite3.connect(…
40996ef
…) params
@erlend-aasland
erlend-aasland requested a review from berkerpeksag as a code owner August 14, 2023 17:50
@erlend-aasland
erlend-aasland requested a review from serhiy-storchaka August 14, 2023 17:50
@bedevere-bot bedevere-bot mentioned this pull request Aug 11, 2023
Make optional parameters of sqlite3.connect() keyword-only #93057
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Aug 14, 2023
@erlend-aasland

This comment was marked as outdated.

Sign in to view
serhiy-storchaka
serhiy-storchaka reviewed Aug 14, 2023
View reviewed changes
Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

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

Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

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

erlend-aasland added 3 commits August 14, 2023 21:45
@erlend-aasland
Fix test and news entries
b84ee0e
@erlend-aasland
regen clinic
6ab04fd
@erlend-aasland
Address review: don't repeat the what's new entry
01c4067
erlend-aasland
erlend-aasland commented Aug 14, 2023
View reviewed changes
Comment thread Lib/test/test_sqlite3/test_factory.py Resolved

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed Aug 15, 2023
View reviewed changes

@serhiy-storchaka serhiy-storchaka 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.

There is an issue here. Positional parameters are only deprecated in the Connection constructor. But we want also to deprecate them in connect(). Currently you can bypass the deprecations if use the Connection subclass:

class MyConnection(Connection):
    def __init__(self, database, timeout=5.0, ...):
        super().__init__(database, timeout=timeout, ...)

connect(":memory:", 10.0, ..., factory=MyConnection)

But if we add the second deprecation warning in connect(), we will get two deprecation warning.

Sorry, something went wrong.

Uh oh!

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

All reactions
@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

There is an issue here. Positional parameters are only deprecated in the Connection constructor. But we want also to deprecate them in connect(). Currently you can bypass the deprecations if use the Connection subclass:

Ah, of course. That's tricky.

All reactions

Sorry, something went wrong.

Uh oh!

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

erlend-aasland added 2 commits August 15, 2023 08:57
@erlend-aasland
Manually insert deprecation warning for sqlite3.connect
de7e87c
@erlend-aasland
Pull in main
6f3e5c6
serhiy-storchaka
serhiy-storchaka reviewed Aug 15, 2023
View reviewed changes

@serhiy-storchaka serhiy-storchaka 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.

Please add a test for connect() and mention this change in What's New and NEWS entries.

It is a wart that we will get two warnings, but there is no simple way to avoid it, except applying deprecations one at a time -- first in connect(), then (since 3.15) in Connection. Not sure if it it is worth.

We can also convert all positional arguments in connect() into keyword arguments for factory. It is a lot of complex code.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/test/test_sqlite3/test_factory.py Resolved

Uh oh!

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

@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

We can also convert all positional arguments in connect() into keyword arguments for factory. It is a lot of complex code.

No, that is a backwards incompatible change.

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

mention this change in What's New and NEWS entries.

Is the existing NEWS and What's New entries insufficient? In what way?

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka

serhiy-storchaka commented Aug 15, 2023

Copy link
Copy Markdown
Member

Is the existing NEWS and What's New entries insufficient? In what way?

Ah, they already mention connect()! Then simply add "and the Connection constructor".

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland
Also test module level connect()
4018bd9
@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

Is the existing NEWS and What's New entries insufficient? In what way?

Ah, they already mention connect()! Then simply add "and the Connection constructor".

Yeah, that's useful information. I'll add that; thanks.

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland
Also mention the Connection constructor in What's New/NEWS
1f48783
serhiy-storchaka
serhiy-storchaka approved these changes Aug 15, 2023
View reviewed changes

@serhiy-storchaka serhiy-storchaka 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.

LGTM.

Sorry, something went wrong.

Uh oh!

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

erlend-aasland reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Aug 15, 2023
@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Serhiy. Much appreciated.

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland
erlend-aasland enabled auto-merge (squash) August 15, 2023 07:40
@erlend-aasland
erlend-aasland merged commit 13c36dc into python:main Aug 15, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Aug 15, 2023
@erlend-aasland
erlend-aasland deleted the sqlite/deprecate-optional-parameters branch August 15, 2023 08:13
@erlend-aasland

erlend-aasland commented Aug 15, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

@felixxm, sorry, I forgot to ping you; I hope not these deprecations will create havoc for Django.

All reactions

Sorry, something went wrong.

Uh oh!

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

@felixxm

felixxm commented Aug 15, 2023

Copy link
Copy Markdown
Contributor

@felixxm, sorry, I forgot to ping you; I hope not these deprecations will create havoc for Django.

All good, Django doesn't pass these positional params, only a database name. Thanks 👍

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Aug 16, 2023
@erlend-aasland @iritkatriel
pythongh-93057: Deprecate positional use of optional sqlite3.connect(…
0d8c344
…) params (python#107948)
Qadeem411
Qadeem411 approved these changes Jul 22, 2024
View reviewed changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag
+1 more reviewer
@Qadeem411 Qadeem411 Qadeem411 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

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.

5 participants

@erlend-aasland @serhiy-storchaka @felixxm @Qadeem411 @bedevere-bot
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.