HEX
Server: LiteSpeed
System: Linux server334.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: richfield (1256)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/google/protobuf/internal/__pycache__/testing_refleaks.cpython-36.pyc
3

���h��@s�dZddlZddlZyddlZWnek
r<ddlZYnXyddlZWnek
rfddlZYnXGdd�dej�ZGdd�dej	�Z
eed�r�e
Zej
Znej	Zdd	�ZdS)
a[A subclass of unittest.TestCase which checks for reference leaks.

To use:
- Use testing_refleak.BaseTestCase instead of unittest.TestCase
- Configure and compile Python with --with-pydebug

If sys.gettotalrefcount() is not available (because Python was built without
the Py_DEBUG option), then this module is a no-op and tests will run normally.
�Nc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�LocalTestResultzHA TestResult which forwards events to a parent object, except for Skips.cCstjj|�||_dS)N)�unittest�
TestResult�__init__�
parent_result)�selfr�r�&/usr/lib/python3.6/testing_refleaks.pyr:szLocalTestResult.__init__cCs|jj||�dS)N)r�addError)r�test�errorrrr	r
>szLocalTestResult.addErrorcCs|jj||�dS)N)r�
addFailure)rrrrrr	r
AszLocalTestResult.addFailurecCsdS)Nr)rr�reasonrrr	�addSkipDszLocalTestResult.addSkipN)�__name__�
__module__�__qualname__�__doc__rr
r
rrrrr	r7s
rcs.eZdZdZdZd�fdd�	Zdd�Z�ZS)	�ReferenceLeakCheckerTestCasezHA TestCase which runs tests multiple times, collecting reference counts.�Ncs�tjj�|_tt|�j|d�tt|�j|d�d}t|�}g}xBt|j	�D]4}|j
�}tt|�j|d�|j
�}|j||�qLWt||f�y|j
|dg|j	�Wn$tk
r�|j|tj��YnXdS)N)�resultr)�copyreg�dispatch_table�copy�_saved_pickle_registry�superr�runr�range�NB_RUNS�
_getRefcounts�append�printZassertEqual�	Exceptionr
�sys�exc_info)rrZoldrefcountZlocal_resultZrefcount_deltas�_Znewrefcount)�	__class__rr	rMs z ReferenceLeakCheckerTestCase.runcCs8tjj�tjj|j�tj�tj�tj�tj�S)N)	rr�clear�updater�gcZcollectr#�gettotalrefcount)rrrr	rgs
z*ReferenceLeakCheckerTestCase._getRefcounts)N)rrrrrrr�
__classcell__rr)r&r	rHsrr*cCs~dd�}|S)NcSs|S)Nr)�funcrrr	�Same|sz&SkipReferenceLeakChecker.<locals>.Samer)rr-rrr	�SkipReferenceLeakCheckerzsr.)rr)r#r�ImportErrorZ	unittest2rrrZTestCaser�hasattrZBaseTestCase�skipr.rrrr	�<module>'s"*