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 — strptime exception context · Issue #61772 · python/cpython

strptime exception context #61772

New issue
Copy link
New issue
Copy link
Closed
Closed
strptime exception context#61772
Copy link
Assignees
ezio-melotti
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

PCManticore
mannequin
opened on Mar 29, 2013
Issue body actions
BPO 17572
Nosy @ezio-melotti, @PCManticore
Files
  • strptime.patch
  • issue17572.diff
  • 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 = 'https://github.com/ezio-melotti'
    closed_at = <Date 2013-04-03.23:17:26.376>
    created_at = <Date 2013-03-29.10:48:03.948>
    labels = ['type-bug', 'library']
    title = 'strptime exception context'
    updated_at = <Date 2013-04-03.23:17:26.375>
    user = 'https://github.com/PCManticore'

    bugs.python.org fields:

    activity = <Date 2013-04-03.23:17:26.375>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2013-04-03.23:17:26.376>
    closer = 'ezio.melotti'
    components = ['Library (Lib)']
    creation = <Date 2013-03-29.10:48:03.948>
    creator = 'Claudiu.Popa'
    dependencies = []
    files = ['29602', '29605']
    hgrepos = []
    issue_num = 17572
    keywords = ['patch']
    message_count = 4.0
    messages = ['185495', '185520', '185976', '185977']
    nosy_count = 3.0
    nosy_names = ['ezio.melotti', 'Claudiu.Popa', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue17572'
    versions = ['Python 3.3', 'Python 3.4']

    Activity

    1. PCManticore commented on Mar 29, 2013

      @PCManticore
      PCManticoremannequin
      on Mar 29, 2013
      MannequinAuthor
      More actions

      When using a directive that is not recognised by time.strptime, the following occurs in Python 3:

      >>> time.strptime("", "%D")
      Traceback (most recent call last):
        File "C:\Python33\lib\_strptime.py", line 320, in _strptime
          format_regex = _TimeRE_cache.compile(format)
        File "C:\Python33\lib\_strptime.py", line 268, in compile
          return re_compile(self.pattern(format), IGNORECASE)
        File "C:\Python33\lib\_strptime.py", line 262, in pattern
          self[format[directive_index]])
      KeyError: 'D'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "C:\Python33\lib\_strptime.py", line 494, in _strptime_time
          tt = _strptime(data_string, format)[0]
        File "C:\Python33\lib\_strptime.py", line 329, in _strptime
          (bad_directive, format))
      ValueError: 'D' is a bad directive in format '%D'
      >>>

      Probably the KeyError should be supressed when raising the ValueError. The attached patch tries to fix this issue, by suppressing the context.

    2. PCManticore
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Mar 29, 2013
    3. ezio-melotti commented on Mar 29, 2013

      @ezio-melotti
      ezio-melotti
      on Mar 29, 2013
      Member
      More actions

      The fix LGTM. The attached patch tweaks a bit your test and adds another one to check _strptime directly.

    4. python-dev commented on Apr 3, 2013

      @python-dev
      python-devmannequin
      on Apr 3, 2013
      Mannequin
      More actions

      New changeset 3203e083aa7b by Ezio Melotti in branch '3.3':
      bpo-17572: Avoid chained exceptions while passing bad directives to time.strptime(). Initial patch by Claudiu Popa.
      http://hg.python.org/cpython/rev/3203e083aa7b

      New changeset d408c9bd4bf7 by Ezio Melotti in branch 'default':
      bpo-17572: merge with 3.3.
      http://hg.python.org/cpython/rev/d408c9bd4bf7

    5. ezio-melotti commented on Apr 3, 2013

      @ezio-melotti
      ezio-melotti
      on Apr 3, 2013
      Member
      More actions

      Fixed, thanks for the report and the patch!

    6. ezio-melotti
      closed this as completedon Apr 3, 2013
    7. ezio-melotti
      self-assigned this
      on Apr 3, 2013
    8. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    9. gpshead
      added 3 commits that reference this issue on Nov 12, 2026

      gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772)

      f112215

      [3.15] gh-161763: Correct SSL docs for unconnected client sockets (#G…

      f49bb59

      [3.14] gh-161763: Correct SSL docs for unconnected client sockets (#G…

      83b1e74
    10. orsenthil
      added a commit that references this issue on Nov 12, 2026

      pythongh-161763: Correct SSL docs for unconnected client sockets (#py…

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

    Metadata

    Metadata

    Assignees

    • @ezio-melotti
      ezio-melotti

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    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.