mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978 Approved by: https://github.com/zou3519
31 lines
607 B
Python
31 lines
607 B
Python
"""
|
|
Python polyfills for sys
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
from ..decorators import substitute_in_graph
|
|
|
|
|
|
__all__ = [
|
|
"intern",
|
|
"getrecursionlimit",
|
|
]
|
|
|
|
|
|
@substitute_in_graph(sys.intern, can_constant_fold_through=True)
|
|
def intern(string: str, /) -> str:
|
|
return string
|
|
|
|
|
|
@substitute_in_graph(sys.getrecursionlimit, can_constant_fold_through=True)
|
|
def getrecursionlimit() -> int:
|
|
return sys.getrecursionlimit()
|
|
|
|
|
|
@substitute_in_graph(sys.get_int_max_str_digits, can_constant_fold_through=True)
|
|
def get_int_max_str_digits() -> int:
|
|
return sys.get_int_max_str_digits()
|