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

It is possible for python_tzpath_context to fail in test_zoneinfo #102537

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@pganssle

Description

@pganssle

Bug report

This code started failing thepylint check onbackports.zoneinfo recently:

@staticmethod@contextlib.contextmanagerdefpython_tzpath_context(value):path_var="PYTHONTZPATH"try:withOS_ENV_LOCK:old_env=os.environ.get(path_var,None)os.environ[path_var]=valueyieldfinally:ifold_envisNone:delos.environ[path_var]else:os.environ[path_var]=old_env# pragma: nocover

It's kind of a non-issue, but itis true that if an error is raised while acquiringOS_ENV_LOCK or when callingos.environ.get,old_env won't be set, which will raise aNameError. This is a kind of rare situation anyway, and it would probably only come up during a non-recoverable error, but we may as well fix it — if only so that people who use CPython as an example of "good code" will have an example of the right way to handle this sort of situation.

Probably this is trivial enough that we can skip an issue and news, but I'll just create one anyway 😛

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp