Skip to content

gh-118761: Improve import time by lazy import of warnings #129765

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Revert changing styles
  • Loading branch information
donBarbos committed Feb 7, 2025
commit 212a25fe865ea3c6c4fa622dc8d1d6b28450aaf4
7 changes: 3 additions & 4 deletions Lib/codeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@
PyCF_ONLY_AST = 0x400
PyCF_ALLOW_INCOMPLETE_INPUT = 0x4000


def _maybe_compile(compiler, source, filename, symbol):
# Check for source consisting of only blank lines and comments.
for line in source.split("\n"):
line = line.strip()
if line and line[0] != "#":
break # Leave it alone.
if line and line[0] != '#':
break # Leave it alone.
else:
if symbol != "eval":
source = "pass" # Replace it with a 'pass' statement
source = "pass" # Replace it with a 'pass' statement

import warnings

Expand Down
4 changes: 3 additions & 1 deletion Lib/hmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class HMAC:
"""
blocksize = 64 # 512-bit HMAC; can be changed in subclasses.

__slots__ = ("_hmac", "_inner", "_outer", "block_size", "digest_size")
__slots__ = (
"_hmac", "_inner", "_outer", "block_size", "digest_size"
)

def __init__(self, key, msg=None, digestmod=''):
"""Create a new HMAC object.
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy