Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-101693: In sqlite3, deprecate using named placeholders with parameters supplied as a sequence#101698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
b693895
gh-101698: Deprecate using named placeholders with sequences
erlend-aaslandFeb 8, 2023
483e4d6
Update docs
erlend-aaslandFeb 8, 2023
e826428
Document deprecation in reference
erlend-aaslandFeb 8, 2023
132a6ee
Also test executemany
erlend-aaslandFeb 8, 2023
31cc188
Revert "Also test executemany"
erlend-aaslandFeb 8, 2023
660a742
Sync with main
erlend-aaslandFeb 9, 2023
a18d0bb
Address review: add test for query with more than one named param
erlend-aaslandFeb 9, 2023
3f94201
Address review: add PyErr_WarnFormat error handling
erlend-aaslandFeb 9, 2023
997ccc6
Sync with main
erlend-aaslandFeb 10, 2023
cb091af
Pull in main
erlend-aaslandFeb 14, 2023
450cdcc
Fixup
erlend-aaslandFeb 14, 2023
841e8a4
Apply Serhiy's suggestion
erlend-aaslandFeb 14, 2023
3e7b680
Pull in main
erlend-aaslandFeb 14, 2023
38d1110
Address Alex's review
erlend-aaslandFeb 14, 2023
cf3cfc8
Also amend NEWS and What's New
erlend-aaslandFeb 14, 2023
1687b65
Use deprecated-removed
erlend-aaslandFeb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Document deprecation in reference
  • Loading branch information
@erlend-aasland
erlend-aasland committedFeb 8, 2023
commite826428be37abf850aefe1215c858870e35d24ea
17 changes: 11 additions & 6 deletionsDoc/library/sqlite3.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1435,6 +1435,11 @@ Cursor objects
and there is no open transaction,
a transaction is implicitly opened before executing *sql*.

.. versionchanged:: 3.12
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
..versionchanged::3.12
..deprecated-removed::3.12 3.14

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Are you sure about that? The API itself is not deprecated, we're just changing it. I'm not sure what's the recommended practice here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I know what you mean. I feel like ideally this notice would be phrased along the lines of "X behaviour/practice is now deprecated" rather than "a DeprecationWarning is now emitted". That would be more to-the-point, and it would also work more naturally with this directive (X behaviour/practice is deprecated in 3.12, and will be removed entirely in 3.14).

But I was struggling to come to with a concrete suggestion for how to reword these notices :/

Copy link
Member

Choose a reason for hiding this comment

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

(The whatsnew and NEWS entries look great btw, it's just the notices in the API docs that feelslightly clunky to me)

erlend-aasland reacted with hooray emoji
Copy link
ContributorAuthor

@erlend-aaslanderlend-aaslandFeb 14, 2023
edited
Loading

Choose a reason for hiding this comment

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

I feel like ideally this notice would be phrased along the lines of "X behaviour/practice is now deprecated" rather than "a DeprecationWarning is now emitted". That would be more to-the-point, and it would also work more naturally with this directive (X behaviour/practice is deprecated in 3.12, and will be removed entirely in 3.14).

Yes, but documented as deprecated and emitting aDeprecationWarning are similar, but not equal, things 🙂 With the former, we don't need to emit a warning in the code.

Copy link
Member

Choose a reason for hiding this comment

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

To your original question, btw: I think it's pretty standard to use.. deprecated or.. deprecated-removed, even if it's just a particular usage of an API, rather than the API itself. See e.g.https://docs.python.org/3.12/library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy, where the directive is used even though the class itself hasn't been deprecated at all; or#19867, which deprecated just a specific parameter; or lots of other examples in our docs 🙂

erlend-aasland reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Aight! I'll try to reword it.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've updated it to usedeprecated-removed, and I put in an extra line regarding what happens in 3.14. I'm too tired to reword the text 🙂

AlexWaygood reacted with thumbs up emoji

:exc:`DeprecationWarning` is raised if
:ref:`named placeholders <sqlite3-placeholders>` are used
and *parameters* is a sequence.

.. method:: executemany(sql, parameters, /)

Expand All@@ -1455,6 +1460,12 @@ Cursor objects
# cur is an sqlite3.Cursor object
cur.executemany("INSERT INTO data VALUES(?)", rows)

.. versionchanged:: 3.12

:exc:`DeprecationWarning` is raised if
:ref:`named placeholders <sqlite3-placeholders>` are used
and the items in *parameters* are sequences.

.. method:: executescript(sql_script, /)

Execute the SQL statements in *sql_script*.
Expand DownExpand Up@@ -1980,12 +1991,6 @@ Here's an example of both styles:

[('C', 1972)]

.. deprecated-removed:: 3.12 3.14

If named placeholders are used and *parameters* is a sequence,
:exc:`DeprecationWarning` is raised.
Starting with Python 3.14, :exc:`ProgrammingError` will be raised.

.. note::

:pep:`249` numeric placeholders are *not* supported.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp