File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 66
77from django .utils .regex_helper import _lazy_re_compile
88
9+ # Private, stable API for detecting the Python implementation.
10+ PYPY = sys .implementation .name == "pypy"
11+
912# Private, stable API for detecting the Python version. PYXY means "Python X.Y
1013# or later". So that third-party apps can use these values, each constant
1114# should remain as long as the oldest supported Django version supports that
Original file line number Diff line number Diff line change 11import gc
2- import sys
32import weakref
43from types import TracebackType
54
65from django .dispatch import Signal , receiver
76from django .test import SimpleTestCase
87from django .test .utils import override_settings
8+ from django .utils .version import PYPY
99
10- if hasattr ( sys , "pypy_version_info" ) :
10+ if PYPY :
1111
1212 def garbage_collect ():
1313 # Collecting weakreferences can take two collections on PyPy.
Original file line number Diff line number Diff line change 3030 from django .test .utils import NullTimeKeeper , TimeKeeper , get_runner
3131 from django .utils .deprecation import RemovedInDjango60Warning
3232 from django .utils .log import DEFAULT_LOGGING
33- from django .utils .version import PY312
33+ from django .utils .version import PY312 , PYPY
3434
3535try :
3636 import MySQLdb
5252# references, which are a minority, so the garbage collection threshold can be
5353# larger than the default threshold of 700 allocations + deallocations without
5454# much increase in memory usage.
55- if not hasattr ( sys , "pypy_version_info" ) :
55+ if not PYPY :
5656 gc .set_threshold (100_000 )
5757
5858RUNTESTS_DIR = os .path .abspath (os .path .dirname (__file__ ))
You can’t perform that action at this time.
0 commit comments