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 — Use sqlite3 extended error codes · Issue #68327 · python/cpython

Use sqlite3 extended error codes #68327

New issue
Copy link
New issue
Copy link
Closed
Closed
Use sqlite3 extended error codes#68327
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-featureA feature request or enhancementA feature request or enhancement

Description

dimaqq
mannequin
opened on May 7, 2015
Issue body actions
BPO 24139
Nosy @bitdancer, @dimaqq, @palaviv, @pablogsal, @erlend-aasland, @Fidget-Spinner
PRs
  • bpo-16379: Expose sqlite error code  #1108
  • bpo-24139: Add support for SQLite extended result codes #28076
  • bpo-24139: Fix sqlite3 test suite on s390x RHEL buildbots #29382
  • Files
  • 24139.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-11-02.23:52:46.446>
    created_at = <Date 2015-05-07.09:19:35.400>
    labels = ['extension-modules', 'type-feature']
    title = 'Use sqlite3 extended error codes'
    updated_at = <Date 2021-11-03.09:35:46.381>
    user = 'https://github.com/dimaqq'

    bugs.python.org fields:

    activity = <Date 2021-11-03.09:35:46.381>
    actor = 'kj'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-11-02.23:52:46.446>
    closer = 'erlendaasland'
    components = ['Extension Modules']
    creation = <Date 2015-05-07.09:19:35.400>
    creator = 'Dima.Tisnek'
    dependencies = []
    files = ['44280']
    hgrepos = []
    issue_num = 24139
    keywords = ['patch']
    message_count = 8.0
    messages = ['242710', '242714', '273949', '274008', '274009', '274065', '405569', '405595']
    nosy_count = 7.0
    nosy_names = ['ghaering', 'r.david.murray', 'Dima.Tisnek', 'palaviv', 'pablogsal', 'erlendaasland', 'kj']
    pr_nums = ['1108', '28076', '29382']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue24139'
    versions = ['Python 3.6']

    Activity

    1. dimaqq commented on May 7, 2015

      @dimaqq
      dimaqqmannequin
      on May 7, 2015
      MannequinAuthor
      More actions

      Let's fetch extended error codes from SQLite, information contained is not particularly interesting to the user, but may be invaluable in debugging!

      http://www.sqlite.org/rescode.html
      https://sqlite.org/c3ref/extended_result_codes.html
      http://www.sqlite.org/c3ref/errcode.html

      Current behaviour:

      For example, consider that extended error was SQLITE_READONLY_DBMOVED, it would be set in https://github.com/mackyle/sqlite/blob/1caed0ecc62583c4f8a509ff66ae99b6939fe727/src/pager.c#L4836 without explicit detail string.

      Python will call sqlite3_errcode() which will strip extended information via & errMask in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L2176

      Python will then call sqlite3_errmsg(), and the error message will be according to truncated (simple) error per:
      https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318

      P.S. there are a few cases where sqlite3 internally sets both error code and message, in those cases, current Python module (presumably) reads out the error message correctly. For example https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1584

    2. dimaqq
      added
      extension-modulesC modules in the Modules dirC modules in the Modules dir
      type-featureA feature request or enhancementA feature request or enhancement
      on May 7, 2015
    3. bitdancer commented on May 7, 2015

      @bitdancer
      bitdancer
      on May 7, 2015
      Member
      More actions

      It seems reasonable to provide as much error information as is available, one way or another. Would you like to work on a patch?

    4. palaviv commented on Aug 30, 2016

      @palaviv
      palavivmannequin
      on Aug 30, 2016
      Mannequin
      More actions

      Attached is a patch to enable the extended error codes. This patch should be dependent on bpo-16379.
      Without returning the sqlite error code in the exception the extended error code does not reveal any information not currently available. As you can see in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318 there are messages only for the non-extended error codes and that is what is exposed now.

    5. dimaqq commented on Aug 31, 2016

      @dimaqq
      dimaqqmannequin
      on Aug 31, 2016
      MannequinAuthor
      More actions

      Aviv the patch makes in itself.

      Are the changes in the other ticket needed to implement new tests?
      Or is it possible to include tests here?

    6. dimaqq commented on Aug 31, 2016

      @dimaqq
      dimaqqmannequin
      on Aug 31, 2016
      MannequinAuthor
      More actions

      I meant "the patch makes sense in itself".

    7. palaviv commented on Aug 31, 2016

      @palaviv
      palavivmannequin
      on Aug 31, 2016
      Mannequin
      More actions

      Are the changes in the other ticket needed to implement new tests?
      Or is it possible to include tests here?

      It is not possible to add any tests to this issue before exposing the error code. I will implement new tests when bpo-16379 will be resolved.

      Aviv the patch makes in itself.

      I think that this issue should be dependent on bpo-16379 as the behavior of the sqlite module will no be changed after this patch until bpo-16379 is resolved. In addition there will be some "rebase" issues that will need to be solved.

    8. pablogsal commented on Nov 2, 2021

      @pablogsal
      pablogsal
      on Nov 2, 2021
      Member
      More actions

      New changeset 456e27a by Erlend Egeberg Aasland in branch 'main':
      bpo-24139: Add support for SQLite extended result codes (GH-28076)
      456e27a

    9. erlend-aasland
      closed this as completedon Nov 2, 2021
    10. Fidget-Spinner commented on Nov 3, 2021

      @Fidget-Spinner
      Fidget-Spinner
      on Nov 3, 2021
      Member
      More actions

      New changeset 0dfb8c4 by Erlend Egeberg Aasland in branch 'main':
      bpo-24139: Fix test_sqlite3 test_extended_error_code_on_exception() on s390x RHEL buildbots (GH-29382)
      0dfb8c4

    11. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      extension-modulesC modules in the Modules dirC modules in the Modules dirtype-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.