mirror of
https://github.com/ROCm/jax.git
synced 2025-04-19 05:16:06 +00:00
Use sys.version_info to guard Python 3.11 only code.
This makes pytype happier since it understands sys.version_info, but didn't understand the previous hasattr() test. PiperOrigin-RevId: 587846307
This commit is contained in:
parent
aa270489bf
commit
193eb1289d
@ -18,6 +18,7 @@ import dataclasses
|
||||
import functools
|
||||
import itertools
|
||||
import os.path
|
||||
import sys
|
||||
import sysconfig
|
||||
import threading
|
||||
import types
|
||||
@ -141,8 +142,7 @@ def is_user_filename(filename: str) -> bool:
|
||||
not any(filename.startswith(p) for p in _exclude_paths) or
|
||||
any(filename.startswith(p) for p in _include_paths))
|
||||
|
||||
if hasattr(xla_client.Traceback, "code_addr2location"):
|
||||
# Python 3.11+
|
||||
if sys.version_info >= (3, 11):
|
||||
def raw_frame_to_frame(code: types.CodeType, lasti: int) -> Frame:
|
||||
loc = xla_client.Traceback.code_addr2location(code, lasti)
|
||||
start_line, start_column, end_line, end_column = loc
|
||||
|
Loading…
x
Reference in New Issue
Block a user