mirror of
https://github.com/django/django.git
synced 2025-05-30 02:36:29 +00:00
Refs #34986 -- Added django.utils.version.PYPY.
This commit is contained in:
parent
174369a990
commit
9baaf89eed
@ -6,6 +6,9 @@ import sys
|
|||||||
|
|
||||||
from django.utils.regex_helper import _lazy_re_compile
|
from django.utils.regex_helper import _lazy_re_compile
|
||||||
|
|
||||||
|
# Private, stable API for detecting the Python implementation.
|
||||||
|
PYPY = sys.implementation.name == "pypy"
|
||||||
|
|
||||||
# Private, stable API for detecting the Python version. PYXY means "Python X.Y
|
# Private, stable API for detecting the Python version. PYXY means "Python X.Y
|
||||||
# or later". So that third-party apps can use these values, each constant
|
# or later". So that third-party apps can use these values, each constant
|
||||||
# should remain as long as the oldest supported Django version supports that
|
# should remain as long as the oldest supported Django version supports that
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import gc
|
import gc
|
||||||
import sys
|
|
||||||
import weakref
|
import weakref
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
|
||||||
from django.dispatch import Signal, receiver
|
from django.dispatch import Signal, receiver
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
from django.utils.version import PYPY
|
||||||
|
|
||||||
if hasattr(sys, "pypy_version_info"):
|
if PYPY:
|
||||||
|
|
||||||
def garbage_collect():
|
def garbage_collect():
|
||||||
# Collecting weakreferences can take two collections on PyPy.
|
# Collecting weakreferences can take two collections on PyPy.
|
||||||
|
@ -30,7 +30,7 @@ else:
|
|||||||
from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
|
from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
|
||||||
from django.utils.deprecation import RemovedInDjango60Warning
|
from django.utils.deprecation import RemovedInDjango60Warning
|
||||||
from django.utils.log import DEFAULT_LOGGING
|
from django.utils.log import DEFAULT_LOGGING
|
||||||
from django.utils.version import PY312
|
from django.utils.version import PY312, PYPY
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import MySQLdb
|
import MySQLdb
|
||||||
@ -52,7 +52,7 @@ warnings.simplefilter("error", RuntimeWarning)
|
|||||||
# references, which are a minority, so the garbage collection threshold can be
|
# references, which are a minority, so the garbage collection threshold can be
|
||||||
# larger than the default threshold of 700 allocations + deallocations without
|
# larger than the default threshold of 700 allocations + deallocations without
|
||||||
# much increase in memory usage.
|
# much increase in memory usage.
|
||||||
if not hasattr(sys, "pypy_version_info"):
|
if not PYPY:
|
||||||
gc.set_threshold(100_000)
|
gc.set_threshold(100_000)
|
||||||
|
|
||||||
RUNTESTS_DIR = os.path.abspath(os.path.dirname(__file__))
|
RUNTESTS_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user